-
-
Notifications
You must be signed in to change notification settings - Fork 1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Add KWStyle and AStyle to the build #3470
Conversation
Conversely, I don't see a single reason to use spaces. |
Consistent display. Allow fine-grained alignment by tools like AStyle. |
|
How do I set that on GitHub ? Plus, I don't want to set this for each project I'm working on, some are using 2 space tabs, some others are using 4 space tabs etc. And still, if someone set tabs=2 spaces, won't have the same than me with tabs=4 spaces.
Indeed, but it'll lead to error if you check for tabs indentation only. Or you allow tabs + space indentation, and it leads to a mess. EDIT: moreover, if you don't want your editor to replace tabs by space, AStyle will do it for you, like all whitespace changes. |
Tabs vs. Spaces
I'm on the spaces side of the fence, personally, but I seem to be part of the minority (by a considerable margin). Reasoning is the the way spaces display -- It is is consistent among every editor on earth. Switching to 3 or 4 spaces is quite common in editors. Tabs generally consume 8 characters, which makes this whole "80 char width" problem even worse. 80 Char Width Most developers are fine going over, but about 1/4 of our active developers still prefer to limit it to 80 due to display preferences. I know @jasp00 has stated he prefers 80 characters. I'm less concerned with the decision... it really must be abolished. I'm more concerned with how that will affect contributors like @jasp00. When we make this decision, we need to know how it will impact our contributors and that they have a valid workaround.
Current conventions need to be changed. These tasks are really coupled. Unfortunate for @zapashcanon now his PR is going to be spammed with opinion. Hopefully we can keep this civil. |
Actually, I don't like most of the conventions (about |
Well, now it will because you brought it up! :) My vote is to put the modifier by the type, not the by the variable. e.g.
|
Looks like we agree on this too. ;) EDIT: @tresf maybe I should open an issue for each convention, and do some kinda poll in it so we'll be able to make some progress ? |
We could but it's not a democracy. I feel the active contributors get to decide. i.e. No offense to the community at large, but if they're not editing code on a semi-regular basis, their opinion really doesn't count. |
Would you agree on giving me a list of those contributors so we ask them ? Because, otherwise, I feel like this will quickly get stuck. |
The broken |
The only thing I need are clear rules how to format the code. I don't prefer anything. |
@BaraMGB, maybe this wasn't clear in the first post, but anyway, you'll have something like: @tresf, I think I can find the list of contributors. ;) It's more like I don't feel like I should decide myself who is active enough to decide on this, as I'm not (currently at least) an active contributor. If you could clarify |
Hopefully this is a good start...
Some other recent contributors whose opinion would weigh in:
... and the ones that no longer contribute directly to codebase but would love to hear from:
Left out because I assume little/no investment in this topic
(prob missed a few) |
I stick with my advice. IMHO, this is not the place to talk about conventions, even less about all of them at the same time. You should:
|
It was to stay as close as possible to current conventions, that's what I'm trying to do. All other things can stay as is, but those two can't imho.
That's why I opened separated issues.
So it means no space indentation on line breaking. Which will just lead to have cases with something like 40 char. of indentation then 40 chars of real stuff, on this on many lines, making the code really hard to read. Moreover, nowadays, using spaces is what is the most used, see here.
So we have currently 1415 lines of code with more than 80 char. If we don't use spaces, it won't help to fix this.
That's what I'm saying. Still, I don't see any valid reason to use tabs or to limit line length to 80 char. |
Using tabs does NOT lead to misalignment because you can use spaces for this. If this creates errors then disable that check (because it's throwing errors for perfectly good code) or get a checker smart enough to allow alignment spaces. |
KWStyle.xml
Outdated
@@ -0,0 +1,131 @@ | |||
<Project>LMMS</Project> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please move this to .travis
. Also, I recommend making the filename lowercase, which is what we do for all non-class files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is useless, I can just remove it if you want ?
Ok, I choosed this name because it was the one given as an example on the doc. Will do.
#!/usr/bin/env bash | ||
|
||
if [ "$TYPE" = 'style' ]; then | ||
sudo apt install astyle kwstyle shellcheck |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it irony that this file uses 2-character indents? 😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wasn't intended haha.
One issue is the coding convention and another one is what a formatting tool should handle. |
I'm closing, will do it another way. |
Hi,
First, I'd like to say that this is far from being finished.
So, as it's been said in #3071, I started following the current conventions.
I'd like to first talk about max. line length and space vs. tabs.
Current convention is to try to limit line length to 80 char. I didn't checked all files, but I found lines with 211 char. I think we should just stop breaking lines. I don't know which software are used by LMMS developer, but personally, I'm using atom or nvim and they both display too long lines in a convenient way, e.g. :
I think, nowadays this is not useful anymore as every text editor should be handling this for you.
Would like to hear what do you think about this.
Currently, I set the limit to 250. I think we could set it to something even bigger, just to prevent some abuse, like 1000 char. Or we could just disable this check.
Then, tabs. I don't see a single reason why to use tabs over spaces nowadays. I don't know a single editor who can't replace tabs by space for you when you press tab. Tabs leads to strange display depending on your editor, so we won't see the same thing depending on our editor etc. So, I'd like that we switch to a 4 space indentation.
I'd like to fix those two points first, because they're leading to troubles with other checks.
To test the current KWStyle config, from the
lmms
folder: