@@ -531,6 +531,7 @@ def visit_Call(self, node) -> None:
531531 self .check_for_b905 (node )
532532 self .check_for_b910 (node )
533533 self .check_for_b911 (node )
534+ self .check_for_b912 (node )
534535
535536 # no need for copying, if used in nested calls it will be set to None
536537 current_b040_caught_exception = self .b040_caught_exception
@@ -1536,6 +1537,16 @@ def check_for_b905(self, node) -> None:
15361537 if not any (kw .arg == "strict" for kw in node .keywords ):
15371538 self .add_error ("B905" , node )
15381539
1540+ def check_for_b912 (self , node ) -> None :
1541+ if not (
1542+ isinstance (node .func , ast .Name )
1543+ and node .func .id == "map"
1544+ and len (node .args ) > 2
1545+ ):
1546+ return
1547+ if not any (kw .arg == "strict" for kw in node .keywords ):
1548+ self .add_error ("B912" , node )
1549+
15391550 def check_for_b906 (self , node : ast .FunctionDef ) -> None :
15401551 if not node .name .startswith ("visit_" ):
15411552 return
@@ -2465,6 +2476,7 @@ def __call__(self, lineno: int, col: int, vars: tuple[object, ...] = ()) -> erro
24652476 "B911" : Error (
24662477 message = "B911 `itertools.batched()` without an explicit `strict=` parameter."
24672478 ),
2479+ "B912" : Error (message = "B912 `map()` without an explicit `strict=` parameter." ),
24682480 "B950" : Error (message = "B950 line too long ({} > {} characters)" ),
24692481}
24702482
@@ -2480,5 +2492,6 @@ def __call__(self, lineno: int, col: int, vars: tuple[object, ...] = ()) -> erro
24802492 "B909" ,
24812493 "B910" ,
24822494 "B911" ,
2495+ "B912" ,
24832496 "B950" ,
24842497]
0 commit comments