Skip to content

Commit

Permalink
Update linters: remove flake8, add ruff, update cython-lint (#1302)
Browse files Browse the repository at this point in the history
The cython-lint change is necessary to unblock runs after the Cython 3.0 update, but it is also a QOL improvement that allows us to remove flake8 usage in Cython files since cython-lint now covers a superset of what flake8 could do for Cython. ruff is (nearly) a superset of flake8 for pure Python and has a wide range of advantages, so this switch is beneficial as well. 

cf. rapidsai/cudf#13699

Authors:
  - Vyas Ramasubramani (https://github.com/vyasr)

Approvers:
  - Ashwin Srinath (https://github.com/shwina)
  - Mark Harris (https://github.com/harrism)

URL: #1302
  • Loading branch information
vyasr authored Jul 18, 2023
1 parent 5502767 commit cfbc678
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 34 deletions.
16 changes: 6 additions & 10 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,8 @@ repos:
hooks:
- id: black
args: ["--config=python/pyproject.toml"]
- repo: https://github.com/PyCQA/flake8
rev: 5.0.4
hooks:
- id: flake8
args: ["--config=python/.flake8"]
files: python/.*$
types: [file]
types_or: [python, cython]
additional_dependencies: ["flake8-force"]
- repo: https://github.com/MarcoGorelli/cython-lint
rev: v0.1.10
rev: v0.15.0
hooks:
- id: cython-lint
- repo: https://github.com/pre-commit/mirrors-clang-format
Expand Down Expand Up @@ -78,6 +69,11 @@ repos:
# of dependencies, so we'll have to update this manually.
additional_dependencies:
- cmakelang==0.6.13
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.0.278
hooks:
- id: ruff
files: python/.*$

default_language_version:
python: python3
13 changes: 13 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,16 @@ ignore-regex = "\\b(.{1,4}|[A-Z]\\w*T)\\b"
ignore-words-list = "inout"
builtin = "clear"
quiet-level = 3

[tool.ruff]
select = ["E", "F", "W"]
ignore = [
# whitespace before :
"E203",
]
fixable = ["ALL"]
exclude = [
# TODO: Remove this in a follow-up where we fix __all__.
"__init__.py",
]
line-length = 79
24 changes: 0 additions & 24 deletions python/.flake8

This file was deleted.

0 comments on commit cfbc678

Please sign in to comment.