Lines Matching refs:self

52     def __init__(self):  argument
53 self.files_with_issues = {}
66 def should_check_file(self, filepath): argument
72 for files_exemption in self.suffix_exemptions:
75 if self.path_exemptions and \
76 re.match(self.path_exemptions, self.normalize_path(filepath)):
80 def check_file_for_issue(self, filepath): argument
87 def record_issue(self, filepath, line_number): argument
89 if filepath not in self.files_with_issues.keys():
90 self.files_with_issues[filepath] = []
91 self.files_with_issues[filepath].append(line_number)
93 def output_file_issues(self, logger): argument
95 if self.files_with_issues.values():
96 logger.info(self.heading)
97 for filename, lines in sorted(self.files_with_issues.items()):
129 def issue_with_line(self, line, filepath, line_number): argument
136 def check_file_line(self, filepath, line, line_number): argument
137 if self.issue_with_line(line, filepath, line_number):
138 self.record_issue(filepath, line_number)
140 def check_file_for_issue(self, filepath): argument
147 self.check_file_line(filepath, line, i + 1)
178 def is_valid_shebang(self, first_line, filepath): argument
179 m = re.match(self._shebang_re, first_line)
183 if interpreter not in self._extensions:
185 if not filepath.endswith('.' + self._extensions[interpreter]):
189 def check_file_for_issue(self, filepath): argument
196 self.files_with_issues[filepath] = None
197 elif not self.is_valid_shebang(first_line, filepath):
198 self.files_with_issues[filepath] = [1]
201 self.files_with_issues[filepath] = None
212 def check_file_for_issue(self, filepath): argument
222 self.files_with_issues[filepath] = None
234 def check_file_for_issue(self, filepath): argument
237 self.files_with_issues[filepath] = None
268 def issue_with_line(self, line, _filepath, line_number): argument
278 return not self.GOOD_CHARACTERS_RE.match(text)
285 def should_check_file(self, filepath): argument
290 def issue_with_line(self, line, _filepath, _line_number): argument
299 def should_check_file(self, filepath): argument
304 def issue_with_line(self, line, _filepath, _line_number): argument
314 def issue_with_line(self, line, _filepath, _line_number): argument
332 def issue_with_line(self, line, _filepath, _line_number): argument
342 def issue_with_line(self, line, _filepath, _line_number): argument
404 def __init__(self): argument
409 self.problem = None
411 def issue_with_line(self, line, filepath, line_number): argument
425 m = self.COPYRIGHT_RE.match(line)
426 if m and m.group(1) != self.COPYRIGHT_HOLDER:
427 self.problem = 'Invalid copyright line'
430 m = self.SPDX_RE.match(line)
432 if m.group(1) != self.SPDX_HEADER_KEY:
433 self.problem = 'Misspelled ' + self.SPDX_HEADER_KEY.decode()
436 self.problem = 'Improperly formatted SPDX license identifier'
438 if m.group(3) != self.LICENSE_IDENTIFIER:
439 self.problem = 'Wrong SPDX license identifier'
442 m = self.LICENSE_MENTION_RE.match(line)
444 self.problem = 'Suspicious license mention'
453 def __init__(self, log_file): argument
458 self.logger = None
459 self.setup_logger(log_file)
460 self.issues_to_check = [
473 def setup_logger(self, log_file, level=logging.INFO): argument
475 self.logger = logging.getLogger()
476 self.logger.setLevel(level)
479 self.logger.addHandler(handler)
482 self.logger.addHandler(console)
513 def check_files(self): argument
515 for issue_to_check in self.issues_to_check:
516 for filepath in self.collect_files():
520 def output_issues(self): argument
526 for issue_to_check in self.issues_to_check:
529 issue_to_check.output_file_issues(self.logger)