forked from pytorch/data
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add auto-formatters as pre-commit hooks (pytorch#147)
Summary: This adds a couple of [`pre-commit` hooks](https://pre-commit.com) for auto-formatting files in the repository. The include mainly [`black`](https://github.com/psf/black) and [`usort`](https://github.com/facebookexperimental/usort) that are run through [`ufmt`](https://ufmt.omnilib.dev/en/stable/) and are fully compatible with Meta internal workflows. In addition, [`flake8`](https://github.com/pycqa/flake8) can also be run through this framework. To install the hooks `pip install pre-commit first` and afterwards run `pre-commit install` inside the repository. Now, every time you `git commit` something, these hooks will run and make sure the code format is correct. You can also invoke them manually with `pre-commit run`, which will check all staged files. For now I only included the configuration files. If they are approved, I'll pull the trigger and push all changes that need to be made to the repository to be compatible with the format. Pull Request resolved: pytorch#147 Reviewed By: VitalyFedyunin Differential Revision: D33404517 Pulled By: ejguan fbshipit-source-id: 42ccc8c5a83dc6fc1f674323fb6eed4cb383fe74
- Loading branch information
1 parent
6b5a959
commit c3ad9c0
Showing
52 changed files
with
583 additions
and
483 deletions.
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
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
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 |
---|---|---|
|
@@ -2,5 +2,5 @@ Fixes #{issue number} | |
|
||
### Changes | ||
|
||
- | ||
- | ||
- | ||
- |
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
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,36 @@ | ||
repos: | ||
- repo: https://github.com/pre-commit/pre-commit-hooks | ||
rev: v4.0.1 | ||
hooks: | ||
- id: check-docstring-first | ||
- id: mixed-line-ending | ||
args: [--fix=lf] | ||
- id: end-of-file-fixer | ||
|
||
- repo: https://github.com/pre-commit/mirrors-prettier | ||
rev: v2.5.1 | ||
hooks: | ||
- id: prettier | ||
types_or: | ||
- markdown | ||
- toml | ||
- yaml | ||
|
||
- repo: https://github.com/asottile/pyupgrade | ||
rev: v2.31.0 | ||
hooks: | ||
- id: pyupgrade | ||
args: [--py37-plus] | ||
|
||
- repo: https://github.com/omnilib/ufmt | ||
rev: v1.3.1 | ||
hooks: | ||
- id: ufmt | ||
additional_dependencies: | ||
- black == 21.12b0 | ||
- usort == 1.0.0 | ||
|
||
- repo: https://github.com/pycqa/flake8 | ||
rev: 4.0.1 | ||
hooks: | ||
- id: flake8 |
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,2 @@ | ||
proseWrap: always | ||
printWidth: 120 |
Oops, something went wrong.