Skip to content

Commit

Permalink
Add ruff
Browse files Browse the repository at this point in the history
  • Loading branch information
oerc0122 committed Jan 24, 2025
1 parent df2fb58 commit 1fa9c32
Show file tree
Hide file tree
Showing 3 changed files with 85 additions and 26 deletions.
26 changes: 0 additions & 26 deletions .github/workflows/black.yml

This file was deleted.

45 changes: 45 additions & 0 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
name: Lint

on:
push:
pull_request:
schedule:
- cron: "0 0 * * *"

jobs:
lint-mdanse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "MDANSE/Src"

lint-mdanse-gui:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: psf/black@stable
with:
options: "--check --verbose"
src: "MDANSE_GUI/Src"

lint_ruff:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.10"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ruff
- name: Analysing the code with Ruff
run: |
ruff check MDANSE/Src
40 changes: 40 additions & 0 deletions MDANSE/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -52,5 +52,45 @@ package-dir = {"" = "src"}
[project.scripts]
mdanse = "MDANSE.Scripts.mdanse:main"

[tool.ruff]
line-length = 100
indent-width = 4
target-version = "py39"

[tool.ruff.lint]
select = [
"E4", "E7", "E9", "F", # Defaults
# "PL", # Pylint errors
# "E", # Pycodestyle
# "W", # Pycodestyle warnings
# "F", # Pyflakes
# "B", # Flake8 bugbear
# "SIM", # Flake8 Simplify
# "A", # Flake8 builtins
# "COM", # Flake8 commas
# "ISC", # Flake8 implicit string concat
# "RSE", # Flake8 raise
# "FA", # Flake8 future
# "FBT", # Flake8 boolean trap
# "C4", # Flake8 comprehensions
# "Q", # Flake8 Quotes
# "RET", # Flake8 return
# "ARG", # Flake8 unused args
# "PTH", # Flake8 use pathlib
# "I", # Isort
# "RUF", # Ruff specific
# "FURB",# Refurb
# "PERF",# Perflint
# "D", # Pydocstyle
# "UP", # Pyupgrade
]
ignore = [
"F401", # Unused import in init
"E402", # Import not at top
"PLR0913", # Too many arguments
"PLR0912", # Too many branches
"PLR0915", # Too many statements
]

# [tool.setuptools.packages.find]
# where = ["src"]

0 comments on commit 1fa9c32

Please sign in to comment.