diff --git a/CHANGELOG.md b/CHANGELOG.md index e697899f4..2bcb32287 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,6 +32,10 @@ Semantic versioning in our case means: - Domain name was changed from `wemake-python-stylegui.de` to `wemake-python-styleguide.rtfd.io` +### Bugfixes + +- Fixes `WPS226` false positives on `|` use in `SomeType | AnotherType` type hints syntax + ## 0.16.1 diff --git a/tests/test_visitors/test_ast/test_complexity/test_overuses/test_overused_string.py b/tests/test_visitors/test_ast/test_complexity/test_overuses/test_overused_string.py index 7d8095bc0..7fb4dad0f 100644 --- a/tests/test_visitors/test_ast/test_complexity/test_overuses/test_overused_string.py +++ b/tests/test_visitors/test_ast/test_complexity/test_overuses/test_overused_string.py @@ -177,6 +177,8 @@ def test_string_overuse( '"GenericType[int, str]"', '"int"', 'List["int"]', + 'list[int]', + 'int | None', ]) def test_string_type_annotations( assert_errors, diff --git a/wemake_python_styleguide/visitors/ast/complexity/overuses.py b/wemake_python_styleguide/visitors/ast/complexity/overuses.py index ba31b642f..c7408d91b 100644 --- a/wemake_python_styleguide/visitors/ast/complexity/overuses.py +++ b/wemake_python_styleguide/visitors/ast/complexity/overuses.py @@ -48,6 +48,7 @@ class StringOveruseVisitor(base.BaseNodeVisitor): '\n', '\r\n', '\t', + '|', b' ', b'.', b',',