diff --git a/.github/workflows/black.yml b/.github/workflows/black.yml deleted file mode 100644 index 6f3db0d75b..0000000000 --- a/.github/workflows/black.yml +++ /dev/null @@ -1,26 +0,0 @@ -name: Black - -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" diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 0000000000..0e314fde82 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,37 @@ +name: Lint + +on: + push: + pull_request: + schedule: + - cron: "0 0 * * *" + +jobs: + lint_format_ruff: + runs-on: ubuntu-latest + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 + with: + src: "MDANSE/src" + - name: Analysing the code with Ruff + run: | + ruff format --check + + lint_ruff: + runs-on: ubuntu-latest + - uses: actions/checkout@v4 + - uses: astral-sh/ruff-action@v3 + with: + src: "MDANSE/src" + - name: Analysing the code with Ruff + run: | + ruff check + + lint-mdanse-gui: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: psf/black@stable + with: + options: "--check --verbose" + src: "MDANSE_GUI/Src" diff --git a/MDANSE/pyproject.toml b/MDANSE/pyproject.toml index 34a2d630fa..d0b3e708bf 100644 --- a/MDANSE/pyproject.toml +++ b/MDANSE/pyproject.toml @@ -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"]