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

GH-109408: Move the C file whitespace check from patchcheck to pre-commit #109890

Merged
merged 11 commits into from
Oct 10, 2023
Prev Previous commit
Next Next commit
More concise comment
  • Loading branch information
hugovk committed Oct 10, 2023
commit b70cece166d2f05c343d11d5a0d3981e4c7abaf6
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ repos:
entry: "python Tools/patchcheck/untabify.py"
language: "system"
types_or: ['c', 'c++']
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We were running on .c and .h files before:

c_files = [fn for fn in file_paths if fn.endswith(('.c', '.h'))]

Both of those are matched by the c type, so this would be closer to parity:

Suggested change
types_or: ['c', 'c++']
types_or: [c]

We do have half a dozen .cpp files in the codebase, do we want to expand to include them? Should we also add c++ for trailing-whitespace above?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The test passed with 'c++' included, I imagined that it was a previous oversight that they weren't included. I'll check if the trailing whitespace check also passes.

Copy link
Member Author

@AA-Turner AA-Turner Sep 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tools/msi/bundle/bootstrap/PythonBootstrapperApplication.cpp fails with 16 lines changed. Other than that all good (@zooba would you be alright with us enabling the trailing whitespace check here? No real views either way, if you'd prefer to keep the whitespace then that's the status quo anyway!)

A

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(We can always remove c++ later if needed.)

# Don't check the style of copies directories containing external libraries
# Don't check the style of vendored libraries
exclude: '^Modules/(_decimal/libmpdec|expat)/.*$'

- repo: https://github.com/sphinx-contrib/sphinx-lint
Expand Down