pywm icon indicating copy to clipboard operation
pywm copied to clipboard

Consider adding a .clang-format configuration file

Open Phundrak opened this issue 3 years ago • 2 comments

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'

...

Phundrak avatar Feb 12 '22 15:02 Phundrak

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 avatar Feb 12 '22 16:02 jbuchermn

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.

jbuchermn avatar Feb 18 '22 22:02 jbuchermn