jbuchermn / pywm

Wayland compositor core employing wlroots - aims to handle the actual layout logic in python thereby enabling easily accessible wm concepts
69 stars 9 forks source link

Consider adding a .clang-format configuration file #5

Open Phundrak opened 2 years ago

Phundrak commented 2 years ago

When exploring the C code of pywm, I noticed my text editor would reformat the code to its defaults instead of trying to respect the existing code. A .clang-format file at the root of the project should fix that. This should also ensure a consistent visual coding style across the C files.

It is possible to easily generate one using for instance this website.

I propose the following .clang-format file:

---
BasedOnStyle: LLVM
AlignConsecutiveMacros: 'true'
AllowAllArgumentsOnNextLine: 'true'
ColumnLimit: '80'
DerivePointerAlignment: 'true'
IncludeBlocks: Regroup
IndentWidth: '4'
PointerAlignment: Right
ReflowComments: 'true'
SortIncludes: 'true'
SpaceBeforeParens: ControlStatements
SpaceInEmptyParentheses: 'false'
SpacesInParentheses: 'false'
SpacesInSquareBrackets: 'false'
TabWidth: '4'

...
jbuchermn commented 2 years ago

That's a good suggestion, thanks. I'll take a look into it and see if it makes sense to set up my editor accordingly.

Probably though we're not going to end up with a limit of 80 columns - I've had my share of annoyances with PEP-8, which also fixes width at 80 columns and I find that way less readable than long lines, 'cause you're constantly scrolling around

jbuchermn commented 2 years ago

I think I'll add this once v0.3 is released. Right now master and v0.3 have diverged quite a bit and I don't want to make merging them complicated. But after the release a clean slate with well-defined formatting is the way to go.