diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..a171d09 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,17 @@ +name: Ruff +on: [push, pull_request] +jobs: + ruff: + runs-on: ubuntu-latest + steps: + - name: Setup Python + uses: actions/setup-python@v5 + with: + # run on a "fresh" python + python-version: 3.12 + - name: Checkout + uses: actions/checkout@v4 + - name: Install hatch + run: python -m pip install hatch + - name: Check code + run: hatch fmt --check diff --git a/pyproject.toml b/pyproject.toml index dee9f84..3b9a0f3 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -101,6 +101,28 @@ exclude_lines = [ "raise NotImplementedError", ] +[tool.ruff] +exclude = [ + # sphinx + "docs", +] +line-length = 88 +indent-width = 4 +target-version = "py39" +[tool.ruff.format] +# Prefer single quotes over double quotes. +quote-style = "single" +[tool.ruff.lint.per-file-ignores] +"**/test_*" = [ + # permit assert statements in tests + "S101", + # permit relative import in tests + "TID252", + # permit versatile function names in tests + "N802", +] +# permit relative import in subpackage root +"datalad_core/*/__init__.py" = ["TID252"] [tool.commitizen] name = "cz_customize"