-
Notifications
You must be signed in to change notification settings - Fork 260
Add formatter config and workflows, format project #244
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
f497d8d to
79783e5
Compare
|
Microsoft is a space nazi when there is no config that says otherwise. Here is where you can configure tab width on github to use what you like best for viewing code in the browser: https://github.com/settings/appearance |
|
Currently the lint assumed that clangd installed used locally, then all common editors could take care of formatting via format on save or running a format command. I didn't integrated formatting and writing to the repository if formatting is off. We can do it if that's preferred. |
|
Formating on CI is better as we can not guarantee that all contributors have Clang installed. |
|
Okay, I see that automated writing of formatting changes can make sense in our case. I'll look into it. Though it is a valid requirement for contribution to meet a projects code style. And it's not guaranteed for most formatters unless a formatter is built into the language itself. Alternatively, a contributor could format manually to satisfy linting for now before a PR is merged if the linter is not happy. |
|
I mean, whatever is easier and efficient we should do it. We can format PR manually. |
|
I will use Clang to format code for my next PRs. |

Adds changes mentioned in: #242
I think the settings resemble the current style fairly well.
A style I couldn't find a matching setting for is to indent everything in pre-processor directives. Adding
IndentPPDirectives: BeforeHashto.clang-formatwould come closest, but variable declarations still wouldn't be indent, resulting in:Uniform indent without decls:
Not uniform indent for decls:
So I left the setting out to use the default / more commonly used style of not indenting pre-processor directives. The used sections for the directives are usually highlighted by the editor if an lsp is running:
If any changes would further improve things for you let me know.
Example runs: