-
Notifications
You must be signed in to change notification settings - Fork 2k
Closed
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedContributions especially welcomeContributions especially welcome
Description
ruff 0.4.8+5 (31f9732 2024-06-05) (latest changes from main branch)
ruff *.py --select B909 --no-cache --fix --unsafe-fixes --preview --output-format concise --isolated
file content:
def high_cyclomatic(data):
for c in data:
if c == 0:
c = 38
if c == 1:
c = 201
if c == 2:
c = 192
if c == 3:
c = 70
if c == 4:
c = 184
if c == 5:
c = 100
if c == 6:
c = 85
if c == 7:
c = 0
if c == 8:
c = 18
if c == 9:
c = 183
if c == 10:
c = 140
if c == 11:
c = 216
if c == 12:
c = 60
if c == 13:
c = 139
if c == 14:
c = 133
if c == 15:
c = 252
if c == 16:
c = 148
if c == 17:
c = 156
if c == 18:
c = 73
if c == 19:
c = 137
if c == 20:
c = 167
if c == 21:
c = 44
if c == 22:
c = 90
if c == 23:
c = 50
if c == 24:
c = 169
if c == 25:
c = 216
if c == 26:
c = 182
if c == 27:
c = 231
if c == 28:
c = 192
if c == 29:
c = 14
if c == 30:
c = 236
if c == 31:
c = 158
if c == 32:
c = 38
if c == 33:
c = 36
if c == 34:
c = 101
if c == 35:
c = 75
if c == 36:
c = 81
if c == 37:
c = 105
if c == 38:
c = 217
if c == 39:
c = 33
if c == 40:
c = 200
if c == 41:
c = 124
if c == 42:
c = 161
if c == 43:
c = 81
if c == 44:
c = 6
if c == 45:
c = 231
if c == 46:
c = 156
if c == 47:
c = 213
if c == 48:
c = 203
if c == 49:
c = 121
if c == 50:
c = 217
if c == 51:
c = 170
if c == 52:
c = 217
if c == 53:
c = 249
if c == 54:
c = 201
if c == 55:
c = 81
if c == 56:
c = 205
if c == 57:
c = 206
if c == 58:
c = 50
if c == 59:
c = 131
if c == 60:
c = 223
if c == 61:
c = 24
if c == 62:
c = 220
if c == 63:
c = 83
if c == 64:
c = 15
if c == 65:
c = 186
if c == 66:
c = 126
if c == 67:
c = 68
if c == 68:
c = 94
if c == 69:
c = 101
if c == 70:
c = 85
if c == 71:
c = 229
if c == 72:
c = 10
if c == 73:
c = 7
if c == 74:
c = 57
if c == 75:
c = 124
if c == 76:
c = 111
if c == 77:
c = 230
if c == 78:
c = 192
if c == 79:
c = 111
if c == 80:
c = 237
if c == 81:
c = 106
if c == 82:
c = 126
if c == 83:
c = 149
if c == 84:
c = 28
if c == 85:
c = 204
if c == 86:
c = 241
if c == 87:
c = 113
if c == 88:
c = 161
if c == 89:
c = 136
if c == 90:
c = 189
if c == 91:
c = 156
if c == 92:
c = 195
if c == 93:
c = 123
if c == 94:
c = 64
if c == 95:
c = 93
if c == 96:
c = 45
if c == 97:
c = 167
if c == 98:
c = 218
if c == 99:
c = 211
if c == 100:
c = 19
if c == 101:
c = 94
if c == 102:
c = 207
if c == 103:
c = 128
if c == 104:
c = 209
if c == 105:
c = 13
if c == 106:
c = 71
if c == 107:
c = 39
if c == 108:
c = 218
if c == 109:
c = 124
if c == 110:
c = 51
if c == 111:
c = 204
if c == 112:
c = 94
if c == 113:
c = 171
if c == 114:
c = 1
if c == 115:
c = 190
if c == 116:
c = 1
if c == 117:
c = 248
if c == 118:
c = 216
if c == 119:
c = 10
if c == 120:
c = 162
if c == 121:
c = 204
if c == 122:
c = 152
if c == 123:
c = 196
if c == 124:
c = 146
if c == 125:
c = 227
if c == 126:
c = 191
if c == 127:
c = 182
if c == 128:
c = 100
if c == 129:
c = 74
if c == 130:
c = 82
if c == 131:
c = 129
if c == 132:
c = 207
if c == 133:
c = 51
if c == 134:
c = 168
if c == 135:
c = 81
if c == 136:
c = 101
if c == 137:
c = 108
if c == 138:
c = 30
if c == 139:
c = 66
if c == 140:
c = 21
if c == 141:
c = 135
if c == 142:
c = 248
if c == 143:
c = 49
if c == 144:
c = 203
if c == 145:
c = 20
if c == 146:
c = 135
if c == 147:
c = 197
if c == 148:
c = 212
if c == 149:
c = 159
if c == 150:
c = 173
if c == 151:
c = 195
if c == 152:
c = 152
if c == 153:
c = 158
if c == 154:
c = 27
if c == 155:
c = 61
if c == 156:
c = 209
if c == 157:
c = 155
if c == 158:
c = 55
if c == 159:
c = 87
if c == 160:
c = 229
if c == 161:
c = 143
if c == 162:
c = 200
if c == 163:
c = 220
if c == 164:
c = 164
if c == 165:
c = 97
if c == 166:
c = 92
if c == 167:
c = 65
if c == 168:
c = 253
if c == 169:
c = 249
if c == 170:
c = 23
if c == 171:
c = 1
if c == 172:
c = 154
if c == 173:
c = 248
if c == 174:
c = 89
if c == 175:
c = 144
if c == 176:
c = 109
if c == 177:
c = 233
if c == 178:
c = 46
if c == 179:
c = 174
if c == 180:
c = 101
if c == 181:
c = 130
if c == 182:
c = 116
if c == 183:
c = 103
if c == 184:
c = 142
if c == 185:
c = 229
if c == 186:
c = 217
if c == 187:
c = 207
if c == 188:
c = 146
if c == 189:
c = 24
if c == 190:
c = 153
if c == 191:
c = 149
if c == 192:
c = 48
if c == 193:
c = 77
if c == 194:
c = 187
if c == 195:
c = 205
if c == 196:
c = 75
if c == 197:
c = 171
if c == 198:
c = 122
if c == 199:
c = 37
if c == 200:
c = 92
if c == 201:
c = 63
if c == 202:
c = 71
if c == 203:
c = 81
if c == 204:
c = 101
if c == 205:
c = 216
if c == 206:
c = 32
if c == 207:
c = 55
if c == 208:
c = 219
if c == 209:
c = 204
if c == 210:
c = 63
if c == 211:
c = 16
if c == 212:
c = 6
if c == 213:
c = 49
if c == 214:
c = 158
if c == 215:
c = 228
if c == 216:
c = 237
if c == 217:
c = 123
if c == 218:
c = 161
if c == 219:
c = 15
if c == 220:
c = 172
if c == 221:
c = 79
if c == 222:
c = 64
if c == 223:
c = 34
if c == 224:
c = 147
if c == 225:
c = 228
if c == 226:
c = 200
if c == 227:
c = 0
if c == 228:
c = 12
if c == 229:
c = 209
if c == 230:
c = 95
if c == 231:
c = 239
if c == 232:
c = 161
if c == 233:
c = 24
if c == 234:
c = 211
if c == 235:
c = 35
if c == 236:
c = 187
if c == 237:
c = 79
if c == 238:
c = 116
if c == 239:
c = 46
if c == 240:
c = 184
if c == 241:
c = 170
if c == 242:
c = 199
if c == 243:
c = 118
if c == 244:
c = 237
if c == 245:
c = 174
if c == 246:
c = 142
if c == 247:
c = 99
if c == 248:
c = 137
if c == 249:
c = 163
if c == 250:
c = 28
if c == 251:
c = 233
if c == 252:
c = 19
if c == 253:
c = 189
if c == 254:
c = 143
if c == 255:
c = 7
error
All checks passed!
error: Panicked while linting /opt/tmp_folder/1657168574823887697.py: This indicates a bug in Ruff. If you could open an issue at:
https://github.com/astral-sh/ruff/issues/new?title=%5BLinter%20panic%5D
...with the relevant file contents, the `pyproject.toml` settings, and the following stack trace, we'd be very appreciative!
panicked at crates/ruff_linter/src/rules/flake8_bugbear/rules/loop_iterator_mutation.rs:248:17:
attempt to add with overflow
Backtrace: 0: ruff::panic::catch_unwind::{{closure}}
at ./ruff/crates/ruff/src/panic.rs:31:25
1: <alloc::boxed::Box<F,A> as core::ops::function::Fn<Args>>::call
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/alloc/src/boxed.rs:2034:9
2: std::panicking::rust_panic_with_hook
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:783:13
3: std::panicking::begin_panic_handler::{{closure}}
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:649:13
4: std::sys_common::backtrace::__rust_end_short_backtrace
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:171:18
5: rust_begin_unwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:645:5
6: core::panicking::panic_fmt
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:72:14
7: core::panicking::panic
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/panicking.rs:145:5
8: <ruff_linter::rules::flake8_bugbear::rules::loop_iterator_mutation::LoopMutationsVisitor as ruff_python_ast::visitor::Visitor>::visit_stmt
at ./ruff/crates/ruff_linter/src/rules/flake8_bugbear/rules/loop_iterator_mutation.rs:248:17
9: ruff_python_ast::visitor::walk_body
at ./ruff/crates/ruff_python_ast/src/visitor.rs:115:9
10: ruff_python_ast::visitor::Visitor::visit_body
at ./ruff/crates/ruff_python_ast/src/visitor.rs:94:9
11: ruff_linter::rules::flake8_bugbear::rules::loop_iterator_mutation::loop_iterator_mutation
at ./ruff/crates/ruff_linter/src/rules/flake8_bugbear/rules/loop_iterator_mutation.rs:74:17
12: ruff_linter::checkers::ast::analyze::deferred_for_loops::deferred_for_loops
at ./ruff/crates/ruff_linter/src/checkers/ast/analyze/deferred_for_loops.rs:34:17
13: ruff_linter::checkers::ast::check_ast
at ./ruff/crates/ruff_linter/src/checkers/ast/mod.rs:2420:5
14: ruff_linter::linter::check_path
at ./ruff/crates/ruff_linter/src/linter.rs:161:40
15: ruff_linter::linter::lint_fix
at ./ruff/crates/ruff_linter/src/linter.rs:560:22
16: ruff::diagnostics::lint_path
at ./ruff/crates/ruff/src/diagnostics.rs:274:14
17: ruff::commands::check::lint_path::{{closure}}
at ./ruff/crates/ruff/src/commands/check.rs:192:9
18: std::panicking::try::do_call
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
19: std::panicking::try
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
20: std::panic::catch_unwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
21: ruff::panic::catch_unwind
at ./ruff/crates/ruff/src/panic.rs:40:18
22: ruff::commands::check::lint_path
at ./ruff/crates/ruff/src/commands/check.rs:191:18
23: ruff::commands::check::check::{{closure}}
at ./ruff/crates/ruff/src/commands/check.rs:93:17
24: <rayon::iter::filter_map::FilterMapFolder<C,P> as rayon::iter::plumbing::Folder<T>>::consume
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/filter_map.rs:123:36
25: rayon::iter::plumbing::Folder::consume_iter
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:178:20
26: rayon::iter::plumbing::Producer::fold_with
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:109:9
27: rayon::iter::plumbing::bridge_producer_consumer::helper
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:437:13
28: rayon::iter::plumbing::bridge_producer_consumer
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:396:12
29: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:372:13
30: <rayon::slice::Iter<T> as rayon::iter::IndexedParallelIterator>::with_producer
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/slice/mod.rs:826:9
31: rayon::iter::plumbing::bridge
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/plumbing/mod.rs:356:12
32: <rayon::slice::Iter<T> as rayon::iter::ParallelIterator>::drive_unindexed
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/slice/mod.rs:802:9
33: <rayon::iter::filter_map::FilterMap<I,P> as rayon::iter::ParallelIterator>::drive_unindexed
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/filter_map.rs:46:9
34: <rayon::iter::fold::Fold<I,ID,F> as rayon::iter::ParallelIterator>::drive_unindexed
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/fold.rs:59:9
35: rayon::iter::reduce::reduce
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/reduce.rs:15:5
36: rayon::iter::ParallelIterator::reduce
at /home/runner/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rayon-1.10.0/src/iter/mod.rs:998:9
37: ruff::commands::check::check
at ./ruff/crates/ruff/src/commands/check.rs:163:10
38: ruff::check
at ./ruff/crates/ruff/src/lib.rs:429:13
39: ruff::run
at ./ruff/crates/ruff/src/lib.rs:202:33
40: ruff::main
at ./ruff/crates/ruff/src/main.rs:65:11
41: core::ops::function::FnOnce::call_once
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:250:5
42: std::sys_common::backtrace::__rust_begin_short_backtrace
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/sys_common/backtrace.rs:155:18
43: std::rt::lang_start::{{closure}}
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:166:18
44: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &F>::call_once
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/core/src/ops/function.rs:284:13
45: std::panicking::try::do_call
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
46: std::panicking::try
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
47: std::panic::catch_unwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
48: std::rt::lang_start_internal::{{closure}}
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:148:48
49: std::panicking::try::do_call
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:552:40
50: std::panicking::try
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panicking.rs:516:19
51: std::panic::catch_unwind
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/panic.rs:146:14
52: std::rt::lang_start_internal
at /rustc/9b00956e56009bab2aa15d7bff10916599e3d6d6/library/std/src/rt.rs:148:20
53: main
54: <unknown>
55: __libc_start_main
56: _start
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workinggood first issueGood for newcomersGood for newcomershelp wantedContributions especially welcomeContributions especially welcome