-
-
Notifications
You must be signed in to change notification settings - Fork 21.9k
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
Switch to pre-commit for Git hooks #46235
Closed
Closed
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -41,4 +41,3 @@ CheckOptions: | |
- key: readability-braces-around-statements.ShortStatementLines | ||
value: '0' | ||
... | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
# Exclude files which shouldn't be modified by pre-commit hooks. | ||
exclude: | | ||
(?x)^( | ||
.*\.sln| # Expected to contain a BOM | ||
.*\.csproj| # Expected to contain a BOM | ||
.*\.patch| # Expected to contrain trailing whitespace | ||
.*\.pot| | ||
.*\.po| | ||
thirdparty/.*| # Third-party files | ||
platform/android/java/lib/src/com/google.*| # Third-party files | ||
.*-so_wrap\..* # Generated code | ||
) | ||
|
||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v3.4.0 | ||
hooks: | ||
- id: fix-byte-order-marker | ||
- id: end-of-file-fixer | ||
- id: trailing-whitespace | ||
|
||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
|
||
- repo: https://github.com/pocc/pre-commit-hooks | ||
rev: v1.1.1 | ||
hooks: | ||
- id: clang-format | ||
|
||
- repo: https://github.com/psf/black | ||
rev: 20.8b1 | ||
hooks: | ||
- id: black | ||
args: [-l 120] | ||
|
||
- repo: local | ||
hooks: | ||
- id: makerst | ||
name: Check XML class reference syntax and validity | ||
language: system | ||
pass_filenames: false | ||
entry: python doc/tools/makerst.py doc/classes modules --dry-run | ||
files: ^(modules/.*/doc_classes/*.xml|doc/classes/.*.xml)$ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1 @@ | ||
/* Localized versions of Info.plist keys */ | ||
|
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -353,4 +353,3 @@ healthchecksdb | |
|
||
# Backup folder for Package Reference Convert tool in Visual Studio 2017 | ||
MigrationBackup/ | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might need testing on Windows as typically the installed binary there is
python.exe
for Python 3.And apparently @BastiaanOlij has a setup where it's
py.exe
🙀There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indeed, Windows seems to use
python.exe
, at least when it's installed from www.python.org. And probably won't run the script directly ifpython
is removed from the command (which is also a valid option on macOS). I'll check whether it works on Windows at all a bit later.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to work fine on Windows.
Windows shell is capable of running python scripts directly, but
pre-commit
is not.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah but the thing is this stupid STUB thing that Windows does so if you try and run python, instead of it running your installed python, it will run this little program that redirects you to MSVC and tells it to install its version of Python. Like WTF..
py.exe worked because that didn't have a stub.
Can't remember the suggestion but someone told me how to turn that off and now the python executable in my python install works
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pre-commit has a config option default_language_version. Setting it to
python3
is enough to use Python 3 even withpython
executable nameminimal reproducible example:
output with
python: python2
: