-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Add .clang-format file and format the src/ and include/ with it. #3843
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
Conversation
|
@BumblingCoder thanks for this. The project is in dire need of code consistency. Since A few more notes...
Thanks again. |
|
For 1 and 2 I tried to match the existing style of the code as much as possible. These seemed to be the most common style options in the existing code (though that isn't very important for a reformat.) Redoing this on master should be easy, the only changes not made by script were the clang-format files and moving as single header that has to not be in alphabetical order.
|
Agreed however many of the plugins are not third-party code, we just don't organize it well yet. We'll need to provide you with that information. |
|
I created an issue to discuss the specifics of what a clang-format file should be. #3856 |
|
Qt Creator appears to support
Please no. It's bad enough the way it is, having your Travis build fail because of pedantic warnings, fixing these by trial-and-error because your compiler's warnings differ from the ones on Travis. It'll be extra annoying having your PR fail because of single "wrongly"-placed spaces, e.g. you wrote |
|
If you enforce the code style it actually has the effect of less formatting changes in the future. The idea is that the entire code base gets formatted in one big commit and then you don't see formatting changes in other random commits. It the style is not enforced you well see additional changes in the history when short edits a file and tigers formatting of the whole thing, changing code unrelated to their work because somebody else committed code that didn't match the style. Having the format enforced also means that the reviewer doesn't have to spend any time worrying about formatting because the automatic ci systems will tell them if it is wrong. As for formatting being a burden: it is easy to integrate clang-format into basically every editor, there are scripts that will run it on your locally changed files, and it is easy to set up as a client site git hook. There is no reason for the developer to manually worry about formatting, just let clang-format handle it. |
We already have a style task and it works well for fixing shellcheck issues. I'm not sure how this is different. It avoids the cat-and-mouse game that has been occurring when code is otherwise good to merge. It makes it so that PRs will rarely ask "Can you please reformat..." type questions.
Agreed.
So the Travis-CI check becomes moot as we standardize on an IDE, no? |
It will only fail on the style check. It's no more or less annoying than it failing on MacOS for NO REASON AT ALL. :)
I tend to agree with this. If Travis-CI is catching the style issues, we can just do it as we go, although we already have automatic commit bots for translations and we'll be doing the same thing with the authors/ |
I'm all for that one big commit. 👍
Shellcheck checks for potential bugs though, not formatting, right? So it's more similar to the
You'll just be playing the same game against the CI instead, searching through Travis logs.
In theory, sure, if we can get all contributors to use the same IDE, and if there are no version differences in I think it may alienate new contributors. Personally, I'd feel discouraged to contribute to a project that tries to enforce an IDE onto me and has strict CI checks that enforce every space in the code be at the place a program determines to be right. This level of nit-picking in quality control appears ridiculous to me for a project with such a broken architecture and no unit tests whatsoever. |
Well, the
Arguably, someone will, but it would be the code submitter (no longer a project admin). The
...
👍
Yeah, perhaps this idea is too wishful thinking and not based in reality. Many submitters just want to patch a problem, they don't want to download configure and fire up an IDE. That said, if we get major contributors that help refactor, redesign and enhance the product more than a few source files, standardizing the IDE is really just a step in taking on new talent. But it's certainly not coupled to this PR.
I'm not sure how I feel about this statement. I've submitted PRs to some projects that don't police this at all -- have a mess of formatting, commenting, indenting. I've seen other projects that are extremely strict and even police the way the PRs are titled. I don't think a style check is unreasonable/ridiculous although I do think that it can have the appearance of unreasonable given our current CI verbiage. |
4a0f15e to
e5db275
Compare
Update to latest
|
Reopening so we don't lose track of it. I think this should be re-done for master once 1.2 is released. |
A few things to avoid that: editor config, using a .gitattributes. |
|
For this issue, I see no files changed. I'm sorry that I didn't see this PR when opening #4690 . I think we should close this one now in favor of #4690 . If no vetos, I'll close in 7 days. @zapashcanon An editorconfig has been added in the last weeks. .gitattributes already exists, but feel free to open an issue/a PR for adding things. |
I also see no changes in the two commits. Closing. |
The .clang-format file attempts to follow the style described on the wiki and existing in the code. Having this file will make it easier for contributors to keep a consistent style within the application.