From 4893898ca123b9fa12f2da8901623f8d6630b877 Mon Sep 17 00:00:00 2001 From: Christian Clauss Date: Wed, 29 Jan 2025 09:18:26 +0100 Subject: [PATCH] Add ruff to the testing (#421) https://docs.astral.sh/ruff https://docs.astral.sh/ruff/linter As suggested in #420. Co-authored-by: Aiden Grossman --- .github/workflows/main.yml | 4 +++- Pipfile | 2 +- Pipfile.lock | 28 ++++++++++++++++++++++++++-- pyproject.toml | 9 +++++++-- 4 files changed, 37 insertions(+), 6 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index cd3b5a95..2f7c5ef5 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -43,12 +43,14 @@ jobs: strategy: matrix: python-version: ${{ fromJSON(needs.Envvars.outputs.version_matrix) }} - task: [Typecheck, Lint, Yapf, Test] + task: [Typecheck, Lint, Ruff, Yapf, Test] include: - task: Typecheck cmd: pytype -j auto . - task: Lint cmd: pylint --rcfile .pylintrc --recursive yes . + - task: Ruff + cmd: ruff check - task: Yapf cmd: yapf . -drp - task: Test diff --git a/Pipfile b/Pipfile index 044b3d1e..db2e9bf8 100644 --- a/Pipfile +++ b/Pipfile @@ -16,8 +16,8 @@ pylint = "==3.3.2" pytest = "==8.3.4" pytype = "==2024.10.11" yapf = "==0.43.0" +ruff = "==0.9.3" [ci] joblib = "==1.4.2" shap = "==0.46.0" - diff --git a/Pipfile.lock b/Pipfile.lock index 43eb06a3..fa68d3db 100644 --- a/Pipfile.lock +++ b/Pipfile.lock @@ -1,7 +1,7 @@ { "_meta": { "hash": { - "sha256": "d87c1c9dcf050c36af0ec282b601a1e4fed2f46bf24260a257fda6e3c04bd9af" + "sha256": "bd6e055867dec0deae82ed0df60f1bf49a2e09acc7a8ef15c1c94b274662293d" }, "pipfile-spec": 6, "requires": {}, @@ -1792,6 +1792,31 @@ "markers": "python_version >= '3.8'", "version": "==6.0.2" }, + "ruff": { + "hashes": [ + "sha256:006e5de2621304c8810bcd2ee101587712fa93b4f955ed0985907a36c427e0c2", + "sha256:040ceb7f20791dfa0e78b4230ee9dce23da3b64dd5848e40e3bf3ab76468dcf4", + "sha256:2dc153c25e715be41bb228bc651c1e9b1a88d5c6e5ed0194fa0dfea02b026439", + "sha256:33866c3cc2a575cbd546f2cd02bdd466fed65118e4365ee538a3deffd6fcb730", + "sha256:5a5a46e09355695fbdbb30ed9889d6cf1c61b77b700a9fafc21b41f097bfbba4", + "sha256:646909a1e25e0dc28fbc529eab8eb7bb583079628e8cbe738192853dbbe43af5", + "sha256:7f39b879064c7d9670197d91124a75d118d00b0990586549949aae80cdc16624", + "sha256:800d773f6d4d33b0a3c60e2c6ae8f4c202ea2de056365acfa519aa48acf28e0b", + "sha256:8293f89985a090ebc3ed1064df31f3b4b56320cdfcec8b60d3295bddb955c22a", + "sha256:90230a6b8055ad47d3325e9ee8f8a9ae7e273078a66401ac66df68943ced029b", + "sha256:96a87ec31dc1044d8c2da2ebbed1c456d9b561e7d087734336518181b26b3aa5", + "sha256:9bb7554aca6f842645022fe2d301c264e6925baa708b392867b7a62645304df4", + "sha256:a187171e7c09efa4b4cc30ee5d0d55a8d6c5311b3e1b74ac5cb96cc89bafc43c", + "sha256:ba6eea4459dbd6b1be4e6bfc766079fb9b8dd2e5a35aff6baee4d9b1514ea519", + "sha256:c4bb09d2bbb394e3730d0918c00276e79b2de70ec2a5231cd4ebb51a57df9ba1", + "sha256:c59ab92f8e92d6725b7ded9d4a31be3ef42688a115c6d3da9457a5bda140e2b4", + "sha256:cabc332b7075a914ecea912cd1f3d4370489c8018f2c945a30bcc934e3bc06a6", + "sha256:eabe5eb2c19a42f4808c03b82bd313fc84d4e395133fb3fc1b1516170a31213c" + ], + "index": "pypi", + "markers": "python_version >= '3.7'", + "version": "==0.9.3" + }, "tabulate": { "hashes": [ "sha256:0095b12bf5966de529c0feb1fa08671671b3368eec77d7ef7ab114be2c068b3c", @@ -1873,4 +1898,3 @@ } } } - diff --git a/pyproject.toml b/pyproject.toml index bdf58d2c..4fd17dba 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,12 @@ -# DO always create a tracking issue when allow-listing warnings -# DO NOT disable warnings-as-error: warnings of today are tomorrow's evolvability blocker. +[tool.ruff] +line-length = 103 +lint.select = [ "C40", "C9", "E", "F", "PERF", "W" ] +lint.ignore = [ "E722", "E731", "E741", "F401", "PERF203" ] +lint.mccabe.max-complexity = 18 [tool.pytest.ini_options] +# DO always create a tracking issue when allow-listing warnings +# DO NOT disable warnings-as-error: warnings of today are tomorrow's evolvability blocker. filterwarnings = [ # Treat warnings as errors "error",