From ce525f2c7ce9215cac9ff10fbdcf407c67277dc8 Mon Sep 17 00:00:00 2001 From: ducklet Date: Sat, 15 Apr 2023 16:55:56 +0200 Subject: [PATCH] add Ruff as linter --- poetry.lock | 31 +++++++++++++++++++++++++++++-- pyproject.toml | 18 ++++++++++++++++++ scripts/lint | 2 ++ 3 files changed, 49 insertions(+), 2 deletions(-) diff --git a/poetry.lock b/poetry.lock index 755075b..a558d11 100644 --- a/poetry.lock +++ b/poetry.lock @@ -1,4 +1,4 @@ -# This file is automatically @generated by Poetry and should not be changed by hand. +# This file is automatically @generated by Poetry 1.4.2 and should not be changed by hand. [[package]] name = "attrs" @@ -506,6 +506,33 @@ pytest = ">=4.6" [package.extras] testing = ["fields", "hunter", "process-tests", "pytest-xdist", "six", "virtualenv"] +[[package]] +name = "ruff" +version = "0.0.261" +description = "An extremely fast Python linter, written in Rust." +category = "dev" +optional = false +python-versions = ">=3.7" +files = [ + {file = "ruff-0.0.261-py3-none-macosx_10_7_x86_64.whl", hash = "sha256:6624a966c4a21110cee6780333e2216522a831364896f3d98f13120936eff40a"}, + {file = "ruff-0.0.261-py3-none-macosx_10_9_x86_64.macosx_11_0_arm64.macosx_10_9_universal2.whl", hash = "sha256:2dba68a9e558ab33e6dd5d280af798a2d9d3c80c913ad9c8b8e97d7b287f1cc9"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl", hash = "sha256:8dbd0cee5a81b0785dc0feeb2640c1e31abe93f0d77c5233507ac59731a626f1"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl", hash = "sha256:581e64fa1518df495ca890a605ee65065101a86db56b6858f848bade69fc6489"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl", hash = "sha256:cc970f6ece0b4950e419f0252895ee42e9e8e5689c6494d18f5dc2c6ebb7f798"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_ppc64.manylinux2014_ppc64.whl", hash = "sha256:8fa98e747e0fe185d65a40b0ea13f55c492f3b5f9a032a1097e82edaddb9e52e"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_ppc64le.manylinux2014_ppc64le.whl", hash = "sha256:f268d52a71bf410aa45c232870c17049df322a7d20e871cfe622c9fc784aab7b"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_s390x.manylinux2014_s390x.whl", hash = "sha256:d1293acc64eba16a11109678dc4743df08c207ed2edbeaf38b3e10eb2597321b"}, + {file = "ruff-0.0.261-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl", hash = "sha256:d95596e2f4cafead19a6d1ec0b86f8fda45ba66fe934de3956d71146a87959b3"}, + {file = "ruff-0.0.261-py3-none-musllinux_1_2_aarch64.whl", hash = "sha256:4bcec45abdf65c1328a269cf6cc193f7ff85b777fa2865c64cf2c96b80148a2c"}, + {file = "ruff-0.0.261-py3-none-musllinux_1_2_armv7l.whl", hash = "sha256:6c5f397ec0af42a434ad4b6f86565027406c5d0d0ebeea0d5b3f90c4bf55bc82"}, + {file = "ruff-0.0.261-py3-none-musllinux_1_2_i686.whl", hash = "sha256:39abd02342cec0c131b2ddcaace08b2eae9700cab3ca7dba64ae5fd4f4881bd0"}, + {file = "ruff-0.0.261-py3-none-musllinux_1_2_x86_64.whl", hash = "sha256:aaa4f52a6e513f8daa450dac4859e80390d947052f592f0d8e796baab24df2fc"}, + {file = "ruff-0.0.261-py3-none-win32.whl", hash = "sha256:daff64b4e86e42ce69e6367d63aab9562fc213cd4db0e146859df8abc283dba0"}, + {file = "ruff-0.0.261-py3-none-win_amd64.whl", hash = "sha256:0fbc689c23609edda36169c8708bb91bab111d8f44cb4a88330541757770ab30"}, + {file = "ruff-0.0.261-py3-none-win_arm64.whl", hash = "sha256:d2eddc60ae75fc87f8bb8fd6e8d5339cf884cd6de81e82a50287424309c187ba"}, + {file = "ruff-0.0.261.tar.gz", hash = "sha256:c1c715b0d1e18f9c509d7c411ca61da3543a4aa459325b1b1e52b8301d65c6d2"}, +] + [[package]] name = "sqlalchemy" version = "2.0.3" @@ -650,4 +677,4 @@ files = [ [metadata] lock-version = "2.0" python-versions = "^3.8" -content-hash = "89d50169f80b2ee180b38499be0a7d85fc709043ceb642902310449efa8b1f27" +content-hash = "effb54588054bd48b9ace7c5c391fb8a4aea94757230af9d88414f28bff27b00" diff --git a/pyproject.toml b/pyproject.toml index 1085192..8042897 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,3 +1,6 @@ +[project] +requires-python = ">=3.8" + [tool.poetry] name = "metadex" version = "0.1.0" @@ -16,6 +19,7 @@ black = "*" isort = "*" autoflake = "*" mypy = "*" +ruff = "*" [tool.poetry.group.test.dependencies] pytest = "^7.2.0" @@ -59,3 +63,17 @@ remove-unused-variables = true remove-all-unused-imports = true ignore-init-module-imports = true ignore-pass-after-docstring = true + +[tool.ruff] +# See https://beta.ruff.rs/docs/rules/ +ignore = [ + "E501", # line length, handled by Black +] +select = [ + "E", # pycodestyle errors + "W", # pycodestyle warnings + "I", # isort + "F", # Pyflakes + "B", # flake8-bugbear + "C4", # flake8-comprehensions checks. +] diff --git a/scripts/lint b/scripts/lint index 569e196..4316fee 100755 --- a/scripts/lint +++ b/scripts/lint @@ -1,10 +1,12 @@ #!/bin/sh -eu if [ "${1:-}" = '--fix' ]; then + ruff check --fix . autoflake --recursive --in-place . isort . black . else + ruff check . autoflake --quiet --recursive --check . isort --check . black --check .