Skip to content

Instantly share code, notes, and snippets.

@partrita
Last active March 21, 2024 05:56
Show Gist options
  • Select an option

  • Save partrita/62c250979f87b731e6efd9c6e7f171f6 to your computer and use it in GitHub Desktop.

Select an option

Save partrita/62c250979f87b731e6efd9c6e7f171f6 to your computer and use it in GitHub Desktop.
my `pyproject.toml` file for ruff linter.
# ref: https://beta.ruff.rs/docs/rules/
[tool.ruff]
# defaults to 88 like black
line-length = 100
# the python version to target, useful when considering code upgrades, defaults to "py310"
target-version = "py310"
# Linting file type
include = ["*.py", "*.ipynb"]
# Extend the `pyproject.toml` file in the parent directory.
#extend = "../pyproject.toml"
select = [
"E", # pycodestyle
"F", # pyflakes
"UP", # pyupgrade,
"I", # isort
# "B",
"C4",
# "N",
"W",
"UP",
]
ignore = [
"F403",
"F405",
"E501", # line length violations
"E402",
"W605", # Invalid escape sequence
"F811", # Redefinition of unused
"F821", # Undefined name
]
# Allow autofix for all enabled rules (when `--fix`) is provided.
fixable = ["A", "B", "C", "D", "E", "F", "I", "UP"]
unfixable = []
# Allow unused variables when underscore-prefixed.
dummy-variable-rgx = "^(_+|(_+[a-zA-Z0-9_]*[a-zA-Z0-9]+?))$"
[per-file-ignores]
# Ignore `E402` (import violations) in all `__init__.py` files, and in `path/to/file.py`.
"__init__.py" = ["E402"]
".pixi/*" = ["E"]
per-file-ignores = {}
[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment