Skip to content

Commit

Permalink
use ruff format
Browse files Browse the repository at this point in the history
  • Loading branch information
zacharyburnett committed Nov 13, 2023
1 parent 8ae0025 commit c43a40d
Show file tree
Hide file tree
Showing 2 changed files with 102 additions and 4 deletions.
38 changes: 38 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.5.0
hooks:
- id: check-added-large-files
- id: check-ast
- id: check-case-conflict
- id: check-yaml
args: ["--unsafe"]
- id: check-toml
- id: check-merge-conflict
- id: check-symlinks
- id: debug-statements
- id: detect-private-key
- id: end-of-file-fixer
- id: trailing-whitespace

- repo: https://github.com/pre-commit/pygrep-hooks
rev: v1.10.0
hooks:
- id: rst-directive-colons
- id: rst-inline-touching-normal
- id: text-unicode-replacement-char

- repo: https://github.com/codespell-project/codespell
rev: v2.2.5
hooks:
- id: codespell
args: ["--write-changes"]
additional_dependencies:
- tomli

- repo: https://github.com/astral-sh/ruff-pre-commit
rev: "v0.1.5"
hooks:
- id: ruff
args: ["--fix", "--show-fixes"]
- id: ruff-format
68 changes: 64 additions & 4 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -56,18 +56,78 @@ build-backend = "setuptools.build_meta"
[tool.setuptools_scm]

[tool.ruff]
line-length = 127
extend-select = [
'F', # Pyflakes (part of default flake8)
'W', 'E', # pycodestyle (part of default flake8)
'I', # isort (import sorting)
# 'N', # pep8-naming
'D', # pydocstyle (docstring style guide)
'UP', # pyupgrade (upgrade code to modern python)
'YTT', # flake8-2020 (system version info)
'ANN', # flake8-annotations (best practices for type annotations)
'S', # flake8-bandit (security checks)
'BLE', # flake8-blind-except (prevent blind except statements)
'B', # flake8-bugbear (prevent common gotcha bugs)
'A', # flake8-builtins (prevent shadowing of builtins)
'C4', # flake8-comprehensions (best practices for comprehensions)
'T10', # flake8-debugger (prevent debugger statements in code)
'EM', # flake8-errormessages (best practices for error messages)
'FA', # flake8-future-annotations (correct usage future annotations)
'ISC', # flake8-implicit-str-concat (prevent implicit string concat)
'ICN', # flake8-import-conventions (enforce import conventions)
'G', # flake8-logging-format (best practices for logging)
'INP', # flake8-no-pep420 (prevent use of PEP420, i.e. implicit name spaces)
'PIE', # flake8-pie (misc suggested improvement linting)
# 'T20', # flake8-print (prevent print statements in code)
'PT', # flake8-pytest-style (best practices for pytest)
'Q', # flake8-quotes (best practices for quotes)
'RSE', # flake8-raise (best practices for raising exceptions)
'RET', # flake8-return (best practices for return statements)
'SLF', # flake8-self (prevent private member access)
'SLOT', # flake8-slots (require __slots__ for immutable classes)
'SIM', # flake8-simplify (suggest simplifications to code where possible)
'TID', # flake8-tidy-imports (prevent banned api and best import practices)
'TCH', # flake8-type-checking (move type checking imports into type checking blocks)
'INT', # flake8-gettext (when to use printf style strings)
# 'ARG', # flake8-unused-arguments (prevent unused arguments)
'PTH', # flake8-use-pathlib (prefer pathlib over os.path)
# 'ERA', # eradicate (remove commented out code)
'PGH', # pygrep (simple grep checks)
'PL', # pylint (general linting, flake8 alternative)
'TRY', # tryceratops (linting for try/except blocks)
'FLY', # flynt (f-string conversion where possible)
'NPY', # NumPy-specific checks (recommendations from NumPy)
'PERF', # Perflint (performance linting)
'LOG',
'RUF', # ruff specific checks
]
ignore = [
'ISC001', # interferes with formatter
'PLR0912', # Too many branches
'PLR0913', # Too many arguments
'PLR0915', # Too many statements
'PLR2004', # Magic value used in comparison

# Pydocstyle (to fix over time
'D100', # Undocumented public module
'D101', # Undocumented public class
'D102', # Undocumented public method
'D103', # Undocumented public function
'D104', # Undocumented public package
'D205', # 1 blank line required between summary line and description
'D401', # First line of docstring should be in imperative mood
'D404', # First word of docstring should not be This
]
extend-exclude = [
"build",
"docs",
"dist",
".eggs",
".tox",
"venv",
"tests/data",
]
extend-ignore = [
"E722",
]
line-length = 127

[tool.coverage.run]
branch = true
Expand Down

0 comments on commit c43a40d

Please sign in to comment.