diff --git a/.gitignore b/.gitignore index 087afc91..974c41f6 100644 --- a/.gitignore +++ b/.gitignore @@ -15,4 +15,3 @@ env/* tests/htmlcov/* .DS_Store .python-version -.pre-commit-config.yaml diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml new file mode 100644 index 00000000..63a86a3f --- /dev/null +++ b/.pre-commit-config.yaml @@ -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: ["."] diff --git a/pyproject.toml b/pyproject.toml index 0ca6fc98..41d4c4ab 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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/*"] diff --git a/tox.ini b/tox.ini index 80bb870b..805aefbd 100644 --- a/tox.ini +++ b/tox.ini @@ -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