Skip to content

Commit

Permalink
feat: Add ruff tool configuration to pyproject.toml
Browse files Browse the repository at this point in the history
This commit introduces a new feature to the codebase by adding the configuration for the ruff tool in the pyproject.toml file.
The configuration includes enabling pycodestyle and Pyflakes codes,
allowing fixes for all enabled rules,
excluding commonly ignored directories,
setting the line length to 88, allowing unused variables when underscore-prefixed,
and assuming Python 3.8.
It also sets the default complexity level to 10 for the mccabe tool under ruff.
  • Loading branch information
ericmjl committed Oct 8, 2023
1 parent 40a5f7e commit 7e9253f
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -45,3 +45,52 @@ markers = [
"documentation: tests for documentation",
"turtle: tests that take more than 5 seconds to execute",
]


[tool.ruff]
# Enable pycodestyle (`E`) and Pyflakes (`F`) codes by default.
select = ["E", "F", "I"]
ignore = []

# Allow fix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "G", "I", "N", "Q", "S", "T", "W", "ANN", "ARG", "BLE", "COM", "DJ", "DTZ", "EM", "ERA", "EXE", "FBT", "ICN", "INP", "ISC", "NPY", "PD", "PGH", "PIE", "PL", "PT", "PTH", "PYI", "RET", "RSE", "RUF", "SIM", "SLF", "TCH", "TID", "TRY", "UP", "YTT"]
unfixable = []

# Exclude a variety of commonly ignored directories.
exclude = [
".bzr",
".direnv",
".eggs",
".git",
".git-rewrite",
".hg",
".mypy_cache",
".nox",
".pants.d",
".pytype",
".ruff_cache",
".svn",
".tox",
".venv",
"__pypackages__",
"_build",
"buck-out",
"build",
"dist",
"node_modules",
"venv",
"nbconvert_config.py",
]

# Same as Black.
line-length = 88

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

# Assume Python 3.8
target-version = "py38"

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

0 comments on commit 7e9253f

Please sign in to comment.