Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding pre commit #220

Merged
merged 10 commits into from
Feb 15, 2024
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# This is a list of commits that git blame should ignore
8 changes: 1 addition & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,10 @@ jobs:
TOXENV: docs
- python-version: "3.12"
env:
TOXENV: flake8
TOXENV: pre-commit
- python-version: "3.12"
env:
TOXENV: pylint
- python-version: "3.12"
env:
TOXENV: security
- python-version: "3.12"
env:
TOXENV: black
- python-version: "3.12"
env:
TOXENV: typing
Expand Down
18 changes: 18 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
repos:
- repo: https://github.com/PyCQA/bandit
rev: 1.7.7
hooks:
- id: bandit
args: [-r, -c, .bandit.yml]
- repo: https://github.com/PyCQA/flake8
rev: 7.0.0
hooks:
- id: flake8
- repo: https://github.com/psf/black.git
rev: 24.1.1
hooks:
- id: black
- repo: https://github.com/pycqa/isort
rev: 5.13.2
hooks:
- id: isort
emarondan marked this conversation as resolved.
Show resolved Hide resolved
27 changes: 6 additions & 21 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# and then run "tox" from this directory.

[tox]
envlist = py38, py39, py310, py311, py312, pypy3, docs, security, flake8, pylint, black, typing
envlist = py38, py39, py310, py311, py312, pypy3, docs, pylint, typing, pre-commit

[testenv]
deps =
emarondan marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -16,12 +16,6 @@ commands =
--cov=w3lib --cov-report=term --cov-report=xml \
{posargs:w3lib tests}

[testenv:security]
deps =
bandit
commands =
bandit -r -c .bandit.yml {posargs:w3lib}

[testenv:typing]
basepython = python3
deps =
Expand All @@ -31,29 +25,20 @@ deps =
commands =
mypy --strict {posargs: w3lib tests}

[testenv:flake8]
basepython = python3
deps =
flake8==6.1.0
commands =
flake8 \
{posargs:w3lib tests setup.py}

[testenv:pylint]
deps =
{[testenv]deps}
pylint==3.0.0
commands =
pylint conftest.py docs setup.py tests w3lib

[testenv:black]
deps =
black==22.6.0
commands =
black {posargs:--check conftest.py setup.py tests w3lib}

[testenv:docs]
changedir = docs
deps = -rdocs/requirements.txt
commands =
sphinx-build -W -b html . {envtmpdir}/html

[testenv:pre-commit]
deps = pre-commit
commands = pre-commit run --all-files --show-diff-on-failure
skip_install = true
Loading