From 16e7ee150d885ae25cbada5b8f23a5f903d2ebd3 Mon Sep 17 00:00:00 2001 From: DMarinhoCodacy Date: Mon, 10 Aug 2026 18:26:22 +0100 Subject: [PATCH] Upgrade Ruff 0.16.2 --- .gitignore | 5 ++++- docs/description/FURB105_print-empty-string.md | 4 ++-- docs/description/PLR6104_non-augmented-assignment.md | 5 +++++ docs/description/PT018_pytest-composite-assertion.md | 4 ++++ .../description/PT022_pytest-useless-yield-fixture.md | 3 +++ docs/description/S101_assert.md | 2 ++ docs/patterns.json | 2 +- requirements.txt | 11 +++++------ 8 files changed, 26 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index 9cbf7ca..4ab21dc 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,7 @@ #Ignore vscode AI rules .github/copilot-instructions.md -.idea/ \ No newline at end of file +.idea/ + +#Ignore vscode AI rules +.github/instructions/codacy.instructions.md diff --git a/docs/description/FURB105_print-empty-string.md b/docs/description/FURB105_print-empty-string.md index 9d55b40..47d9646 100644 --- a/docs/description/FURB105_print-empty-string.md +++ b/docs/description/FURB105_print-empty-string.md @@ -22,6 +22,6 @@ print("") print() Fix safety This fix is marked as unsafe if it removes comments or an unused sep keyword argument -that may have side effects. Removing such arguments may change the program's -behavior by skipping the execution of those side effects. +that is not known to be a valid separator. Removing such arguments may change the +program's behavior by skipping their evaluation or hiding a TypeError. ``` \ No newline at end of file diff --git a/docs/description/PLR6104_non-augmented-assignment.md b/docs/description/PLR6104_non-augmented-assignment.md index e55c880..6619b75 100644 --- a/docs/description/PLR6104_non-augmented-assignment.md +++ b/docs/description/PLR6104_non-augmented-assignment.md @@ -47,4 +47,9 @@ foo = [1] bar = foo foo += [2] assert (foo, bar) == ([1, 2], [1, 2]) +An augmented assignment can also fail where the plain form succeeds. NumPy +writes the result into the target's buffer, so a *= b raises where +a = a * b would broadcast to a new shape or promote the dtype. The same +applies to a @= b, which requires the product to have the target's shape. +The fix replaces the whole statement, so any comments inside it are lost. ``` \ No newline at end of file diff --git a/docs/description/PT018_pytest-composite-assertion.md b/docs/description/PT018_pytest-composite-assertion.md index 58dd245..b05a677 100644 --- a/docs/description/PT018_pytest-composite-assertion.md +++ b/docs/description/PT018_pytest-composite-assertion.md @@ -24,4 +24,8 @@ def test_foo(): def test_bar(): assert not something assert not something_else +Fix safety +On stable, the rule's fix is always unsafe and not offered when it would remove comments in the +compound assertion. In preview, the fix is only unsafe when it would delete such comments and +safe otherwise. ``` \ No newline at end of file diff --git a/docs/description/PT022_pytest-useless-yield-fixture.md b/docs/description/PT022_pytest-useless-yield-fixture.md index bfa94eb..5fdb28c 100644 --- a/docs/description/PT022_pytest-useless-yield-fixture.md +++ b/docs/description/PT022_pytest-useless-yield-fixture.md @@ -30,4 +30,7 @@ def my_fixture_with_teardown(): def my_fixture_without_teardown(): resource = acquire_resource() return resource +Fix safety +This rule's fix is always marked unsafe because removing the yield can change the behavior of +code that relies on implicit cleanup, such as when a value is garbage-collected. ``` \ No newline at end of file diff --git a/docs/description/S101_assert.md b/docs/description/S101_assert.md index 2f90251..7741092 100644 --- a/docs/description/S101_assert.md +++ b/docs/description/S101_assert.md @@ -11,6 +11,8 @@ Assertions are removed when Python is run with optimization requested production environments. As such, assertions should not be used for runtime validation of user input or to enforce interface constraints. Consider raising a meaningful error instead of using assert. +The rule exempts assertions within a TYPE_CHECKING block, assuming these are needed to satisfy +a type checker. ## Example ``` assert x > 0, "Expected positive value." diff --git a/docs/patterns.json b/docs/patterns.json index 17ed003..8cc61ce 100644 --- a/docs/patterns.json +++ b/docs/patterns.json @@ -1,6 +1,6 @@ { "name": "ruff", - "version": "0.16.0", + "version": "0.16.2", "patterns": [ { "patternId": "AIR001_airflow-variable-name-task-id-mismatch", diff --git a/requirements.txt b/requirements.txt index 0e0f91e..cd8a01c 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,6 +1,5 @@ -ruff==0.16.0 -jsonpickle==4.1.1 -numpy==2.3.2 -pytest==8.4.1 -toml==0.10.2 - +ruff==0.16.2 +jsonpickle==4.1.2 +numpy==2.5.2 +pytest==9.1.1 +toml==0.10.2 \ No newline at end of file