From 8ab145defbebc703c9e81c477e9192cf6913b604 Mon Sep 17 00:00:00 2001 From: William Bergamin Date: Wed, 29 May 2024 15:02:53 -0400 Subject: [PATCH] use ruff --- .flake8 | 2 -- .github/workflows/{flake8.yml => lint.yml} | 8 ++++---- .github/workflows/pytest.yml | 2 +- README.md | 9 +++++---- pyproject.toml | 17 ++++++++++++++--- requirements.txt | 5 ++--- 6 files changed, 26 insertions(+), 17 deletions(-) delete mode 100644 .flake8 rename .github/workflows/{flake8.yml => lint.yml} (83%) diff --git a/.flake8 b/.flake8 deleted file mode 100644 index 113ca5f..0000000 --- a/.flake8 +++ /dev/null @@ -1,2 +0,0 @@ -[flake8] -max-line-length = 125 diff --git a/.github/workflows/flake8.yml b/.github/workflows/lint.yml similarity index 83% rename from .github/workflows/flake8.yml rename to .github/workflows/lint.yml index 8e85fa7..0bfd344 100644 --- a/.github/workflows/flake8.yml +++ b/.github/workflows/lint.yml @@ -1,4 +1,4 @@ -name: Linting validation using flake8 +name: Linting validation using ruff on: push: @@ -6,7 +6,7 @@ on: pull_request: jobs: - build: + lint: runs-on: ubuntu-latest timeout-minutes: 5 strategy: @@ -23,6 +23,6 @@ jobs: run: | pip install -U pip pip install -r requirements.txt - - name: Lint with flake8 + - name: Lint with ruff run: | - flake8 *.py + ruff check diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index 1b246f7..17eda2e 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -6,7 +6,7 @@ on: pull_request: jobs: - build: + test: runs-on: ubuntu-latest timeout-minutes: 5 strategy: diff --git a/README.md b/README.md index c3b1d61..600fdba 100644 --- a/README.md +++ b/README.md @@ -59,11 +59,12 @@ To stop running locally, press ` + C` to end the process. #### Linting ```zsh -# Run flake8 from root directory for linting -flake8 *.py +# Run ruff from root directory for linting +ruff check -# Run black from root directory for code formatting -black . +# Run ruff from root directory for code formatting +ruff format +ruff check --fix ``` ## Testing diff --git a/pyproject.toml b/pyproject.toml index 7bf3f19..1c0a283 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,19 @@ -# black project prefers pyproject.toml -# that's why we have this file in addition to other setting files -[tool.black] +[tool.ruff] line-length = 125 +[tool.ruff.lint] +ignore = [] +select = [ + # pycodestyle error + "E", + # pycodestyle warning + "W", + # Pyflakes + "F", + # isort + "I", +] + [tool.pytest.ini_options] testpaths = ["tests"] log_file = "logs/pytest.log" diff --git a/requirements.txt b/requirements.txt index efae1be..fe6311d 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,6 @@ slack-cli-hooks slack-bolt==1.19.0rc1 -pytest==8.2 -flake8==7.0 -black==24.4 requests==2.32 Flask==3.0 +pytest==8.2 +ruff==0.4