Skip to content

Commit

Permalink
Replace flake8 with ruff in pre-commit
Browse files Browse the repository at this point in the history
  • Loading branch information
mraspaud committed Oct 4, 2023
1 parent 95eb01a commit 6e87d19
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 7 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ jobs:
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 flake8-docstrings flake8-debugger flake8-bugbear pytest
pip install ruff pytest
- name: Install Satpy
run: |
pip install -e .
- name: Run linting
run: |
flake8 satpy/
ruff satpy/
test:
runs-on: ${{ matrix.os }}
Expand Down
10 changes: 5 additions & 5 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
exclude: '^$'
fail_fast: false
repos:
- repo: https://github.com/PyCQA/flake8
rev: 6.1.0
- repo: https://github.com/charliermarsh/ruff-pre-commit
# Ruff version.
rev: 'v0.0.247'
hooks:
- id: flake8
additional_dependencies: [flake8-docstrings, flake8-debugger, flake8-bugbear, mccabe]
args: [--max-complexity, "10"]
- id: ruff
args: [--fix, --exit-non-zero-on-fix]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.4.0
hooks:
Expand Down
15 changes: 15 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,18 @@ skip_gitignore = true
default_section = "THIRDPARTY"
known_first_party = "satpy"
line_length = 120

[tool.ruff]
select = ["E", "W", "F", "I", "D", "S", "B", "A", "PT", "Q", "TID", "C90", "T10"]
ignore = ["B905"] # only available from python 3.10
line-length = 120

[tool.ruff.per-file-ignores]
"satpy/tests/*" = ["S101"] # assert allowed in tests

[tool.ruff.pydocstyle]
convention = "google"

[tool.ruff.mccabe]
# Unlike Flake8, default to a complexity level of 10.
max-complexity = 10

0 comments on commit 6e87d19

Please sign in to comment.