Please sign in to comment.
Add in a new linter to catch some malformed i18n strings.
Summary: This adds a new `make lint` command for exercises to check and see if there is an unexpected element contained within a string. I had wanted to move this out into a separate program but I found that I was going to be duplicating a lot of logic from the original extractor - so it really made more sense to have the linting happen in there. I want to have this run as a part of the official Khan Academy `make lint` as well. (Or maybe this could run before the exercise packing runs? I'm open to suggestions.) The output from a failing `make lint` run will look something like this: ``` $ make lint python build/extract_strings.py --lint exercises/*html Lint error in file: exercises/logical_arguments_deductive_reasoning.html Contains invalid node: <div> Identify the <span class="hint_blue">first hypothesis</span>, the <span class="hint_green">first conclusion</span>, the <span class="hint_red">second hypothesis</span>, and the <span class="hint_purple">second conclusion</span>. <div class="graphie"> $( "#hyp_a" ).addClass( "hint_blue" ); $( "#conc_a" ).addClass( "hint_green" ); $( "#hyp_b" ).addClass( "hint_red" ); $( "#conc_b" ).addClass( "hint_purple" ); </div> </div> Invalid node: <div class="graphie"> $( "#hyp_a" ).addClass( "hint_blue" ); $( "#conc_a" ).addClass( "hint_green" ); $( "#hyp_b" ).addClass( "hint_red" ); $( "#conc_b" ).addClass( "hint_purple" ); </div> 1 error detected. make: *** [lint] Error 1 ``` Test Plan: Run `make lint` and verify that there are no errors. Then modify one of the exercises. For example I modified `exercises/logical_arguments_deductive_reasoning.html` and removed the `<p>...</p>` immediately preceding a graphie block (causing it to be included in the extraction). This generated the above error and make the linter fail. Reviewers: csilvers CC: Maniphest Tasks: T1002
- Loading branch information...
Showing with 65 additions and 16 deletions.