From 1d27b9d96d6b6e1a075f5466e1e772fed3ec18db Mon Sep 17 00:00:00 2001 From: Rafal Chlodnicki Date: Tue, 7 Nov 2023 12:18:50 +0100 Subject: [PATCH] add CI linting --- .gitattributes | 6 ++++++ .github/workflows/ci.yaml | 20 ++++++++++++++++++++ .gitignore | 2 ++ origami.py | 2 +- pyproject.toml | 14 ++++++++++++++ tox.ini | 15 ++++----------- 6 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 .gitattributes create mode 100644 .github/workflows/ci.yaml create mode 100644 pyproject.toml diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..2263f68 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,6 @@ +.gitattributes export-ignore +.github export-ignore +.gitignore export-ignore +mypy.ini export-ignore +pyproject.toml export-ignore +tox.ini export-ignore diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..b4c71dd --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,20 @@ +name: CI +on: push +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Install Python + uses: actions/setup-python@v4 + with: + python-version: "3.11" + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install ruff mypy + # Update output format to enable automatic inline annotations. + - name: Run Ruff + run: ruff check --output-format=github . + - name: Run Mypy + run: mypy . diff --git a/.gitignore b/.gitignore index 28b7b95..1ef5e08 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,5 @@ +.tox +.ruff_cache *.pyc *.cache *.sublime-project diff --git a/origami.py b/origami.py index d773574..ae7a9fd 100644 --- a/origami.py +++ b/origami.py @@ -321,7 +321,7 @@ def zoom_pane(self, fraction): fraction_vertical = fraction[1] fraction_horizontal = min(1, max(0, fraction_horizontal)) - fraction_vertical = min(1, max(0, fraction_vertical)) + fraction_vertical = min(1, max(0, fraction_vertical)) window = self.window rows, cols, cells = self.get_layout() diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..6e1cec2 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,14 @@ +[tool.ruff] +line-length = 120 +indent-width = 4 +target-version = "py38" + +[tool.ruff.lint] +preview = true +select = ["B", "E", "F", "W"] +fixable = ["ALL"] + +[tool.ruff.format] +quote-style = "double" +indent-style = "space" +line-ending = "lf" diff --git a/tox.ini b/tox.ini index fe9c57c..141a97c 100644 --- a/tox.ini +++ b/tox.ini @@ -7,17 +7,10 @@ envlist = py3 skipsdist = True -[pycodestyle] -max-line-length = 120 - -[flake8] -max-line-length = 120 -ignore = W191 - [testenv] deps = - flake8==3.8.3 - mypy==0.790 + mypy==1.6.1 + ruff==0.1.4 commands = - mypy plugin - flake8 plugin tests + mypy . + ruff .