File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change 29
29
'error' : 2 ,
30
30
}
31
31
32
+ DISABLE_RULE_PATTERN = re .compile (r'^# yamllint disable( rule:\S+)*\s*$' )
33
+ ENABLE_RULE_PATTERN = re .compile (r'^# yamllint enable( rule:\S+)*\s*$' )
34
+
32
35
33
36
class LintProblem (object ):
34
37
"""Represents a linting problem found by yamllint."""
@@ -82,7 +85,7 @@ def __init__(self):
82
85
def process_comment (self , comment ):
83
86
comment = str (comment )
84
87
85
- if re .match (r'^# yamllint disable( rule:\S+)*\s*$' , comment ):
88
+ if DISABLE_RULE_PATTERN .match (comment ):
86
89
items = comment [18 :].rstrip ().split (' ' )
87
90
rules = [item [5 :] for item in items ][1 :]
88
91
if len (rules ) == 0 :
@@ -92,7 +95,7 @@ def process_comment(self, comment):
92
95
if id in self .all_rules :
93
96
self .rules .add (id )
94
97
95
- elif re .match (r'^# yamllint enable( rule:\S+)*\s*$' , comment ):
98
+ elif ENABLE_RULE_PATTERN .match (comment ):
96
99
items = comment [17 :].rstrip ().split (' ' )
97
100
rules = [item [5 :] for item in items ][1 :]
98
101
if len (rules ) == 0 :
You can’t perform that action at this time.
0 commit comments