Skip to content

Commit

Permalink
ignore-names: case-sensitive globbing on all platforms (#218)
Browse files Browse the repository at this point in the history
  • Loading branch information
malsyned committed Oct 17, 2023
1 parent 8fc68ec commit 2e3c83a
Show file tree
Hide file tree
Showing 10 changed files with 31 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/pep8ext_naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import sys
from ast import iter_child_nodes
from collections import deque
from fnmatch import fnmatch
from fnmatch import fnmatchcase
from functools import partial
from itertools import chain

Expand Down Expand Up @@ -68,7 +68,7 @@ def _err(self, node, code, **kwargs):


def _ignored(name, ignore):
return any(fnmatch(name, i) for i in ignore)
return any(fnmatchcase(name, i) for i in ignore)


BaseASTCheck = _ASTCheckMeta('BaseASTCheck', (object,),
Expand Down
3 changes: 3 additions & 0 deletions testsuite/N801.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ class notok:
class notok:
pass
#: Okay(--ignore-names=*ok)
class notok:
pass
#: N801:1:7(--ignore-names=*OK)
class notok:
pass
#: N801
Expand Down
3 changes: 3 additions & 0 deletions testsuite/N802.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ def NotOK():
def NotOK():
pass
#: Okay(--ignore-names=*OK)
def NotOK():
pass
#: N802:1:5(--ignore-names=*ok)
def NotOK():
pass
#: Okay
Expand Down
3 changes: 3 additions & 0 deletions testsuite/N803.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,9 @@ def b13(BAD, *VERYBAD, **EXTRABAD):
#: Okay(--ignore-names=*BAD)
def b13(BAD, *VERYBAD, **EXTRABAD):
pass
#: N803:1:9(--ignore-names=*bad)
def b13(BAD):
pass
#: N803:1:9
def b14(BAD):
pass
Expand Down
5 changes: 5 additions & 0 deletions testsuite/N804.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@ def test(self, ads):
def __init_subclass(self, ads):
pass
#: Okay(--ignore-names=klass)
class SpecialConventionCase:
@classmethod
def prepare_meta(klass, root):
pass
#: N804(--ignore-names=KLASS)
class SpecialConventionCase:
@classmethod
def prepare_meta(klass, root):
Expand Down
4 changes: 4 additions & 0 deletions testsuite/N805.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,10 @@ class Foo:
def bad(ads, self):
pass
#: Okay(--ignore-names=source)
class GraphQLNode:
def resolve_foo(source, info):
pass
#: N805(--ignore-names=SOURCE)
class GraphQLNode:
def resolve_foo(source, info):
pass
Expand Down
3 changes: 3 additions & 0 deletions testsuite/N806.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,9 @@ def test():
def test():
Bad = 1
#: Okay(--ignore-names=B*)
def test():
Bad = 1
#: N806(--ignore-names=b*)
def test():
Bad = 1
#: Okay
Expand Down
3 changes: 3 additions & 0 deletions testsuite/N807.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ def __bad__():
def __bad__():
pass
#: Okay(--ignore-names=__*)
def __bad__():
pass
#: N807(--ignore-names=__B*)
def __bad__():
pass
#: Okay
Expand Down
3 changes: 3 additions & 0 deletions testsuite/N815.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,6 @@ class C:
#: Okay(--ignore-names=*Case)
class C:
mixed_Case = 0
#: N815(--ignore-names=*case)
class C:
mixed_Case = 0
2 changes: 2 additions & 0 deletions testsuite/N816.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
mixedCase = 0
#: Okay(--ignore-names=*Case)
mixedCase = 0
#: N816(--ignore-names=*case)
mixedCase = 0
#: Okay
Γ = 1
#: N816
Expand Down

0 comments on commit 2e3c83a

Please sign in to comment.