diff --git a/.github/workflows/ruff.yml b/.github/workflows/ruff.yml new file mode 100644 index 0000000..6c24040 --- /dev/null +++ b/.github/workflows/ruff.yml @@ -0,0 +1,22 @@ +name: ruff checks + +on: ["push", "pull_request"] + +jobs: + check: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up PDM with Python 3.11 + uses: pdm-project/setup-pdm@v4 + with: + python-version: 3.11 + - name: Install dependencies + run: | + pdm install + - name: Ruff format check + run: | + pdm fmt --diff + - name: Ruff lint check + run: | + pdm lint --output-format=github diff --git a/.gitignore b/.gitignore index 512fcc7..1df0183 100644 --- a/.gitignore +++ b/.gitignore @@ -7,4 +7,6 @@ dist .vscode .fleet -.idea \ No newline at end of file +.idea + +.ruff_cache \ No newline at end of file diff --git a/pyproject.toml b/pyproject.toml index 4af4a86..29159d2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -16,4 +16,15 @@ build-backend = "pdm.backend" distribution = true [tool.pdm.dev-dependencies] -dev = ["pyodide-py>=0.25.0"] +dev = ["pyodide-py~=0.25.0", "ruff~=0.3.0"] + +[tool.pdm.scripts] +fmt = "ruff format" +lint = "ruff check ." + +[tool.ruff] +fix = true + +[tool.ruff.lint] +fixable = ["ALL"] +select = ["I", "E4", "E7", "E9", "F"]