Skip to content

Commit

Permalink
change linter to ruff (#56)
Browse files Browse the repository at this point in the history
* change linter to ruff

* add ruff package

* fix ruff params

* add ruff.toml
  • Loading branch information
andreas-stuerz authored Apr 24, 2024
1 parent 00679d5 commit f795b37
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 7 deletions.
62 changes: 62 additions & 0 deletions ruff.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".ipynb_checkpoints",
".mypy_cache",
".nox",
".pants.d",
".pyenv",
".pytest_cache",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
".vscode",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"site-packages",
"venv",
"output",
]

# Same as Black.
line-length = 127
indent-width = 4

# Assume Python 3.8
target-version = "py38"

[lint]
# Enable Pyflakes (`F`) and a subset of the pycodestyle (`E`) codes by default.
select = ["E4", "E7", "E9", "F"]
ignore = ["E203"]

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["ALL"]
unfixable = []

# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"

[format]
# Like Black, use double quotes for strings.
quote-style = "double"

# Like Black, indent with spaces, rather than tabs.
indent-style = "space"

# Like Black, respect magic trailing commas.
skip-magic-trailing-comma = false

# Like Black, automatically detect the appropriate line ending.
line-ending = "auto"
5 changes: 2 additions & 3 deletions scripts/lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ while getopts "fh" arg; do
# shellcheck disable=SC2220
case $arg in
f)
black --extend-exclude './venv,./output,./build' --line-length=127 .
autoflake --exclude './venv,./output,./build' --in-place --remove-unused-variables --verbose -r .
ruff check --fix --statistics
;;
h)
echo "Usage: $0 [-f] [-h]"
Expand All @@ -15,4 +14,4 @@ while getopts "fh" arg; do
esac
done

flake8 --extend-exclude './venv,./output, ./build' --show-source --statistics --max-complexity=10 --extend-ignore=E203 --max-line-length=127
ruff check --output-format=full
5 changes: 1 addition & 4 deletions test_requirements.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
#
####### test_requirements.txt #######
#
flake8
pytest
pytest-cov
pyfakefs
flake8
pyfakefs
black
autoflake
ruff

0 comments on commit f795b37

Please sign in to comment.