Skip to content

Commit

Permalink
Add ruff and remove other tools (#846)
Browse files Browse the repository at this point in the history
  • Loading branch information
michaelboulton committed Feb 15, 2023
1 parent 8b10944 commit 45f224a
Show file tree
Hide file tree
Showing 43 changed files with 269 additions and 543 deletions.
33 changes: 21 additions & 12 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,34 @@ on:
- feature-2.0

jobs:
simple-checks:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.8"

- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('pyproject.toml', 'requirements.in') }}
restore-keys: |
${{ runner.os }}-pip-
- uses: pre-commit/action@v3.0.0

test:
runs-on: ubuntu-latest
needs: simple-checks

strategy:
fail-fast: false
matrix:
include:
# 'Basic' tests and checks
- TOXENV: py3check
TOXCFG: tox.ini
- TOXENV: py3lint
TOXCFG: tox.ini
- TOXENV: py3mypy
TOXCFG: tox.ini
- TOXENV: py3
Expand Down Expand Up @@ -63,20 +79,13 @@ jobs:
restore-keys: |
${{ runner.os }}-pip-
- uses: actions/cache@v3
with:
path: ~/.cache/pre-commit
key: ${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
restore-keys: |
${{ runner.os }}-pre-commit-
- uses: jpribyl/action-docker-layer-caching@v0.1.1
continue-on-error: true

- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
python-version: "3.8"

- name: install deps
run: |
Expand Down
19 changes: 5 additions & 14 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
repos:
- repo: https://github.com/ambv/black
rev: 22.12.0
rev: 23.1.0
hooks:
- id: black
files: "(tavern|tests)"
- repo: https://github.com/PyCQA/flake8
rev: 6.0.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
rev: "v0.0.246"
hooks:
- id: flake8
additional_dependencies: ["flake8-pyproject"]
files: tavern/
exclude: tests/
- repo: https://github.com/pre-commit/mirrors-isort
rev: v5.10.1
hooks:
- id: isort
args:
- --settings-path=pyproject.toml
files: "(tavern|tests)"
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/mirrors-prettier
rev: v2.7.1
hooks:
Expand Down
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ Run every so often to update the pre-commit hooks
### Fixing Python formatting issue

black tavern/ tests/
isort --profile black tavern/ tests/
ruff --fix tavern/ tests/

## Creating a new release

Expand Down
39 changes: 3 additions & 36 deletions constraints.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,14 @@ allure-pytest==2.12.0
# via tavern (pyproject.toml)
allure-python-commons==2.12.0
# via allure-pytest
astroid==2.12.13
# via pylint
attrs==22.1.0
# via
# allure-python-commons
# jsonschema
# pytest
bcrypt==4.0.1
# via paramiko
black==22.12.0
black==23.1.0
# via tavern (pyproject.toml)
bleach==5.0.1
# via readme-renderer
Expand Down Expand Up @@ -52,9 +50,6 @@ cryptography==39.0.1
# via
# paramiko
# secretstorage
# tavern (pyproject.toml)
dill==0.3.6
# via pylint
distlib==0.3.6
# via virtualenv
distro==1.8.0
Expand Down Expand Up @@ -83,12 +78,6 @@ filelock==3.8.2
# via
# tox
# virtualenv
flake8==6.0.0
# via
# flake8-pyproject
# tavern (pyproject.toml)
flake8-pyproject==1.2.2
# via tavern (pyproject.toml)
flask==2.2.2
# via tavern (pyproject.toml)
flit==3.8.0
Expand All @@ -107,10 +96,6 @@ importlib-metadata==5.2.0
# twine
iniconfig==1.1.1
# via pytest
isort==5.11.3
# via
# pylint
# tavern (pyproject.toml)
itsdangerous==2.1.2
# via
# flask
Expand All @@ -131,16 +116,10 @@ jsonschema==3.2.0
# tavern (pyproject.toml)
keyring==23.13.1
# via twine
lazy-object-proxy==1.8.0
# via astroid
markupsafe==2.1.1
# via
# jinja2
# werkzeug
mccabe==0.7.0
# via
# flake8
# pylint
more-itertools==9.0.0
# via jaraco-classes
msgpack==1.0.4
Expand All @@ -156,6 +135,7 @@ nodeenv==1.7.0
# via pre-commit
packaging==22.0
# via
# black
# build
# docker
# pytest
Expand All @@ -177,7 +157,6 @@ pkginfo==1.9.2
platformdirs==2.6.0
# via
# black
# pylint
# virtualenv
pluggy==1.0.0
# via
Expand All @@ -190,12 +169,8 @@ py==1.11.0
# via
# tavern (pyproject.toml)
# tox
pycodestyle==2.10.0
# via flake8
pycparser==2.21
# via cffi
pyflakes==3.0.1
# via flake8
pygments==2.13.0
# via
# readme-renderer
Expand All @@ -205,8 +180,6 @@ pyjwt==2.6.0
# via tavern (pyproject.toml)
pykwalify==1.8.0
# via tavern (pyproject.toml)
pylint==2.15.9
# via tavern (pyproject.toml)
pynacl==1.5.0
# via paramiko
pyrsistent==0.19.2
Expand Down Expand Up @@ -254,7 +227,7 @@ ruamel-yaml==0.17.21
# via pykwalify
ruamel-yaml-clib==0.2.7
# via ruamel-yaml
ruff==0.0.187
ruff==0.0.246
# via tavern (pyproject.toml)
secretstorage==3.3.3
# via keyring
Expand All @@ -280,16 +253,12 @@ tomli==2.0.1
# black
# build
# coverage
# flake8-pyproject
# mypy
# pep517
# pylint
# pytest
# tox
tomli-w==1.0.0
# via flit
tomlkit==0.11.6
# via pylint
tox==3.28.0
# via
# tavern (pyproject.toml)
Expand Down Expand Up @@ -323,8 +292,6 @@ wheel==0.38.4
# via
# pip-tools
# tavern (pyproject.toml)
wrapt==1.14.1
# via astroid
zipp==3.11.0
# via importlib-metadata

Expand Down
52 changes: 17 additions & 35 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,12 @@ Source = "https://github.com/taverntesting/tavern"
dev = [
"Faker",
"allure-pytest",
"black",
"black==23.1.0",
"bump2version",
"Flake8-pyproject",
"colorlog",
"docker-compose",
"flake8",
"flask",
"fluent-logger",
"isort",
"itsdangerous",
"mypy",
"mypy-extensions",
Expand All @@ -75,9 +72,8 @@ dev = [
"pip-tools",
"pre-commit",
"pygments",
"pylint",
"pytest-cov",
"ruff",
"ruff>=0.0.246",
"pytest-xdist",
"py",
"tox>=3,<4",
Expand Down Expand Up @@ -127,19 +123,6 @@ tavern = [
".tox/py39-mqtt/lib/python3.9/site-packages/tavern",
]

[tool.isort]
multi_line_output = 3
include_trailing_comma = true
indent = 4
atomic = true
combine_star = true
use_parentheses = true
line_length = 88
skip_glob = ["docs/**", "example/**"]
known_tavern = "tavern"
sections = ["FUTURE", "STDLIB", "THIRDPARTY", "FIRSTPARTY", "TAVERN", "LOCALFOLDER"]
force_sort_within_sections = true

[tool.pytest.ini_options]
testpaths = ["tavern", "tests/unit"]
addopts = [
Expand All @@ -156,24 +139,23 @@ norecursedirs = [
"example",
]

[tool.pylint.MASTER]
disable = "missing-docstring,fixme,invalid-name,line-too-long,too-few-public-methods,no-else-return,too-many-branches,locally-disabled,useless-object-inheritance,no-else-raise,abstract-method,import-outside-toplevel,cyclic-import,consider-using-f-string,useless-option-value"
ignore = "tests"

[tool.pylint.REPORTS]
reports = false

[tool.pylint.SIMILARITIES]
min-similarity-lines = 6
ignore-imports = true
[tool.ruff]
ignore = [
"E501", # line length
"RUF005", # union types only valid from 3.10+
"B905", # zip(..., strict=True) only valid from 3.10+
"PLR0912", "PLR0915", "PLR0911", "PLR0913", # too many branches/variables/return values - sometimes this is just unavoidable
"PLR2004", # 'magic numbers'
]
select = ["E", "F", "B", "W", "I", "S", "C4", "ICN", "T20", "PLE", "RUF", "SIM105", "PL"]
# Look at: UP
target-version = "py38"

[tool.pylint.TYPECHECK]
ignored-classes = "RememberComposer"
[tool.ruff.per-file-ignores]
"tests/*" = ["S"]

[tool.flake8]
ignore = ["E501", "W503", "C901", "W504"]
exclude = [".git", "__pycache__", "docs/source/conf.py", "build", "dist"]
max-complexity = 10
[tool.ruff.isort]
known-first-party = ["tavern"]

[tool.tbump.version]
current = "2.0.3"
Expand Down

0 comments on commit 45f224a

Please sign in to comment.