@@ -72,10 +72,8 @@ def report_iter(self, parsed_file):
7272class CheckNewlineEndOfFile (ContentCheck ):
7373 REPORTS = frozenset (["D005" ])
7474
75- def __init__ (self , cfg ):
76- super (CheckNewlineEndOfFile , self ).__init__ (cfg )
77-
7875 def report_iter (self , parsed_file ):
76+ # pylint: disable=protected-access
7977 if parsed_file .lines and not (
8078 parsed_file .lines [- 1 ].endswith (b"\n " )
8179 or parsed_file ._lines [- 1 ].endswith (b"\r " )
@@ -123,7 +121,7 @@ class CheckValidity(ContentCheck):
123121 ]
124122
125123 def __init__ (self , cfg ):
126- super (CheckValidity , self ).__init__ (cfg )
124+ super ().__init__ (cfg )
127125 self ._sphinx_mode = cfg .get ("sphinx" )
128126
129127 def report_iter (self , parsed_file ):
@@ -144,7 +142,7 @@ class CheckMaxLineLength(ContentCheck):
144142 REPORTS = frozenset (["D001" ])
145143
146144 def __init__ (self , cfg ):
147- super (CheckMaxLineLength , self ).__init__ (cfg )
145+ super ().__init__ (cfg )
148146 self ._max_line_length = self ._cfg ["max_line_length" ]
149147 self ._allow_long_titles = self ._cfg ["allow_long_titles" ]
150148
@@ -255,11 +253,11 @@ def _rst_checker(self, parsed_file):
255253 directives = self ._extract_directives (lines )
256254
257255 def find_containing_nodes (num ):
258- if num < first_line and len ( nodes_lines ) :
256+ if num < first_line and nodes_lines :
259257 return [nodes_lines [0 ][0 ]]
260258 contained_in = []
261259 for (n , (line_min , line_max )) in nodes_lines :
262- if num >= line_min and num <= line_max :
260+ if line_min <= num <= line_max :
263261 contained_in .append ((n , (line_min , line_max )))
264262 smallest_span = None
265263 best_nodes = []
@@ -276,6 +274,7 @@ def find_containing_nodes(num):
276274 return best_nodes
277275
278276 def any_types (nodes , types ):
277+ # pylint: disable=use-a-generator
279278 return any ([isinstance (n , types ) for n in nodes ])
280279
281280 skip_types = (docutils_nodes .target , docutils_nodes .literal_block )
@@ -288,7 +287,7 @@ def any_types(nodes, types):
288287 if len (line ) > self ._max_line_length :
289288 in_directive = False
290289 for (start , end ) in directives :
291- if i >= start and i <= end :
290+ if start <= i <= end :
292291 in_directive = True
293292 break
294293 if in_directive :
0 commit comments