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

Add pre-commit and bunch of autofixes support #2034

Merged
merged 3 commits into from
Mar 14, 2024

Conversation

Avasam
Copy link
Collaborator

@Avasam Avasam commented Mar 25, 2023

Here's the "magically autofixing on pull-request" I was talking about.
You install pre-commit locally with pip install pre-commit and run it locally using pre-commit run [--all-files] (without --all-files it only runs on changed files, which is what would happen on the CI).
You can still run all commands individually if you feel like it (like black .)

Added autoformatting for toml, yaml and ini files as well (not json cuz there's none in this project).
Autofixes for mixed-line-ending, case-conflict trailing whitespaces and end-of-file newline. Although I didn't activate those last two because it'd create a massive commit, better keep that for it's own, easily ignorable from history.

Users who enjoy pre-commit git hooks (I don't, some do), can also now use this as a pre-commit hook on their own accord.

If this is accepted, the next step would be to sign-in on https://pre-commit.ci/ and connect it to this repo. (it's the CI autofixes version of https://pre-commit.com)

@@ -1,7 +1,6 @@
# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
BasedOnStyle: Google
AlwaysBreakAfterReturnType: All
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It found a duplicate entry!

*
* MAPI OID definition header file
*
* Copyright (c) 2009 Microsoft Corporation. All Rights Reserved.
Copy link
Collaborator Author

@Avasam Avasam Mar 25, 2023

Choose a reason for hiding this comment

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

It found an extra carriage return and fixed line endings

Copy link
Owner

Choose a reason for hiding this comment

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

We should exclude these "vendored" files though?

pycln.toml Outdated Show resolved Hide resolved
Copy link
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

Thanks, but files copied in from external sources should be excluded from these rules.

*
* MAPI OID definition header file
*
* Copyright (c) 2009 Microsoft Corporation. All Rights Reserved.
Copy link
Owner

Choose a reason for hiding this comment

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

We should exclude these "vendored" files though?

@Avasam Avasam requested a review from mhammond March 14, 2024 16:14
Copy link
Owner

@mhammond mhammond left a comment

Choose a reason for hiding this comment

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

Thanks!

@mhammond mhammond merged commit 1ba696d into mhammond:main Mar 14, 2024
27 checks passed
@Avasam Avasam deleted the pre-commit.ci-autofixes branch March 14, 2024 17:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants