Avatar for the astral-sh user
astral-sh
ruff
Instrumentation
Wall Time
BlogDocsChangelog

Add Rule to check for singular `yield` in `@contextlib.{async}contextmanager` decorated functions (RUF062)

#17281
Comparing
maxmynter:ctxmg-yield-once
(
1d186b3
) with
main
(
5d52902
)
CodSpeed Performance Gauge
0%
Improvements
0
Regressions
0
Untouched
43
New
0
Dropped
0
Ignored
0

Benchmarks

Passed

linter/default-rules[large/dataset.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[large/dataset.py]
CodSpeed Performance Gauge
+1%
4.1 ms
4 ms
linter/default-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[pydantic/types.py]
CodSpeed Performance Gauge
+1%
2 ms
2 ms
linter/default-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[numpy/ctypeslib.py]
CodSpeed Performance Gauge
+1%
976.9 µs
968.9 µs
linter/default-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[unicode/pypinyin.py]
CodSpeed Performance Gauge
+1%
381.8 µs
378.9 µs
linter/default-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::default_rules::benchmark_default_rules::linter/default-rules[numpy/globals.py]
CodSpeed Performance Gauge
+1%
195.8 µs
194.6 µs
linter/all-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
4.1 ms
4.1 ms
linter/all-with-preview-rules[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
4.9 ms
4.9 ms
linter/all-rules[large/dataset.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[large/dataset.py]
CodSpeed Performance Gauge
0%
17.3 ms
17.3 ms
linter/all-with-preview-rules[large/dataset.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[large/dataset.py]
CodSpeed Performance Gauge
0%
21.1 ms
21.1 ms
linter/all-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[numpy/globals.py]
CodSpeed Performance Gauge
0%
701.2 µs
700.6 µs
lexer[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
219.7 µs
219.6 µs
lexer[unicode/pypinyin.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
75.6 µs
75.6 µs
parser[numpy/globals.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[numpy/globals.py]
CodSpeed Performance Gauge
0%
106.5 µs
106.4 µs
linter/all-with-preview-rules[numpy/globals.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[numpy/globals.py]
CodSpeed Performance Gauge
0%
794.5 µs
794.3 µs
lexer[pydantic/types.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[pydantic/types.py]
CodSpeed Performance Gauge
0%
491.9 µs
491.8 µs
linter/all-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[pydantic/types.py]
CodSpeed Performance Gauge
0%
8.6 ms
8.6 ms
ty_micro[many_string_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_string_assignments::ty_micro[many_string_assignments]
CodSpeed Performance Gauge
0%
72.7 ms
72.7 ms
parser[large/dataset.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[large/dataset.py]
CodSpeed Performance Gauge
0%
5 ms
5 ms
ty_micro[many_enum_members]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_enum_members::ty_micro[many_enum_members]
CodSpeed Performance Gauge
0%
93.6 ms
93.6 ms
DateType
crates/ruff_benchmark/benches/ty.rs::project::datetype::project::DateType
CodSpeed Performance Gauge
0%
267.5 ms
267.5 ms
anyio
crates/ruff_benchmark/benches/ty.rs::project::anyio::project::anyio
CodSpeed Performance Gauge
0%
850.2 ms
850.2 ms
parser[unicode/pypinyin.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
321.2 µs
321.2 µs
ty_check_file[cold]
crates/ruff_benchmark/benches/ty.rs::check_file::benchmark_cold::ty_check_file[cold]
CodSpeed Performance Gauge
0%
119.3 ms
119.3 ms
parser[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
928.1 µs
928.1 µs
hydra-zen
crates/ruff_benchmark/benches/ty.rs::project::hydra::project::hydra-zen
CodSpeed Performance Gauge
0%
714.1 ms
714.1 ms
ty_micro[many_tuple_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_many_tuple_assignments::ty_micro[many_tuple_assignments]
CodSpeed Performance Gauge
0%
61.7 ms
61.7 ms
formatter[numpy/ctypeslib.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[numpy/ctypeslib.py]
CodSpeed Performance Gauge
0%
1.9 ms
1.9 ms
attrs
crates/ruff_benchmark/benches/ty.rs::project::attrs::project::attrs
CodSpeed Performance Gauge
0%
368.4 ms
368.4 ms
lexer[large/dataset.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[large/dataset.py]
CodSpeed Performance Gauge
0%
1.1 ms
1.1 ms
lexer[numpy/globals.py]
crates/ruff_benchmark/benches/lexer.rs::lexer::benchmark_lexer::lexer[numpy/globals.py]
CodSpeed Performance Gauge
0%
29.1 µs
29.1 µs
ty_micro[many_tuple_assignments]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_tuple_implicit_instance_attributes::ty_micro[many_tuple_assignments]
CodSpeed Performance Gauge
0%
62.9 ms
62.9 ms
ty_micro[complex_constrained_attributes_2]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_2::ty_micro[complex_constrained_attributes_2]
CodSpeed Performance Gauge
0%
63.1 ms
63.1 ms
parser[pydantic/types.py]
crates/ruff_benchmark/benches/parser.rs::parser::benchmark_parser::parser[pydantic/types.py]
CodSpeed Performance Gauge
0%
2 ms
2 ms
ty_micro[complex_constrained_attributes_3]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_3::ty_micro[complex_constrained_attributes_3]
CodSpeed Performance Gauge
0%
66.9 ms
66.9 ms
formatter[pydantic/types.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[pydantic/types.py]
CodSpeed Performance Gauge
0%
3.6 ms
3.6 ms
formatter[large/dataset.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[large/dataset.py]
CodSpeed Performance Gauge
0%
9.5 ms
9.5 ms
ty_micro[complex_constrained_attributes_1]
crates/ruff_benchmark/benches/ty.rs::micro::benchmark_complex_constrained_attributes_1::ty_micro[complex_constrained_attributes_1]
CodSpeed Performance Gauge
0%
63.4 ms
63.4 ms
ty_check_file[incremental]
crates/ruff_benchmark/benches/ty.rs::check_file::benchmark_incremental::ty_check_file[incremental]
CodSpeed Performance Gauge
0%
4.9 ms
4.9 ms
formatter[numpy/globals.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[numpy/globals.py]
CodSpeed Performance Gauge
0%
241.7 µs
241.8 µs
formatter[unicode/pypinyin.py]
crates/ruff_benchmark/benches/formatter.rs::formatter::benchmark_formatter::formatter[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
663.1 µs
663.2 µs
linter/all-with-preview-rules[pydantic/types.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[pydantic/types.py]
CodSpeed Performance Gauge
0%
10.2 ms
10.2 ms
linter/all-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::all_rules::benchmark_all_rules::linter/all-rules[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
1.8 ms
1.8 ms
linter/all-with-preview-rules[unicode/pypinyin.py]
crates/ruff_benchmark/benches/linter.rs::preview_rules::benchmark_preview_rules::linter/all-with-preview-rules[unicode/pypinyin.py]
CodSpeed Performance Gauge
0%
2.1 ms
2.1 ms

Commits

Click on a commit to change the comparison range
Base
main
5d52902
-0.11%
Update Schema
b241f06
5 months ago
by maxmynter
+0.09%
(WIP) RUF060 should traverse execution path Currently fails at properly handling try-except-else clauses.
9806bb9
5 months ago
by maxmynter
-0.02%
(WIP) Refactor Node traversal to use Stmt introspection and override visit for Try. This may be important for match too. Will check that tomorrow.
84ef298
5 months ago
by maxmynter
+0.07%
(wip) Fix else clauses for loops and try blocks
e0cd622
5 months ago
by maxmynter
+0.03%
Factor out similar post-processing logic
61590dd
5 months ago
by maxmynter
-0.02%
(refactor) Encapsulate yield stack top increment
ee19a54
5 months ago
by maxmynter
+0.03%
Cleanup
5d164f2
5 months ago
by maxmynter
+0.03%
(tests) Add tests for false positives in ecosystem changes
bb0ca8f
5 months ago
by maxmynter
+0.01%
Respect early returns in control flow yield count
f023ac7
5 months ago
by maxmynter
-0.05%
(tests) Add tests for except return handling
6abf368
5 months ago
by maxmynter
+0.07%
(fixup) Update Rule name reference in comment
baa9877
4 months ago
by maxmynter
-0.01%
Remove unreferenced Snapshot that was stale from merge
ef07edf
4 months ago
by maxmynter
-0.08%
fix deeper merge conflicts
d64720f
3 months ago
by ntBre
-0.16%
Review Comments on tests
82eee22
3 months ago
by maxmynter
0%
Remove unreferenced snapshot
8d6d154
3 months ago
by maxmynter
0%
Rename *_visit_preorder_* -> *_visit_source_order_*
42828fb
3 months ago
by maxmynter
-0.03%
Discriminate between {async}contextmanager in error message
7ae6e79
3 months ago
by maxmynter
+0.1%
Use HashMap to track violating Yield Expressions instead of count We need a HashMap to track because a yield may be on several control flow paths and thus added repeatedly to the violations. Using the yield expressions we can later report multiple diagnostics for a single violation. Currently, we report on the offending yields but with a diagnostic for every particular one.
5451c18
3 months ago
by maxmynter
0%
Clippedyclip
603c1e3
3 months ago
by maxmynter
-0.27%
(fixup) Max except yield path detection
b0fbb43
3 months ago
by maxmynter
+0.02%
Use shared slice instead of Vec
c86a70c
3 months ago
by maxmynter
+0.27%
Use static string slice allocation
e95fd25
17 days ago
by maxmynter
-0.06%
Refactor violation to use collection pattern
395e8ad
17 days ago
by maxmynter
-0.01%
Refactor to avoid loop check duplication
199ba00
17 days ago
by maxmynter
-0.01%
(chore) Reduce duplication and improve naming
623c13f
17 days ago
by maxmynter
+0.06%
(chore) Remove clone() operations
cd63e76
17 days ago
by maxmynter
-0.1%
(chore) Break down try stmt handling into smaller functions
1657154
17 days ago
by maxmynter
-0.05%
(fixup) Stale comment
0823257
17 days ago
by maxmynter
+0.35%
(test) Yield accumulation following loop break
e0ba97b
10 days ago
by maxmynter
-0.06%
(refactor) Only clear yield scopes after returning loop else
20b8018
10 days ago
by maxmynter
-0.12%
(refactor) Reporting simplifications
d8a0097
10 days ago
by maxmynter
+0.11%
(wip, tests) yield preceeding complex control flow
5191b9b
10 days ago
by maxmynter
-0.14%
(refactor) Simplify traversal
447ad5b
7 days ago
by maxmynter
0%
(chore) Cleanup
41c48ad
2 days ago
by maxmynter
-0.01%
(fixup, tests) Loop else handling
e211a6b
2 days ago
by maxmynter
+0.04%
Streamline if/else and match/case
b1b42dc
2 days ago
by maxmynter
0%
(chore) clean comments
ed45233
2 days ago
by maxmynter
+0.14%
(chore) Clippy
8733588
2 days ago
by maxmynter
0%
(chore) Align comments & test case naming
1d186b3
2 days ago
by maxmynter
© 2025 CodSpeed Technology
Home Terms Privacy Docs