Skip to content

Commit

Permalink
Use ruff instead of other linting tools and formatters
Browse files Browse the repository at this point in the history
  • Loading branch information
derneuere committed Feb 4, 2025
1 parent 470ec7f commit 0299d7d
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 32 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- uses: actions/checkout@v4
- name: Install dependencies
run: pip install ruff
- name: Run pre-commit check
uses: pre-commit/[email protected]
21 changes: 6 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,10 @@ default_language_version:
python: python3

repos:
- repo: https://github.com/PyCQA/isort
rev: 5.12.0
- repo: https://github.com/astral-sh/ruff-pre-commit
rev: v0.9.4 # Check latest version
hooks:
- id: isort
- repo: https://github.com/psf/black
rev: 23.3.0
hooks:
- id: black
- repo: https://github.com/pycqa/flake8
rev: 6.0.0
hooks:
- id: flake8
args:
- --exclude=.+/migrations/
- --max-line-length=88
- --ignore=E501,W503,E203,E231
- id: ruff
args: ["--fix"] # Fix lint & format

- id: ruff-format # Format code
30 changes: 19 additions & 11 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,23 @@
[tool.black]
[tool.ruff]
line-length = 88
target-version = ['py311']
include = '\.pyi?$' # all files that end with .py or .pyi
target-version = "py311"
extend-exclude = ["migrations"] # Match flake8 exclude

[tool.pylint.master]
load-plugins = 'pylint_django'
django-settings-module = 'ownphotos.settings'
disable = 'E029,C0111,C0301'
select = [
"E", # Pyflakes (errors)
"F", # Pyflakes
"W", # pycodestyle warnings
"I", # isort (import sorting)
"N", # PEP8 naming
"UP", # Pyupgrade (modern syntax)
"D", # pydocstyle (docstrings)
"DJ", # pylint-django equivalent
"PL", # pylint rules
]

[tool.pylint.format]
max-line-length = 88
ignore = ["E501", "W503", "E203", "E231"]

[tool.isort]
profile = "black"
[tool.ruff.format]
quote-style = "double"
indent-style = "space"
line-ending = "lf"
6 changes: 1 addition & 5 deletions requirements.dev.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ ipython-genutils==0.2.0
Pygments==2.18.0
prompt-toolkit==3.0.48
nose==1.3.7
pylint==3.3.4
pylint-django==2.6.1
flake8==7.1.1
pre-commit==4.0.1
coverage==7.6.10
Faker==33.1.0
isort==5.13.2
setuptools==75.4.0
black==24.10.0
pyfakefs==5.7.4
pytest==8.3.4
ruff==0.9.4

0 comments on commit 0299d7d

Please sign in to comment.