Skip to content

Commit 6be2f61

Browse files
malsynedjparise
authored andcommitted
ignore-names: case-sensitive globbing on all platforms (#218)
1 parent 6c42826 commit 6be2f61

File tree

10 files changed

+31
-2
lines changed

10 files changed

+31
-2
lines changed

src/pep8ext_naming.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import sys
44
from ast import iter_child_nodes
55
from collections import deque
6-
from fnmatch import fnmatch
6+
from fnmatch import fnmatchcase
77
from functools import partial
88
from itertools import chain
99

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

6969

7070
def _ignored(name, ignore):
71-
return any(fnmatch(name, i) for i in ignore)
71+
return any(fnmatchcase(name, i) for i in ignore)
7272

7373

7474
BaseASTCheck = _ASTCheckMeta('BaseASTCheck', (object,),

testsuite/N801.py

+3
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ class notok:
55
class notok:
66
pass
77
#: Okay(--ignore-names=*ok)
8+
class notok:
9+
pass
10+
#: N801:1:7(--ignore-names=*OK)
811
class notok:
912
pass
1013
#: N801

testsuite/N802.py

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ def NotOK():
2323
def NotOK():
2424
pass
2525
#: Okay(--ignore-names=*OK)
26+
def NotOK():
27+
pass
28+
#: N802:1:5(--ignore-names=*ok)
2629
def NotOK():
2730
pass
2831
#: Okay

testsuite/N803.py

+3
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,9 @@ def b13(BAD, *VERYBAD, **EXTRABAD):
4040
#: Okay(--ignore-names=*BAD)
4141
def b13(BAD, *VERYBAD, **EXTRABAD):
4242
pass
43+
#: N803:1:9(--ignore-names=*bad)
44+
def b13(BAD):
45+
pass
4346
#: N803:1:9
4447
def b14(BAD):
4548
pass

testsuite/N804.py

+5
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,11 @@ def test(self, ads):
1717
def __init_subclass(self, ads):
1818
pass
1919
#: Okay(--ignore-names=klass)
20+
class SpecialConventionCase:
21+
@classmethod
22+
def prepare_meta(klass, root):
23+
pass
24+
#: N804(--ignore-names=KLASS)
2025
class SpecialConventionCase:
2126
@classmethod
2227
def prepare_meta(klass, root):

testsuite/N805.py

+4
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ class Foo:
2323
def bad(ads, self):
2424
pass
2525
#: Okay(--ignore-names=source)
26+
class GraphQLNode:
27+
def resolve_foo(source, info):
28+
pass
29+
#: N805(--ignore-names=SOURCE)
2630
class GraphQLNode:
2731
def resolve_foo(source, info):
2832
pass

testsuite/N806.py

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,9 @@ def test():
2929
def test():
3030
Bad = 1
3131
#: Okay(--ignore-names=B*)
32+
def test():
33+
Bad = 1
34+
#: N806(--ignore-names=b*)
3235
def test():
3336
Bad = 1
3437
#: Okay

testsuite/N807.py

+3
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,9 @@ def __bad__():
5050
def __bad__():
5151
pass
5252
#: Okay(--ignore-names=__*)
53+
def __bad__():
54+
pass
55+
#: N807(--ignore-names=__B*)
5356
def __bad__():
5457
pass
5558
#: Okay

testsuite/N815.py

+3
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,6 @@ class C:
2525
#: Okay(--ignore-names=*Case)
2626
class C:
2727
mixed_Case = 0
28+
#: N815(--ignore-names=*case)
29+
class C:
30+
mixed_Case = 0

testsuite/N816.py

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@
2222
mixedCase = 0
2323
#: Okay(--ignore-names=*Case)
2424
mixedCase = 0
25+
#: N816(--ignore-names=*case)
26+
mixedCase = 0
2527
#: Okay
2628
Γ = 1
2729
#: N816

0 commit comments

Comments
 (0)