diff --git a/ruff.toml b/ruff.toml new file mode 100644 index 0000000..add3883 --- /dev/null +++ b/ruff.toml @@ -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" diff --git a/scripts/lint b/scripts/lint index 19217c3..d19d6e7 100755 --- a/scripts/lint +++ b/scripts/lint @@ -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]" @@ -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 diff --git a/test_requirements.txt b/test_requirements.txt index 64be617..39f9986 100644 --- a/test_requirements.txt +++ b/test_requirements.txt @@ -1,11 +1,8 @@ # ####### test_requirements.txt ####### # -flake8 pytest pytest-cov pyfakefs -flake8 pyfakefs -black -autoflake +ruff