Skip to content
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

PEP7 C code linter #1351

Open
5 tasks
giampaolo opened this issue Oct 20, 2018 · 1 comment
Open
5 tasks

PEP7 C code linter #1351

giampaolo opened this issue Oct 20, 2018 · 1 comment

Comments

@giampaolo
Copy link
Owner

giampaolo commented Oct 20, 2018

We can currently run make flake8 to check that python code is compliant with PEP8 style guidelines. This is also run by Travis as part of the CI process and make flake8 is run on every commit via a GIT hook. We should do the same for the C code. In details what we should do is the following:

  • find a cmdline tool which checks that the C code is compliant with PEP7
  • get rid of make flake8 and add a new make lint target which will run both linters
  • fix C code style
  • integrate make lint as part of the Travis CI process
  • integrate it into the GIT hook script
@koubaa
Copy link

koubaa commented Sep 14, 2020

FWIW - on a whim I gave clang-format a try. So far it seems the main issues (at least with my settings) are:

  • Macros inside of arrays with a terminating semicolon are not handled properly
  • Closing braces of arrays are not on their own line (see https://reviews.llvm.org/D33029)

See this commit for when I tried to run it on a simple file inside of the cpython source tree:
koubaa/cpython@f1be783

For some of the other PEP7 requirements I didn't find equivalent clang-format settings.

Alternatives include (not exhaustive)

  • lint
  • clang-tidy (not sure how it differs from clang-format tbh)
  • uncrustify
  • artistic style

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants