diff options
author | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-10 21:38:06 +0100 |
---|---|---|
committer | Pierre Sassoulas <pierre.sassoulas@gmail.com> | 2023-03-10 23:12:37 +0100 |
commit | 5c51bc5259553606f78230a5c0ca4ea3ccbb75c6 (patch) | |
tree | b2fac62450e2a17781369560dc828de7728a2696 | |
parent | 0d26e3cda507bb1a5bca21a0a6e3b86a8ffe92b6 (diff) | |
download | pylint-git-5c51bc5259553606f78230a5c0ca4ea3ccbb75c6.tar.gz |
[pre-commit] Configure ruff to sort import
I'm not sure if ruff handle first party / third parties, but it's good enough for the doc
-rw-r--r-- | .pre-commit-config.yaml | 4 | ||||
-rw-r--r-- | doc/data/ruff.toml | 10 | ||||
-rw-r--r-- | pyproject.toml | 26 | ||||
-rw-r--r-- | requirements_test_pre_commit.txt | 2 |
4 files changed, 33 insertions, 9 deletions
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index b4f4dc767..a881060b1 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,7 +25,7 @@ repos: rev: "v0.0.254" hooks: - id: ruff - name: line-length-doc + name: ruff-doc files: doc/data/messages args: ["--config", "doc/data/ruff.toml"] - repo: https://github.com/Pierre-Sassoulas/copyright_notice_precommit @@ -45,7 +45,7 @@ repos: rev: 5.12.0 hooks: - id: isort - exclude: doc/data/messages/(r/reimported|w/wrong-import-order|u/ungrouped-imports|m/misplaced-future|m/multiple-imports)/bad.py + exclude: doc/data/messages/ - repo: https://github.com/psf/black rev: 23.1.0 hooks: diff --git a/doc/data/ruff.toml b/doc/data/ruff.toml index da929be3b..773f7a313 100644 --- a/doc/data/ruff.toml +++ b/doc/data/ruff.toml @@ -2,4 +2,12 @@ ignore = [] # Reading ease is drastically reduced on read the doc after 103 chars # (Because of horizontal scrolling) line-length = 103 -select = ["E501"] +select = ["E501", "I"] + + +[per-file-ignores] +"doc/data/messages/r/reimported/bad.py" = ["I"] +"doc/data/messages/w/wrong-import-order/bad.py" = ["I"] +"doc/data/messages/u/ungrouped-imports/bad.py" = ["I"] +"doc/data/messages/m/misplaced-future/bad.py" = ["I"] +"doc/data/messages/m/multiple-imports/bad.py" = ["I"] diff --git a/pyproject.toml b/pyproject.toml index e5ab0d735..238b1fcb0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -132,11 +132,27 @@ module = [ ] [tool.ruff] -select = ["E", "F", "W", "B"] -ignore = [ - "B905", # Not enforced previousely -] -fixable = ["E", "F", "W", "B"] + # ruff is less lenient than pylint and does not make any exceptions # (for docstrings, strings and comments in particular). line-length = 115 + +select = [ + "E", # pycodestyle + "F", # pyflakes + "W", # pycodestyle + "B", # bugbear + "I", # isort +] + +ignore = [ + "B905", # `zip()` without an explicit `strict=` parameter +] + +fixable = [ + "E", # pycodestyle + "F", # pyflakes + "W", # pycodestyle + "B", # bugbear + "I", # isort +] diff --git a/requirements_test_pre_commit.txt b/requirements_test_pre_commit.txt index 8928a9acd..301dddce1 100644 --- a/requirements_test_pre_commit.txt +++ b/requirements_test_pre_commit.txt @@ -4,7 +4,7 @@ pre-commit~=3.1;python_version>='3.8' bandit==1.7.4 black==23.1.0 flake8==6.0.0;python_version>='3.8' -ruff +ruff==0.0.254 flake8-typing-imports==1.14.0;python_version>='3.8' isort==5.12.0;python_version>='3.8' mypy==1.0.1 |