You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
if cls is None:
print(self.filename, self.get_loc(node))
That's a good idea with one comment: we need to make sure it's clear that this is an error message and to either halt the execution of lesson-check or skip to the next file when this happens because we can't produce an AST of (and, therefore, analyze) the current file. Would you like to submit a PR with this fix?
Have maybe improved upon suggestion to add another check and just include the check for cls is None in the self.reporter.check and in the process make it cls is not None. See:
The solution does work, but this allows the AST to be malformed because we expect that all code blocks should have a class associated.
I think the deeper problem is HOW the AST is malformed, because it could be via user error or, as we saw in #543, a parser error. Because None is an unexpected condition which could be caused by either user or parser, it would not be a good idea to throw an error, because that would end up frustrating users if it's the fault of the parser and the lesson is otherwise fine.
That's a good idea with one comment: we need to make sure it's clear that this is an error message and to either halt the execution of
lesson-check
or skip to the next file when this happens because we can't produce an AST of (and, therefore, analyze) the current file. Would you like to submit a PR with this fix?Originally posted by @maxim-belkin in #543 (comment)
The text was updated successfully, but these errors were encountered: