From 347e64dd768841dd0b5be577c7e180fd66758f9b Mon Sep 17 00:00:00 2001 From: Jirka Date: Sun, 5 Feb 2023 08:51:34 +0100 Subject: [PATCH 1/3] ci: switch flake8 by ruff --- .pre-commit-config.yaml | 11 ++++++----- pyproject.toml | 27 +++++++++++++++++++++++++++ setup.cfg | 3 --- 3 files changed, 33 insertions(+), 8 deletions(-) delete mode 100644 setup.cfg diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index d2099d62a7..fa1f17ccc9 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -62,16 +62,17 @@ repos: hooks: - id: black-jupyter - - repo: https://github.com/pycqa/flake8 - rev: 6.0.0 - hooks: - - id: flake8 - - repo: https://github.com/pycqa/isort rev: 5.12.0 hooks: - id: isort + - repo: https://github.com/charliermarsh/ruff-pre-commit + rev: v0.0.240 + hooks: + - id: ruff + args: ["--fix"] + - repo: https://github.com/pre-commit/mirrors-prettier rev: v2.7.1 hooks: diff --git a/pyproject.toml b/pyproject.toml index 83b614a25e..168262688b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,3 +11,30 @@ line_length = 120 [tool.black] line-length = 120 target-version = ['py310'] + +[tool.ruff] + line-length = 120 + select = [ + "E", "W", # see: https://pypi.org/project/pycodestyle + "F", # see: https://pypi.org/project/pyflakes + ] + ignore = [ + "E501", + "E731", + "E741", # Ambiguous variable name: ... + "E999", # SyntaxError: invalid syntax. Got unexpected token Newline + ] + exclude = [ + ".eggs", + ".git", + ".ruff_cache", + "__pypackages__", + "_build", + "build", + "dist", + "docs" + ] + ignore-init-module-imports = true + + [tool.ruff.mccabe] + max-complexity = 10 diff --git a/setup.cfg b/setup.cfg deleted file mode 100644 index f6a5466191..0000000000 --- a/setup.cfg +++ /dev/null @@ -1,3 +0,0 @@ -[flake8] -max-line-length = 120 -extend-ignore = E203, W503, E501, E741 From 911e414b08ad719f82b9dab6661d6b10a1f2cdb0 Mon Sep 17 00:00:00 2001 From: Jirka Date: Thu, 9 Feb 2023 12:16:36 +0100 Subject: [PATCH 2/3] ci/bot --- .pre-commit-config.yaml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index fa1f17ccc9..3ca3f772f7 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -28,6 +28,15 @@ exclude: build|stubs|^bot/templates/$|openassistant/templates|docs/docs/api/openapi.json +default_language_version: + python: python3 + +ci: + autofix_prs: true + autoupdate_commit_msg: "[pre-commit.ci] pre-commit suggestions" + autoupdate_schedule: quarterly + skip: ["next-lint-website"] # list of hook ids to skip only in pre-commit.ci + repos: - repo: https://github.com/pre-commit/pre-commit-hooks rev: v4.4.0 From 58dfd4f0bdfbd62456c2f99bec519a63cf6d1f35 Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Tue, 25 Apr 2023 12:24:02 +0200 Subject: [PATCH 3/3] Apply suggestions from code review --- .pre-commit-config.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 3ca3f772f7..78b99f9f8f 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -77,7 +77,7 @@ repos: - id: isort - repo: https://github.com/charliermarsh/ruff-pre-commit - rev: v0.0.240 + rev: v0.0.263 hooks: - id: ruff args: ["--fix"]