code: def check_ast(self):
          
          try:
              tree = compile(''.join(self.lines), '', 'exec', PyCF_ONLY_AST)
          except (ValueError, SyntaxError, TypeError):
              return self.report_invalid_syntax()
          for name, cls, __ in self._ast_checks:
              checker = cls(tree, self.filename)
              for lineno, offset, text, check in checker.run():
                  if not self.lines or not noqa(self.lines[lineno - 1]):
                      self.report_error(lineno, offset, text, check)
docs: Build the file's AST and run all AST checks.