Closed tomgreen66 closed 3 years ago
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:
ARCCA/styles@661de87e4a8ce6c962180420c11922f07e476384
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 https://github.com/carpentries/styles/issues/543#issuecomment-780047919