X-Git-Url: https://git.arvados.org/rnaseq-cwl-training.git/blobdiff_plain/33c71b1448690c459d9dcf1c44d962c074aeadc0..HEAD:/bin/lesson_check.py diff --git a/bin/lesson_check.py b/bin/lesson_check.py index 618f322..25388d3 100644 --- a/bin/lesson_check.py +++ b/bin/lesson_check.py @@ -59,6 +59,7 @@ P_INTERNAL_INCLUDE_LINK = re.compile(r'^{% include ([^ ]*) %}$') # What kinds of blockquotes are allowed? KNOWN_BLOCKQUOTES = { 'callout', + 'caution', 'challenge', 'checklist', 'discussion', @@ -67,25 +68,17 @@ KNOWN_BLOCKQUOTES = { 'prereq', 'quotation', 'solution', - 'testimonial' + 'testimonial', + 'warning' } # What kinds of code fragments are allowed? +# Below we allow all 'language-*' code blocks KNOWN_CODEBLOCKS = { 'error', 'output', 'source', - 'language-bash', - 'html', - 'language-c', - 'language-cmake', - 'language-cpp', - 'language-make', - 'language-matlab', - 'language-python', - 'language-r', - 'language-shell', - 'language-sql' + 'warning' } # What fields are required in teaching episode metadata? @@ -115,7 +108,10 @@ def main(): args = parse_args() args.reporter = Reporter() - check_config(args.reporter, args.source_dir) + life_cycle = check_config(args.reporter, args.source_dir) + # pre-alpha lessons should report without error + if life_cycle == "pre-alpha": + args.permissive = True check_source_rmd(args.reporter, args.source_dir, args.parser) args.references = read_references(args.reporter, args.reference_path) @@ -180,7 +176,7 @@ def check_config(reporter, source_dir): reporter.check_field(config_file, 'configuration', config, 'kind', 'lesson') reporter.check_field(config_file, 'configuration', - config, 'carpentry', ('swc', 'dc', 'lc', 'cp')) + config, 'carpentry', ('swc', 'dc', 'lc', 'cp', 'incubator')) reporter.check_field(config_file, 'configuration', config, 'title') reporter.check_field(config_file, 'configuration', config, 'email') @@ -192,6 +188,7 @@ def check_config(reporter, source_dir): reporter.check(defaults in config.get('defaults', []), 'configuration', '"root" not set to "." in configuration') + return config['life_cycle'] def check_source_rmd(reporter, source_dir, parser): """Check that Rmd episode files include `source: Rmd`""" @@ -393,7 +390,7 @@ class CheckBase: for node in self.find_all(self.doc, {'type': 'codeblock'}): cls = self.get_val(node, 'attr', 'class') - self.reporter.check(cls in KNOWN_CODEBLOCKS, + self.reporter.check(cls in KNOWN_CODEBLOCKS or cls.startswith('language-'), (self.filename, self.get_loc(node)), 'Unknown or missing code block type {0}', cls)