Skip to content

Commit

Permalink
Merge pull request #582 from lukpueh/add-precommit-config
Browse files Browse the repository at this point in the history
lint: add pre-commit config
  • Loading branch information
lukpueh authored May 24, 2023
2 parents d85e2f0 + 1863002 commit 135567f
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 5 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ env/*
tests/htmlcov/*
.DS_Store
.python-version
.pre-commit-config.yaml
25 changes: 25 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Automatically run checks over changed files prior to `git commit`.
# Required one-time setup:
#
# pip install pre-commit
# pre-commit install
#
# See https://pre-commit.com for details.
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
- id: trailing-whitespace
- id: end-of-file-fixer

- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
args: ["."]

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
args: ["."]
10 changes: 10 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,13 @@ include = [
"/CHANGELOG.md",
"/.coveragerc",
]

[tool.black]
line-length=80
extend-exclude="_vendor"

[tool.isort]
profile="black"
line_length=80
known_first_party = ["securesystemslib"]
extend_skip_glob=["*/_vendor/*"]
6 changes: 2 additions & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -72,10 +72,8 @@ deps =
-r{toxinidir}/requirements-pinned.txt
-r{toxinidir}/requirements-lint.txt
commands =
# TODO: Move configs to pyproject.toml
black --check --diff --line-length=80 --extend-exclude=_vendor .
isort --check --diff --line-length=80 --extend-skip-glob='*/_vendor/*' \
--profile=black --project=securesystemslib .
black --check --diff .
isort --check --diff .

pylint -j 0 --rcfile=pylintrc securesystemslib tests
bandit --recursive securesystemslib --exclude _vendor
Expand Down

0 comments on commit 135567f

Please sign in to comment.