Skip to content

Commit

Permalink
Add configs to run ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
User committed Jul 1, 2023
1 parent 3a75a7f commit cfe2e2a
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ SHELL := /bin/bash
FILES_CHECK_MYPY = grab tests
FILES_CHECK_ALL = $(FILES_CHECK_MYPY)

bootstrap: venv deps dirs
init: venv deps dirs

venv:
virtualenv -p python3 .env
Expand Down Expand Up @@ -42,7 +42,10 @@ pylint:
pylint -j0 $(FILES_CHECK_ALL)

flake8:
flake8 -j auto --max-cognitive-complexity=17 $(FILES_CHECK_ALL)
flake8 -j auto --isolated --select CCR --max-cognitive-complexity=17 $(FILES_CHECK_ALL)

ruff:
ruff $(FILES_CHECK_ALL)

eradicate:
tox -e eradicate -- flake8 -j auto --eradicate-whitelist-extend="License:" $(FILES_CHECK_ALL)
Expand Down
38 changes: 38 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -108,3 +108,41 @@ load-plugins=[
[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = "--tb=short"

[tool.ruff]
select = ["ALL"]
ignore = [
"A003", # Class attribute `type` is shadowing a python builtin
"ANN101", # Missing type annotation for `self` in method
"ANN401", # Dynamically typed expressions (typing.Any) are disallowed
"BLE001", # Do not catch blind exception: `Exception`
"COM812", # Trailing comma missing
"D100", # Missing docstring in public module
"D101", # Missing docstring in public class
"D102", # Missing docstring in public method1
"D103", # Missing docstring in public function
"D104", # Missing docstring in public package
"D105", # Missing docstring in magic method,
"D107", # Missing docstring in `__init__`
"D203", # 1 blank line required before class docstring
"D213", # Multi-line docstring summary should start at the second line
"EM101", # Check for raw usage of a string literal in Exception raising
"EM102", # Check for raw usage of an f-string literal in Exception raising
"EM103", # Check for raw usage of .format on a string literal in Exception raising
"F401", # Imported but unused
"FBT", # Boolean arg/value in function definition
"PTH", # A plugin finding use of functions that can be replaced by pathlib module
"S101", # Use of `assert` detected
"T201", # print found
"T203", # pprint found
"TCH", # Move import into a type-checking block
"TRY003", # Avoid specifying long messages outside the exception class
"UP032", # Use f-string instead of format call
"ERA001", # Found commented-out code
"RUF001", # String contains ambiguous unicode character
"ANN102", # Missing type annotation for `cls` in classmethod
# TODO: remove following rules
"PT009", # Use a regular `assert` instead of unittest-style `assertEqual`
]
target-version = "py38"
extend-exclude = ["var"]
1 change: 1 addition & 0 deletions requirements_dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ pytest
pytest-xdist
build
twine
ruff

coverage
coveralls
Expand Down

0 comments on commit cfe2e2a

Please sign in to comment.