Skip to content

Add pre-commit and bunch of autofixes support#2034

Merged
mhammond merged 3 commits intomhammond:mainfrom
Avasam:pre-commit.ci-autofixes
Mar 14, 2024
Merged

Add pre-commit and bunch of autofixes support#2034
mhammond merged 3 commits intomhammond:mainfrom
Avasam:pre-commit.ci-autofixes

Conversation

@Avasam
Copy link
Copy Markdown
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)

# A clang-format style that approximates Python's PEP 7
# Useful for IDE integration
BasedOnStyle: Google
AlwaysBreakAfterReturnType: All
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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 force-pushed the pre-commit.ci-autofixes branch from 9e5adab to 7194628 Compare March 13, 2024 02:04
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
@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.

2 participants