Skip to content

Commit

Permalink
Use pre-commit in tox
Browse files Browse the repository at this point in the history
  • Loading branch information
jl-wynen committed Jan 18, 2023
1 parent b33e198 commit 4c3f1a0
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 79 deletions.
7 changes: 1 addition & 6 deletions requirements/static.in
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
bandit[toml]
black
flake8
flake8-bugbear
isort
nbstripout
pre-commit
85 changes: 19 additions & 66 deletions requirements/static.txt
Original file line number Diff line number Diff line change
@@ -1,71 +1,24 @@
# SHA1:2b8bc3420a7f9513cef3dbf7668fd600dac952b6
#
# This file is autogenerated by pip-compile-multi
# To update, run:
# This file is autogenerated by pip-compile with Python 3.10
# by the following command:
#
# pip-compile-multi
# pip-compile --resolver=backtracking requirements/static.in
#
attrs==22.2.0
# via
# flake8-bugbear
# jsonschema
bandit[toml]==1.7.4
cfgv==3.3.1
# via pre-commit
distlib==0.3.6
# via virtualenv
filelock==3.9.0
# via virtualenv
identify==2.5.13
# via pre-commit
nodeenv==1.7.0
# via pre-commit
platformdirs==2.6.0
# via virtualenv
pre-commit==2.21.0
# via -r requirements/static.in
black==22.12.0
# via -r requirements/static.in
click==8.1.3
# via black
fastjsonschema==2.16.2
# via nbformat
flake8==6.0.0
# via
# -r requirements/static.in
# flake8-bugbear
flake8-bugbear==22.12.6
# via -r requirements/static.in
gitdb==4.0.10
# via gitpython
gitpython==3.1.30
# via bandit
isort==5.11.4
# via -r requirements/static.in
jsonschema==4.17.3
# via nbformat
jupyter-core==5.1.3
# via nbformat
mccabe==0.7.0
# via flake8
mypy-extensions==0.4.3
# via black
nbformat==5.7.1
# via nbstripout
nbstripout==0.6.1
# via -r requirements/static.in
pathspec==0.10.3
# via black
pbr==5.11.0
# via stevedore
platformdirs==2.6.2
# via
# black
# jupyter-core
pycodestyle==2.10.0
# via flake8
pyflakes==3.0.1
# via flake8
pyrsistent==0.19.3
# via jsonschema
pyyaml==6.0
# via bandit
smmap==5.0.0
# via gitdb
stevedore==4.1.1
# via bandit
toml==0.10.2
# via bandit
tomli==2.0.1
# via black
traitlets==5.8.1
# via
# jupyter-core
# nbformat
# via pre-commit
virtualenv==20.17.1
# via pre-commit
12 changes: 5 additions & 7 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ commands = python -m sphinx -j2 -v -b html -d {toxworkdir}/docs_doctrees docs ht

[testenv:static]
description = Code formatting and static analysis
basepython = python3.8
skip_install = true
deps = -r requirements/static.txt
allowlist_externals = find
commands = black .
isort .
find docs -type f -regex '.*\.ipynb' -exec nbstripout --extra-keys 'metadata.language_info.version cell.metadata.jp-MarkdownHeadingCollapsed cell.metadata.pycharm' --drop-empty-cells \{\} +
flake8 .
bandit -c pyproject.toml -r src tools docs
allowlist_externals = sh
# The first run of pre-commit may reformat files. If this happens, it returns 1 but this
# should not fail the job. So just run again if it fails. A second failure means that
# either the different formatters can't agree on a format or that static analysis failed.
commands = sh -c 'pre-commit run -a || (echo "" && pre-commit run -a)'

0 comments on commit 4c3f1a0

Please sign in to comment.