Skip to content

Commit

Permalink
update lint rules, use ruff instead of isort
Browse files Browse the repository at this point in the history
  • Loading branch information
aaronsteers committed Dec 18, 2024
1 parent dc3928d commit be983e5
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 67 deletions.
16 changes: 6 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,19 +25,15 @@ repos:
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.8.3
hooks:
# Run the linter. (Temporarily disabled.)
# - id: ruff
# args: [ --fix ]
# Run the linter.
- id: ruff
args:
- --fix
- --select=I

# Run the formatter.
- id: ruff-format

- repo: https://github.com/pycqa/isort
rev: 5.12.0
hooks:
- id: isort
files: \.py$
require_serial: true

- repo: https://github.com/pre-commit/mirrors-prettier
rev: v3.0.3
hooks:
Expand Down
3 changes: 3 additions & 0 deletions airbyte-ci/connectors/auto_merge/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ ruff = "^0.4.3"
pytest = "^8.2.0"
pyinstrument = "^4.6.2"

[tool.ruff]
line-length = 140

[tool.ruff.lint]
select = [
"I" # isort
Expand Down
118 changes: 61 additions & 57 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -85,64 +85,69 @@ extend-exclude = ["docs", "test", "tests"]
[tool.ruff.lint]

select = [
# For rules reference, see https://docs.astral.sh/ruff/rules/
"A", # flake8-builtins
"ANN", # flake8-annotations
"ARG", # flake8-unused-arguments
"ASYNC", # flake8-async
"B", # flake8-bugbear
"FBT", # flake8-boolean-trap
"BLE", # Blind except
"C4", # flake8-comprehensions
"C90", # mccabe (complexity)
"COM", # flake8-commas
# "CPY", # missing copyright notice # Requires 'preview=true'
# "D", # pydocstyle # TODO: Re-enable when adding docstrings
"DTZ", # flake8-datetimez
"E", # pycodestyle (errors)
"ERA", # flake8-eradicate (commented out code)
"EXE", # flake8-executable
"F", # Pyflakes
"FA", # flake8-future-annotations
"FIX", # flake8-fixme
"FLY", # flynt
"FURB", # Refurb
"I", # isort
"ICN", # flake8-import-conventions
"INP", # flake8-no-pep420
"INT", # flake8-gettext
"ISC", # flake8-implicit-str-concat
"ICN", # flake8-import-conventions
"LOG", # flake8-logging
"N", # pep8-naming
"PD", # pandas-vet
"PERF", # Perflint
"PIE", # flake8-pie
"PGH", # pygrep-hooks
"PL", # Pylint
"PT", # flake8-pytest-style
"PTH", # flake8-use-pathlib
"PYI", # flake8-pyi
"Q", # flake8-quotes
"RET", # flake8-return
"RSE", # flake8-raise
"RUF", # Ruff-specific rules
"SIM", # flake8-simplify
"SLF", # flake8-self
"SLOT", # flake8-slots
"T10", # debugger calls
# "T20", # flake8-print # TODO: Re-enable once we have logging
"TCH", # flake8-type-checking
"TD", # flake8-todos
"TID", # flake8-tidy-imports
"TRY", # tryceratops
"TRY002", # Disallow raising vanilla Exception. Create or use a custom exception instead.
"TRY003", # Disallow vanilla string passing. Prefer kwargs to the exception constructur.
"UP", # pyupgrade
"W", # pycodestyle (warnings)
"YTT", # flake8-2020
"I", # isort replacement
]

# TODO: Re-enable these once we have time to address them
# select = [
# # For rules reference, see https://docs.astral.sh/ruff/rules/
# "A", # flake8-builtins
# "ANN", # flake8-annotations
# "ARG", # flake8-unused-arguments
# "ASYNC", # flake8-async
# "B", # flake8-bugbear
# "FBT", # flake8-boolean-trap
# "BLE", # Blind except
# "C4", # flake8-comprehensions
# "C90", # mccabe (complexity)
# "COM", # flake8-commas
# # "CPY", # missing copyright notice # Requires 'preview=true'
# # "D", # pydocstyle # TODO: Re-enable when adding docstrings
# "DTZ", # flake8-datetimez
# "E", # pycodestyle (errors)
# "ERA", # flake8-eradicate (commented out code)
# "EXE", # flake8-executable
# "F", # Pyflakes
# "FA", # flake8-future-annotations
# "FIX", # flake8-fixme
# "FLY", # flynt
# "FURB", # Refurb
# "I", # isort
# "ICN", # flake8-import-conventions
# "INP", # flake8-no-pep420
# "INT", # flake8-gettext
# "ISC", # flake8-implicit-str-concat
# "ICN", # flake8-import-conventions
# "LOG", # flake8-logging
# "N", # pep8-naming
# "PD", # pandas-vet
# "PERF", # Perflint
# "PIE", # flake8-pie
# "PGH", # pygrep-hooks
# "PL", # Pylint
# "PT", # flake8-pytest-style
# "PTH", # flake8-use-pathlib
# "PYI", # flake8-pyi
# "Q", # flake8-quotes
# "RET", # flake8-return
# "RSE", # flake8-raise
# "RUF", # Ruff-specific rules
# "SIM", # flake8-simplify
# "SLF", # flake8-self
# "SLOT", # flake8-slots
# "T10", # debugger calls
# # "T20", # flake8-print # TODO: Re-enable once we have logging
# "TCH", # flake8-type-checking
# "TD", # flake8-todos
# "TID", # flake8-tidy-imports
# "TRY", # tryceratops
# "TRY002", # Disallow raising vanilla Exception. Create or use a custom exception instead.
# "TRY003", # Disallow vanilla string passing. Prefer kwargs to the exception constructur.
# "UP", # pyupgrade
# "W", # pycodestyle (warnings)
# "YTT", # flake8-2020
# ]

ignore = [
# For rules reference, see https://docs.astral.sh/ruff/rules/

Expand Down Expand Up @@ -191,7 +196,6 @@ known-first-party = [
"connector_ops",
"pipelines",
]
required-imports = ["from __future__ import annotations"]
known-third-party = []
section-order = [
"future",
Expand Down

0 comments on commit be983e5

Please sign in to comment.