:param filename: str pointing to a file within the buildroot.
try:
python_file = PythonFile.parse(filename, root=get_buildroot())
except CheckSyntaxError as e:
yield e.as_nit()
return
if noqa_file_filter(python_file):
return
if self.options.suppress:
// Filter out any suppressed plugins
check_plugins = [plugin for plugin in self._plugins
if self.excluder.should_include(filename, plugin.name)]
else:
check_plugins = self._plugins
for plugin in check_plugins:
for i, nit in enumerate(plugin.checker(python_file)):
if i == 0:
// NB: Add debug log header for nits from each plugin, but only if there are nits from it.
self.context.log.debug("Nits from plugin {} for {}".format(plugin.name, filename))
if not nit.has_lines_to_display:
yield nit
continue
if all(not line_contains_noqa(line) for line in nit.lines):
yield nit
def check_file(self, filename):
Process python file looking for indications of problems.
:param filename: (str) Python source filename