Skip to content

Commit d935df5

Browse files
DeanChensjcopybara-github
authored andcommitted
chore: Add pre-commit hooks for code formatting and licensing
Co-authored-by: Shangjie Chen <deanchen@google.com> PiperOrigin-RevId: 904636630
1 parent 71f8c5b commit d935df5

1 file changed

Lines changed: 32 additions & 15 deletions

File tree

.pre-commit-config.yaml

Lines changed: 32 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -13,22 +13,39 @@
1313
# limitations under the License.
1414

1515
repos:
16-
- repo: https://github.com/pre-commit/pre-commit-hooks
16+
- repo: https://github.com/pre-commit/pre-commit-hooks
1717
rev: v4.6.0
1818
hooks:
19-
- id: check-added-large-files
20-
- id: check-yaml
21-
- id: end-of-file-fixer
22-
- id: trailing-whitespace
23-
- repo: local
19+
- id: check-added-large-files
20+
- id: check-yaml
21+
- id: end-of-file-fixer
22+
- id: trailing-whitespace
23+
- repo: https://github.com/tox-dev/pyproject-fmt
24+
rev: v2.5.0
2425
hooks:
25-
- id: isort
26-
name: isort
27-
entry: isort
28-
language: system
29-
types: [python]
30-
- id: pyink
31-
name: pyink
32-
entry: pyink --config pyproject.toml
26+
- id: pyproject-fmt
27+
- repo: https://github.com/PyCQA/isort
28+
rev: 8.0.1
29+
hooks:
30+
- id: isort
31+
- repo: https://github.com/google/pyink
32+
rev: 25.12.0
33+
hooks:
34+
- id: pyink
35+
- repo: local
36+
hooks:
37+
- id: addlicense
38+
name: addlicense
39+
entry: >
40+
bash -c 'if command -v addlicense >/dev/null 2>&1;
41+
then addlicense -c "Google LLC" -l apache "$@";
42+
else echo "Warning: addlicense not installed, skipping"; fi' --
3343
language: system
34-
types: [python]
44+
files: \.(py|sh)$
45+
- repo: https://github.com/executablebooks/mdformat
46+
rev: 0.7.22
47+
hooks:
48+
- id: mdformat
49+
files: ^(README\.md|CONTRIBUTING\.md|contributing/.*\.md)$
50+
additional_dependencies:
51+
- mdformat-gfm

0 commit comments

Comments
 (0)