Skip to content

Commit

Permalink
Chore: Use ruff to format the code base, black only for Jupyter NBs
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Jul 17, 2024
1 parent a6ecdd5 commit 7e9f136
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -340,17 +340,23 @@ docs-linkcheck = [
]

format = [
{ cmd = "black ." },
# Configure Ruff not to auto-fix (remove!):
# unused imports (F401), unused variables (F841), `print` statements (T201), and commented-out code (ERA001).
{ cmd = "ruff format" },
{ cmd = "ruff check --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001 ." },
# Format project metadata.
{ cmd = "pyproject-fmt --keep-full-version pyproject.toml" },

# Format code.
# Configure Ruff not to auto-fix a few items that are useful in workbench mode.
# e.g.: unused imports (F401), unused variables (F841), `print` statements (T201), commented-out code (ERA001)
{ cmd = "ruff format" },
{ cmd = "ruff check --fix --ignore=ERA --ignore=F401 --ignore=F841 --ignore=T20 --ignore=ERA001" },

# Format examples.
# Use `black` for the files in `examples/*`, because it knows how to treat Jupyter files well.
{ cmd = "black examples"},
]

lint = [
{ cmd = "ruff check ." },
{ cmd = "black --check ." },
{ cmd = "ruff format --check" },
{ cmd = "ruff check" },
{ cmd = "validate-pyproject pyproject.toml" },
{ cmd = "mypy" },
]
Expand Down

0 comments on commit 7e9f136

Please sign in to comment.