Skip to content

Commit

Permalink
Match linting to the same as chandra_limits
Browse files Browse the repository at this point in the history
  • Loading branch information
jzuhone committed Oct 18, 2023
1 parent 834a6b4 commit 95b7940
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 72 deletions.
23 changes: 0 additions & 23 deletions .github/workflows/flake8.yml

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Check black formatting
name: Check Python formatting using Black and Ruff

on: [push]

Expand All @@ -8,3 +8,4 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: psf/black@stable
- uses: chartboost/ruff-action@v1
17 changes: 11 additions & 6 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,17 @@
ci:
autoupdate_schedule: monthly


repos:
- repo: https://github.com/psf/black
rev: 23.3.0
rev: 23.7.0
hooks:
- id: black
language_version: python3.11
language_version: python3.10

- repo: https://github.com/pycqa/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.282
hooks:
- id: isort
name: isort (python)
- id: ruff
args: ["--fix", "--format=github"]
language_version: python3.10
150 changes: 108 additions & 42 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,53 +17,119 @@ exclude = '''
)/
'''

[tool.isort]
profile = "black"

[tool.ruff]
line-length = 88
select = ["ALL"]
target-version = "py310"
# fix = true
select = [
# isort
"I",
# pyflakes
"F",
# pycodestyle
"E", "W",
# flake8-2020
"YTT",
# flake8-bugbear
"B",
# flake8-quotes
"Q",
# flake8-debugger
"T10",
# flake8-gettext
"INT",
# pylint
"PLC", "PLE", "PLR", "PLW",
# misc lints
"PIE",
# flake8-pyi
"PYI",
# tidy imports
"TID",
# implicit string concatenation
"ISC",
# type-checking imports
"TCH",
# comprehensions
"C4",
# pygrep-hooks
"PGH"
]

ignore = [
"ANN",
"S101",
"D1",
"D400",
"D401",
"D404",
"D415",
"D203",
"SIM105",
"SIM108",
"PTH123",
"DTZ",
"D212",
"EM",
"ERA001",
"C",
"B905",
"BLE001",
"T",
"RET",
"D205",
"N802",
"N803",
"N806",
"S324",
"FBT002",
"FBT003",
"ARG002",
"B904",
"PLR2004",
"PLR0915",
"ICN001",
"TRY003",
"PLR0912",
"PLR0913",
"TRY200",
# space before : (needed for how black formats slicing)
# "E203", # not yet implemented
# module level import not at top of file
"E402",
# do not assign a lambda expression, use a def
"E731",
# line break before binary operator
# "W503", # not yet implemented
# line break after binary operator
# "W504", # not yet implemented
# controversial
"B006",
# controversial?: Loop control variable not used within loop body
# "B007",
# controversial
"B008",
# setattr is used to side-step mypy
"B009",
# getattr is used to side-step mypy
"B010",
# tests use assert False
"B011",
# tests use comparisons but not their returned value
"B015",
# false positives
"B019",
# Loop control variable overrides iterable it iterates
"B020",
# Function definition does not bind loop variable
"B023",
# Functions defined inside a loop must not use variables redefined in the loop
# "B301", # not yet implemented
# Only works with python >=3.10
"B905",
# Too many arguments to function call
"PLR0913",
# Too many returns
"PLR0911",
# Too many branches
"PLR0912",
# Too many statements
"PLR0915",
# Redefined loop name
"PLW2901",
# Global statements are discouraged
"PLW0603",
# Docstrings should not be included in stubs
"PYI021",
# No builtin `eval()` allowed
"PGH001",
# compare-to-empty-string
"PLC1901",
# Use typing_extensions.TypeAlias for type aliases
# "PYI026", # not yet implemented
# Use "collections.abc.*" instead of "typing.*" (PEP 585 syntax)
# "PYI027", # not yet implemented
# while int | float can be shortened to float, the former is more explicit
# "PYI041", # not yet implemented
# Additional checks that don't pass yet
# Useless statement
"B018",
# Within an except clause, raise exceptions with ...
"B904",
# Magic number
"PLR2004",
# Consider `elif` instead of `else` then `if` to remove indentation level
"PLR5501",
]
extend-exclude = [
"doc",

exclude = [
"docs",
]


[tool.ruff.per-file-ignores]
"__init__.py" = ["E402", "F401", "F403"]

0 comments on commit 95b7940

Please sign in to comment.