Skip to content

Commit 135567f

Browse files
authored
Merge pull request #582 from lukpueh/add-precommit-config
lint: add pre-commit config
2 parents d85e2f0 + 1863002 commit 135567f

File tree

4 files changed

+37
-5
lines changed

4 files changed

+37
-5
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,3 @@ env/*
1515
tests/htmlcov/*
1616
.DS_Store
1717
.python-version
18-
.pre-commit-config.yaml

.pre-commit-config.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Automatically run checks over changed files prior to `git commit`.
2+
# Required one-time setup:
3+
#
4+
# pip install pre-commit
5+
# pre-commit install
6+
#
7+
# See https://pre-commit.com for details.
8+
repos:
9+
- repo: https://github.com/pre-commit/pre-commit-hooks
10+
rev: v4.4.0
11+
hooks:
12+
- id: trailing-whitespace
13+
- id: end-of-file-fixer
14+
15+
- repo: https://github.com/psf/black
16+
rev: 23.3.0
17+
hooks:
18+
- id: black
19+
args: ["."]
20+
21+
- repo: https://github.com/pycqa/isort
22+
rev: 5.12.0
23+
hooks:
24+
- id: isort
25+
args: ["."]

pyproject.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,13 @@ include = [
6464
"/CHANGELOG.md",
6565
"/.coveragerc",
6666
]
67+
68+
[tool.black]
69+
line-length=80
70+
extend-exclude="_vendor"
71+
72+
[tool.isort]
73+
profile="black"
74+
line_length=80
75+
known_first_party = ["securesystemslib"]
76+
extend_skip_glob=["*/_vendor/*"]

tox.ini

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,8 @@ deps =
7272
-r{toxinidir}/requirements-pinned.txt
7373
-r{toxinidir}/requirements-lint.txt
7474
commands =
75-
# TODO: Move configs to pyproject.toml
76-
black --check --diff --line-length=80 --extend-exclude=_vendor .
77-
isort --check --diff --line-length=80 --extend-skip-glob='*/_vendor/*' \
78-
--profile=black --project=securesystemslib .
75+
black --check --diff .
76+
isort --check --diff .
7977

8078
pylint -j 0 --rcfile=pylintrc securesystemslib tests
8179
bandit --recursive securesystemslib --exclude _vendor

0 commit comments

Comments
 (0)