Skip to content

Commit

Permalink
Start enforcing ruff rules
Browse files Browse the repository at this point in the history
Replace flake8 with ruff.
  • Loading branch information
DimitriPapadopoulos committed Jan 29, 2025
1 parent f74d13c commit 75a979c
Show file tree
Hide file tree
Showing 4 changed files with 44 additions and 3 deletions.
15 changes: 15 additions & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
name: Lint
on:
pull_request:
branches:
- '*'
permissions:
contents: read
jobs:
ruff:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: astral-sh/ruff-action@v3
- name: Lint with Ruff
run: ruff check --output-format=github
2 changes: 0 additions & 2 deletions pyedflib/__init__.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
# flake8: noqa

# Copyright (c) 2019 - 2020 Simon Kern
# Copyright (c) 2015 - 2020 Holger Nahrstaedt
# Copyright (c) 2016-2017 The pyedflib Developers
Expand Down
28 changes: 28 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,31 @@ requires = [
"cython"
]
build-backend = "setuptools.build_meta"

[tool.ruff]
target-version = "py38"

[tool.ruff.lint]
extend-select = [
"UP", # pyupgrade
"C4", # flake8-comprehensions
"ISC", # flake8-implicit-str-concat
"PIE", # flake8-pie
"FLY", # flynt
"PERF", # Perflint
"RUF", # Ruff-specific rules
]
ignore = [
"F841", # Local variable is assigned to but never used
"UP031", # Use format specifiers instead of percent format
"UP032", # Use f-string instead of `format` call
"ISC002", # Implicitly concatenated string literals over multiple lines
"PERF203", # `try`-`except` within a loop incurs performance overhead
"RUF003",
"RUF005", # Consider iterable unpacking instead of concatenation
"RUF012", # Mutable class attributes should be annotated with `typing.ClassVar`
"RUF100", # Unused `noqa` directive
]

[tool.ruff.lint.extend-per-file-ignores]
"**/__init__.py" = ["F401", "F403"]
2 changes: 1 addition & 1 deletion requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
pip
setuptools
wheel
flake8
nose
coverage
cython
numpy
pytest
ruff
dateparser
tqdm

0 comments on commit 75a979c

Please sign in to comment.