Merge pull request #253 from maxim-belkin/error-out
authorRaniere Silva <raniere@rgaiacs.com>
Thu, 17 May 2018 20:44:43 +0000 (21:44 +0100)
committerGitHub <noreply@github.com>
Thu, 17 May 2018 20:44:43 +0000 (21:44 +0100)
lesson_check.py: Exit with a status of 1 if something was wrong

Makefile
bin/lesson_check.py

index df31f00cfc7ad62b0afc849061a287392998f06c..a5765c79d1822ae91df2f8943f1c8f13438d7cc2 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -93,7 +93,7 @@ lesson-check :
 
 ## lesson-check-all : validate lesson Markdown, checking line lengths and trailing whitespace.
 lesson-check-all :
-       @bin/lesson_check.py -s . -p ${PARSER} -l -w
+       @bin/lesson_check.py -s . -p ${PARSER} -l -w --permissive
 
 ## unittest         : run unit tests on checking tools.
 unittest :
index a9b6c9c89c592d23021688c05ce03b127c1ab25c..6aa1c2c9b03b2a4d3792762f86665f8d64f1a18e 100755 (executable)
@@ -118,6 +118,8 @@ def main():
         checker.check()
 
     args.reporter.report()
+    if args.reporter.messages and not args.permissive:
+        exit(1)
 
 
 def parse_args():
@@ -146,6 +148,11 @@ def parse_args():
                       action="store_true",
                       dest='trailing_whitespace',
                       help='Check for trailing whitespace')
+    parser.add_option('--permissive',
+                      default=False,
+                      action="store_true",
+                      dest='permissive',
+                      help='Do not raise an error even if issues are detected')
 
     args, extras = parser.parse_args()
     require(args.parser is not None,