Commit b2d856f
authored
Fix false positives for S408/S409 when `xml.dom.minidom` or
`xml.dom.pulldom` are imported inside `if TYPE_CHECKING:` blocks.
Imports inside TYPE_CHECKING are not executed at runtime, so they should
not trigger these Bandit-based security rules.
Adds a dedicated fixture and snapshot test for the TYPE_CHECKING case.
Refs #14901
1 parent 8710af0 commit b2d856f
4 files changed
Lines changed: 15 additions & 0 deletions
File tree
- crates/ruff_linter
- resources/test/fixtures/flake8_bandit
- src/rules/flake8_bandit
- rules
- snapshots
Lines changed: 4 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
67 | 67 | | |
68 | 68 | | |
69 | 69 | | |
| 70 | + | |
70 | 71 | | |
71 | 72 | | |
72 | 73 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
370 | 370 | | |
371 | 371 | | |
372 | 372 | | |
| 373 | + | |
| 374 | + | |
| 375 | + | |
| 376 | + | |
| 377 | + | |
373 | 378 | | |
374 | 379 | | |
375 | 380 | | |
| |||
Lines changed: 5 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
0 commit comments