diff --git a/resources/test/fixtures/flake8_pie/PIE796.py b/resources/test/fixtures/flake8_pie/PIE796.py index e8ea7c372446b..227ae8acc27b0 100644 --- a/resources/test/fixtures/flake8_pie/PIE796.py +++ b/resources/test/fixtures/flake8_pie/PIE796.py @@ -2,7 +2,7 @@ from enum import Enum, unique -class FakeEnum(enum.Enum): +class FakeEnum1(enum.Enum): A = "A" B = "B" C = "B" # PIE796 @@ -58,3 +58,9 @@ class FakeEnum9(enum.Enum): A = "A" B = "B" C = "C" + + +class FakeEnum10(enum.Enum): + A = enum.auto() + B = enum.auto() + C = enum.auto() diff --git a/src/rules/flake8_pie/rules.rs b/src/rules/flake8_pie/rules.rs index cbe2a5f3681d4..4def9afc38143 100644 --- a/src/rules/flake8_pie/rules.rs +++ b/src/rules/flake8_pie/rules.rs @@ -131,6 +131,15 @@ where continue; }; + if let ExprKind::Call { func, .. } = &value.node { + if checker + .resolve_call_path(func) + .map_or(false, |call_path| call_path == ["enum", "auto"]) + { + continue; + } + } + if !seen_targets.insert(ComparableExpr::from(value)) { let diagnostic = Diagnostic::new( violations::PreferUniqueEnums {