Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add catch for None type code block in lesson_check #558

Merged
merged 2 commits into from
Mar 11, 2021

Conversation

zkamvar
Copy link
Contributor

@zkamvar zkamvar commented Mar 11, 2021

There are times when the AST is malformed and does not emit a class for
the code element. We do not want the parser to crash when this happens,
but we also want to notify ourselves that the AST is malformed.

This should not result in an error because as we saw in
#543, the parser itself can
cause these malformations when the lesson itself renders well. Even
though we fixed the previous issue with an updated parser, problems
still persist:
swcarpentry/r-novice-gapminder#696 (comment)

I fully admit that this is a kludge.

This will fix #550

There are times when the AST is malformed and does not emit a class for
the code element. We do not want the parser to crash when this happens,
but we also want to notify ourselves that the AST is malformed.

This should not result in an error because as we saw in
carpentries#543, the parser itself can
cause these malformations when the lesson itself renders well. Even
though we fixed the previous issue with an updated parser, problems
still persist:
swcarpentry/r-novice-gapminder#696 (comment)

I fully admit that this is a kludge.
I've removed the print condition, because it will just result in an error no matter what (sigh)
@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 11, 2021

Note: when testing on https://github.com/swcarpentry/r-novice-gapminder/tree/a2bf86ecdcb27d5442d8a7366776a50f5b56fad3 with the current branch, I get the following output

./_episodes/01-rstudio-intro.md:152: Unknown or missing code block type r
./_episodes/04-data-structures-part1.md:351: Unknown or missing code block type None
./_episodes/05-data-structures-part2.md:793: Unknown or missing code block type r
./_episodes/05-data-structures-part2.md:803: Unknown or missing code block type r
./_episodes/07-control-flow.md:211: Unknown or missing blockquote type None
./_episodes/07-control-flow.md:225: Unknown or missing blockquote type None
./_episodes/07-control-flow.md:239: Unknown or missing code block type output callout
./_episodes/07-control-flow.md:446: Unknown or missing code block type r
./_episodes/14-tidyr.md:124: Unknown or missing blockquote type None
./_episodes/15-knitr-markdown.md:84: Unknown or missing code block type None
./_episodes/15-knitr-markdown.md:126: Unknown or missing code block type None
./_episodes/15-knitr-markdown.md:134: Unknown or missing code block type None
./_episodes/15-knitr-markdown.md:152: Unknown or missing code block type None
./_episodes/15-knitr-markdown.md:167: Unknown or missing code block type None
./_episodes/15-knitr-markdown.md:190: Unknown or missing code block type None
./_episodes/15-knitr-markdown.md:227: Unknown or missing code block type None
./_extras/guide.md:67: Unknown or missing code block type bash

Copy link
Contributor

@maxim-belkin maxim-belkin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me! 👍🏻

@maxim-belkin
Copy link
Contributor

maxim-belkin commented Mar 11, 2021

Those r and bash blockquotes should be language-r and language-bash, correspondingly.
The Unknown or missing code block type output callout is interesting -- I'd have to look into it locally.

@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 11, 2021

Those r and bash blockquotes should be language-r and language-bash, correspondingly.
The Unknown or missing code block type output callout is interesting -- I'd have to look into it locally.

I looked into it and there was a situation where someone added the callout block at the bottom of an R code block, so it is a bona-fide error.

@zkamvar zkamvar merged commit 091d31a into carpentries:gh-pages Mar 11, 2021
@zkamvar zkamvar deleted the znk-fix-550 branch March 11, 2021 18:28
@zkamvar
Copy link
Contributor Author

zkamvar commented Mar 11, 2021

Thank you for the quick review @maxim-belkin!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Print error in lesson_check.py if code block has no class specifier
2 participants