From 53d5d54c1c0310a05842f53c9546ecdd43e58264 Mon Sep 17 00:00:00 2001 From: njhearp Date: Thu, 14 Nov 2024 09:05:24 -0500 Subject: [PATCH 1/3] Update documentation for B028 --- .../rules/flake8_bugbear/rules/no_explicit_stacklevel.rs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/crates/ruff_linter/src/rules/flake8_bugbear/rules/no_explicit_stacklevel.rs b/crates/ruff_linter/src/rules/flake8_bugbear/rules/no_explicit_stacklevel.rs index 1eb1355a4ea52..2909aa8690b64 100644 --- a/crates/ruff_linter/src/rules/flake8_bugbear/rules/no_explicit_stacklevel.rs +++ b/crates/ruff_linter/src/rules/flake8_bugbear/rules/no_explicit_stacklevel.rs @@ -11,11 +11,12 @@ use crate::checkers::ast::Checker; /// /// ## Why is this bad? /// The `warnings.warn` method uses a `stacklevel` of 1 by default, which -/// limits the rendered stack trace to that of the line on which the -/// `warn` method is called. +/// will output a stack frame of the line on which the "warn" method +/// is called. Setting it to a higher number will output a stack frame +/// from higher up the stack. /// -/// It's recommended to use a `stacklevel` of 2 or higher, give the caller -/// more context about the warning. +/// It's recommended to use a `stacklevel` of 2 or higher, to give the caller +/// a more appropriate context about the warning. /// /// ## Example /// ```python From 736b52f731e71b6080a5a4e5aa1937bffcb53e37 Mon Sep 17 00:00:00 2001 From: njhearp Date: Thu, 14 Nov 2024 09:51:42 -0500 Subject: [PATCH 2/3] Update change log --- CHANGELOG.md | 47 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 763a144e542dd..66a7897be4918 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,52 @@ # Changelog +## 0.7.4 + +### Preview features + +- Detect empty implicit namespace packages ([#14236](https://github.com/njhearp/ruff/pull/14236)) +- Implement `shallow-copy-environ / W1507` ([#14241](https://github.com/njhearp/ruff/pull/14241)) +- \[`flake8-datetimez`\] Usages of `datetime.max`/`datetime.min` (`DTZ901`) ([#14288](https://github.com/njhearp/ruff/pull/14288)) +- \[`flake8-logging`\] Root logger calls (`LOG015`) ([#14302](https://github.com/njhearp/ruff/pull/14302)) +- \[`flake8-pyi`\] Add "replace with `Self`" fix (`PYI019`) ([#14238](https://github.com/njhearp/ruff/pull/14238)) +- \[`perflint`\] implement quick-fix for `manual-list-comprehension` (`PERF401`) ([#13919](https://github.com/njhearp/ruff/pull/13919)) +- \[flake8-markupsafe\] Adds Implementation for MS001 via RUF035 ([#14224](https://github.com/njhearp/ruff/pull/14224)) + +### Rule changes + +- FBT001: exclude boolean operators ([#14203](https://github.com/njhearp/ruff/pull/14203)) +- \[`flake8-pyi`\] Always autofix `duplicate-union-members` (`PYI016`) ([#14270](https://github.com/njhearp/ruff/pull/14270)) +- \[`flake8-pyi`\] Improve autofix for nested and mixed type unions `unnecessary-type-union` (`PYI055`) ([#14272](https://github.com/njhearp/ruff/pull/14272)) +- \[`flake8-pyi`\] Mark fix as unsafe when type annotation contains comments for `duplicate-literal-member` (`PYI062`) ([#14268](https://github.com/njhearp/ruff/pull/14268)) + +### Bug fixes + +- Avoid applying PEP 646 rewrites in invalid contexts ([#14234](https://github.com/njhearp/ruff/pull/14234)) +- Avoid using `typing.Self` in stub files pre-Python 3.11 ([#14230](https://github.com/njhearp/ruff/pull/14230)) +- Detect permutations in redundant open modes ([#14255](https://github.com/njhearp/ruff/pull/14255)) +- Fix `await-outside-async` to allow `await` at the top-level scope of a notebook ([#14225](https://github.com/njhearp/ruff/pull/14225)) +- Fix `pytest-raises-too-broad (PT011)` to flag `pytest.raises` call with keyword `expected_exception` ([#14298](https://github.com/njhearp/ruff/pull/14298)) +- Fix miscellaneous issues in `await-outside-async detection` ([#14218](https://github.com/njhearp/ruff/pull/14218)) +- \[`flake8-simplify`\] Infer "unknown" truthiness for literal iterables whose items are all unpacks (`SIM222`) ([#14263](https://github.com/njhearp/ruff/pull/14263)) +- \[`flake8-type-checking`\] Fix false positives for `typing.Annotated` ([#14311](https://github.com/njhearp/ruff/pull/14311)) +- \[`refurb`\] Avoid triggering `hardcoded-string-charset` for reordered sets ([#14233](https://github.com/njhearp/ruff/pull/14233)) +- \[`refurb`\] Further special cases added to `verbose-decimal-constructor (FURB157)` ([#14216](https://github.com/njhearp/ruff/pull/14216)) +- \[`refurb`\] Use `UserString` instead of non-existent `UserStr` ([#14209](https://github.com/njhearp/ruff/pull/14209)) +- \[`ruff`\] Do not report when `Optional` has no type arguments (`RUF013`) ([#14181](https://github.com/njhearp/ruff/pull/14181)) + +### Documentation + +- Add "Notebook behavior" section for `F704`, `PLE1142` ([#14266](https://github.com/njhearp/ruff/pull/14266)) +- Document comment policy around fix safety ([#14300](https://github.com/njhearp/ruff/pull/14300)) +- Improve docs for ALE plugin for vim ([#14335](https://github.com/njhearp/ruff/pull/14335)) +- Clarified documentation for `B028` ([#14289](...)) + +### Other changes + +- Avoid treating lowercase letters as `# noqa` codes ([#14229](https://github.com/njhearp/ruff/pull/14229)) +- \[`flake8-pyi`\] Add "replace with `Self`" fix (`PYI034`) ([#14217](https://github.com/njhearp/ruff/pull/14217)) +- \[red-knot\] make KnownClass::is_singleton a const fn ([#14211](https://github.com/njhearp/ruff/pull/14211)) + ## 0.7.3 ### Preview features From 2e98d4204686a0f6e041242b1a3a243f36c32152 Mon Sep 17 00:00:00 2001 From: njhearp Date: Thu, 14 Nov 2024 10:21:59 -0500 Subject: [PATCH 3/3] Reverted change log update --- CHANGELOG.md | 47 ----------------------------------------------- 1 file changed, 47 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 66a7897be4918..763a144e542dd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,52 +1,5 @@ # Changelog -## 0.7.4 - -### Preview features - -- Detect empty implicit namespace packages ([#14236](https://github.com/njhearp/ruff/pull/14236)) -- Implement `shallow-copy-environ / W1507` ([#14241](https://github.com/njhearp/ruff/pull/14241)) -- \[`flake8-datetimez`\] Usages of `datetime.max`/`datetime.min` (`DTZ901`) ([#14288](https://github.com/njhearp/ruff/pull/14288)) -- \[`flake8-logging`\] Root logger calls (`LOG015`) ([#14302](https://github.com/njhearp/ruff/pull/14302)) -- \[`flake8-pyi`\] Add "replace with `Self`" fix (`PYI019`) ([#14238](https://github.com/njhearp/ruff/pull/14238)) -- \[`perflint`\] implement quick-fix for `manual-list-comprehension` (`PERF401`) ([#13919](https://github.com/njhearp/ruff/pull/13919)) -- \[flake8-markupsafe\] Adds Implementation for MS001 via RUF035 ([#14224](https://github.com/njhearp/ruff/pull/14224)) - -### Rule changes - -- FBT001: exclude boolean operators ([#14203](https://github.com/njhearp/ruff/pull/14203)) -- \[`flake8-pyi`\] Always autofix `duplicate-union-members` (`PYI016`) ([#14270](https://github.com/njhearp/ruff/pull/14270)) -- \[`flake8-pyi`\] Improve autofix for nested and mixed type unions `unnecessary-type-union` (`PYI055`) ([#14272](https://github.com/njhearp/ruff/pull/14272)) -- \[`flake8-pyi`\] Mark fix as unsafe when type annotation contains comments for `duplicate-literal-member` (`PYI062`) ([#14268](https://github.com/njhearp/ruff/pull/14268)) - -### Bug fixes - -- Avoid applying PEP 646 rewrites in invalid contexts ([#14234](https://github.com/njhearp/ruff/pull/14234)) -- Avoid using `typing.Self` in stub files pre-Python 3.11 ([#14230](https://github.com/njhearp/ruff/pull/14230)) -- Detect permutations in redundant open modes ([#14255](https://github.com/njhearp/ruff/pull/14255)) -- Fix `await-outside-async` to allow `await` at the top-level scope of a notebook ([#14225](https://github.com/njhearp/ruff/pull/14225)) -- Fix `pytest-raises-too-broad (PT011)` to flag `pytest.raises` call with keyword `expected_exception` ([#14298](https://github.com/njhearp/ruff/pull/14298)) -- Fix miscellaneous issues in `await-outside-async detection` ([#14218](https://github.com/njhearp/ruff/pull/14218)) -- \[`flake8-simplify`\] Infer "unknown" truthiness for literal iterables whose items are all unpacks (`SIM222`) ([#14263](https://github.com/njhearp/ruff/pull/14263)) -- \[`flake8-type-checking`\] Fix false positives for `typing.Annotated` ([#14311](https://github.com/njhearp/ruff/pull/14311)) -- \[`refurb`\] Avoid triggering `hardcoded-string-charset` for reordered sets ([#14233](https://github.com/njhearp/ruff/pull/14233)) -- \[`refurb`\] Further special cases added to `verbose-decimal-constructor (FURB157)` ([#14216](https://github.com/njhearp/ruff/pull/14216)) -- \[`refurb`\] Use `UserString` instead of non-existent `UserStr` ([#14209](https://github.com/njhearp/ruff/pull/14209)) -- \[`ruff`\] Do not report when `Optional` has no type arguments (`RUF013`) ([#14181](https://github.com/njhearp/ruff/pull/14181)) - -### Documentation - -- Add "Notebook behavior" section for `F704`, `PLE1142` ([#14266](https://github.com/njhearp/ruff/pull/14266)) -- Document comment policy around fix safety ([#14300](https://github.com/njhearp/ruff/pull/14300)) -- Improve docs for ALE plugin for vim ([#14335](https://github.com/njhearp/ruff/pull/14335)) -- Clarified documentation for `B028` ([#14289](...)) - -### Other changes - -- Avoid treating lowercase letters as `# noqa` codes ([#14229](https://github.com/njhearp/ruff/pull/14229)) -- \[`flake8-pyi`\] Add "replace with `Self`" fix (`PYI034`) ([#14217](https://github.com/njhearp/ruff/pull/14217)) -- \[red-knot\] make KnownClass::is_singleton a const fn ([#14211](https://github.com/njhearp/ruff/pull/14211)) - ## 0.7.3 ### Preview features