Repository: isac322/flake8-force-keyword-arguments (language: python)

Issue:
Ignore typing.cast
In a type annotated codebase that uses a lot of casting to make `mypy` happy I get a lot of
` FKA100 cast's call uses 2 positional arguments, use keyword arguments.`
can this be ignored by default?

`flake8 directory --kwargs-ignore-function-pattern-extend='^cast$'`
works fine 


Discussion / hints:
@cleder Thanks for issuing.

It turns out `cast` is not a positional-only function.
```
>>> from typing import cast
>>> cast(typ=int, val=1)
1
```

But since no one uses `cast` with keyword, it makes sense to add it to the default exclusion list.

Fix patch:
diff --git a/flake8_force_keyword_arguments/checker.py b/flake8_force_keyword_arguments/checker.py
index 4ccd7c9..abc2328 100644
--- a/flake8_force_keyword_arguments/checker.py
+++ b/flake8_force_keyword_arguments/checker.py
@@ -23,9 +23,15 @@
     from re import Pattern
 
 DEFAULT_MAX_POS_ARGS: Final[int] = 2
-DEFAULT_IGNORE_PATTERNS: Final[
-    str
-] = r'(:?^logger.(:?log|debug|info|warning|error|exception|critical)$|__setattr__$|__delattr__$|__getattr__$)'
+DEFAULT_IGNORE_PATTERNS: Final[str] = (
+    r'(:?'
+    r'^logger.(:?log|debug|info|warning|error|exception|critical)$'
+    r'|__setattr__$'
+    r'|__delattr__$'
+    r'|__getattr__$'
+    r'|^(:?typing\.)?cast$'
+    r')'
+)
 DEFAULT_INSPECT_MODULES: Final[Tuple[str, ...]] = ('builtins',)
 DEFAULT_QUALIFIER_OPTION: Final[util.QualifierOption] = util.QualifierOption.BOTH
 


Test patch:
diff --git a/tests/test_checker.py b/tests/test_checker.py
index 4047d4a..dcfb03e 100644
--- a/tests/test_checker.py
+++ b/tests/test_checker.py
@@ -35,6 +35,17 @@ def test_default_ignore_function_pattern(flake8_path):
     assert result.out_lines == []
 
 
+def test_default_ignore_function_pattern_typing_cast(flake8_path):
+    (flake8_path / 'example.py').write_text(
+        '''
+        typing.cast(object, \'test\')
+        cast(object, 1)
+        ''',
+    )
+    result = flake8_path.run_flake8(['--kwargs-max-positional-arguments', '2'])
+    assert result.out_lines == []
+
+
 def test_ignore_function_pattern_extended(flake8_path):
     (flake8_path / 'example.py').write_text(
         'tt = lambda a, b, c: None',