Loading LICENSE.md +9 −12 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ layout: page title: Licenses --- ### Instructional Material ## Instructional Material All Software Carpentry instructional material is made available under the [Creative Commons Attribution license][cc-by-human]. The following Loading Loading @@ -43,12 +43,12 @@ Notices: rights such as publicity, privacy, or moral rights may limit how you use the material. ### Software ## Software Except where otherwise noted, the example programs and other software provided by Software Carpentry are made available under the [OSI](http://opensource.org)-approved [MIT license](http://opensource.org/licenses/mit-license.html). [OSI][osi]-approved [MIT license][mit-license]. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Loading @@ -69,16 +69,13 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ### Other Material Our [code of conduct](CODE_OF_CONDUCT.html) is taken from [this site](https://github.com/Bantik/contributor_covenant/blob/master/LICENSE), and is made available under the same MIT License as our software. ### Trademark ## Trademark "Software Carpentry" and the Software Carpentry logo are registered trademarks of Software Carpentry, Ltd. trademarks of [NumFOCUS][numfocus]. [cc-by-human]: https://creativecommons.org/licenses/by/4.0/ [cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode [mit-license]: http://opensource.org/licenses/mit-license.html [numfocus]: http://numfocus.org/ [osi]: http://opensource.org Makefile +12 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,14 @@ R_CHUNK_OPTS = tools/chunk-options.R # Default action is to show what commands are available. all : commands ## check : Validate all lesson content against the template. check: $(ALL_MD) python tools/check.py . ## clean : Clean up temporary and intermediate files. clean : @rm -rf $$(find . -name '*~' -print) ## preview : Build website locally for checking. preview : $(DST_ALL) Loading @@ -48,11 +56,6 @@ motivation.html : motivation.md _layouts/slides.revealjs Makefile $(INCLUDES) \ -o $@ $< ## unittest : Run unit test (for Python 2 and 3) unittest: tools/check.py tools/validation_helpers.py tools/test_check.py cd tools/ && python2 test_check.py cd tools/ && python3 test_check.py # Pattern to convert R Markdown to Markdown. %.md: %.Rmd $(R_CHUNK_OPTS) Rscript -e "knitr::knit('$$(basename $<)', output = '$$(basename $@)')" Loading @@ -68,6 +71,7 @@ settings : @echo 'SRC_MD:' $(SRC_MD) @echo 'DST_HTML:' $(DST_HTML) ## clean : Clean up temporary and intermediate files. clean : @rm -rf $$(find . -name '*~' -print) ## unittest : Run internal tests to ensure the validator is working correctly (for Python 2 and 3). unittest: tools/check.py tools/validation_helpers.py tools/test_check.py cd tools/ && python2 test_check.py cd tools/ && python3 test_check.py tools/check.py +16 −2 Original line number Diff line number Diff line Loading @@ -74,6 +74,19 @@ class MarkdownValidator(object): ast = parser.parse(markdown) return ast def _validate_no_fixme(self): """Validate that the file contains no lines marked 'FIXME' This will be based on the raw markdown, not the ast""" valid = True for i, line in enumerate(self.markdown.splitlines()): if re.search("FIXME", line, re.IGNORECASE): logging.error( "In {0}: " "Line {1} contains FIXME, indicating " "work in progress".format(self.filename, i+1)) valid = False return valid def _validate_hrs(self): """Validate header Loading Loading @@ -418,7 +431,8 @@ class MarkdownValidator(object): Error trapping is handled by the validate() wrapper method. """ tests = [self._validate_doc_headers(), tests = [self._validate_no_fixme(), self._validate_doc_headers(), self._validate_section_heading_order(), self._validate_callouts(), self._validate_links()] Loading Loading @@ -620,7 +634,7 @@ class LicensePageValidator(MarkdownValidator): def _run_tests(self): """Skip the base tests; just check md5 hash""" # TODO: This hash is specific to the license for english-language repo expected_hash = 'cd5742b6596a1f2f35c602ad43fa24b2' expected_hash = '051a04b8ffe580ba6b7018fb4fd72a50' m = hashlib.md5() try: m.update(self.markdown) Loading tools/test_check.py +11 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,17 @@ A spacer paragraph """) self.assertFalse(validator._validate_callouts()) def test_fail_if_fixme_present_all_caps(self): """Validation should fail if a line contains the word FIXME (exact)""" validator = self._create_validator("""Incomplete sentence (FIXME).""") self.assertFalse(validator._validate_no_fixme()) def test_fail_if_fixme_present_mixed_case(self): """Validation should fail if a line contains the word FIXME (in any capitalization)""" validator = self._create_validator("""Incomplete sentence (FiXmE).""") self.assertFalse(validator._validate_no_fixme()) class TestTopicPage(BaseTemplateTest): """Verifies that the topic page validator works as expected""" Loading Loading
LICENSE.md +9 −12 Original line number Diff line number Diff line Loading @@ -2,7 +2,7 @@ layout: page title: Licenses --- ### Instructional Material ## Instructional Material All Software Carpentry instructional material is made available under the [Creative Commons Attribution license][cc-by-human]. The following Loading Loading @@ -43,12 +43,12 @@ Notices: rights such as publicity, privacy, or moral rights may limit how you use the material. ### Software ## Software Except where otherwise noted, the example programs and other software provided by Software Carpentry are made available under the [OSI](http://opensource.org)-approved [MIT license](http://opensource.org/licenses/mit-license.html). [OSI][osi]-approved [MIT license][mit-license]. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the Loading @@ -69,16 +69,13 @@ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ### Other Material Our [code of conduct](CODE_OF_CONDUCT.html) is taken from [this site](https://github.com/Bantik/contributor_covenant/blob/master/LICENSE), and is made available under the same MIT License as our software. ### Trademark ## Trademark "Software Carpentry" and the Software Carpentry logo are registered trademarks of Software Carpentry, Ltd. trademarks of [NumFOCUS][numfocus]. [cc-by-human]: https://creativecommons.org/licenses/by/4.0/ [cc-by-legal]: https://creativecommons.org/licenses/by/4.0/legalcode [mit-license]: http://opensource.org/licenses/mit-license.html [numfocus]: http://numfocus.org/ [osi]: http://opensource.org
Makefile +12 −8 Original line number Diff line number Diff line Loading @@ -30,6 +30,14 @@ R_CHUNK_OPTS = tools/chunk-options.R # Default action is to show what commands are available. all : commands ## check : Validate all lesson content against the template. check: $(ALL_MD) python tools/check.py . ## clean : Clean up temporary and intermediate files. clean : @rm -rf $$(find . -name '*~' -print) ## preview : Build website locally for checking. preview : $(DST_ALL) Loading @@ -48,11 +56,6 @@ motivation.html : motivation.md _layouts/slides.revealjs Makefile $(INCLUDES) \ -o $@ $< ## unittest : Run unit test (for Python 2 and 3) unittest: tools/check.py tools/validation_helpers.py tools/test_check.py cd tools/ && python2 test_check.py cd tools/ && python3 test_check.py # Pattern to convert R Markdown to Markdown. %.md: %.Rmd $(R_CHUNK_OPTS) Rscript -e "knitr::knit('$$(basename $<)', output = '$$(basename $@)')" Loading @@ -68,6 +71,7 @@ settings : @echo 'SRC_MD:' $(SRC_MD) @echo 'DST_HTML:' $(DST_HTML) ## clean : Clean up temporary and intermediate files. clean : @rm -rf $$(find . -name '*~' -print) ## unittest : Run internal tests to ensure the validator is working correctly (for Python 2 and 3). unittest: tools/check.py tools/validation_helpers.py tools/test_check.py cd tools/ && python2 test_check.py cd tools/ && python3 test_check.py
tools/check.py +16 −2 Original line number Diff line number Diff line Loading @@ -74,6 +74,19 @@ class MarkdownValidator(object): ast = parser.parse(markdown) return ast def _validate_no_fixme(self): """Validate that the file contains no lines marked 'FIXME' This will be based on the raw markdown, not the ast""" valid = True for i, line in enumerate(self.markdown.splitlines()): if re.search("FIXME", line, re.IGNORECASE): logging.error( "In {0}: " "Line {1} contains FIXME, indicating " "work in progress".format(self.filename, i+1)) valid = False return valid def _validate_hrs(self): """Validate header Loading Loading @@ -418,7 +431,8 @@ class MarkdownValidator(object): Error trapping is handled by the validate() wrapper method. """ tests = [self._validate_doc_headers(), tests = [self._validate_no_fixme(), self._validate_doc_headers(), self._validate_section_heading_order(), self._validate_callouts(), self._validate_links()] Loading Loading @@ -620,7 +634,7 @@ class LicensePageValidator(MarkdownValidator): def _run_tests(self): """Skip the base tests; just check md5 hash""" # TODO: This hash is specific to the license for english-language repo expected_hash = 'cd5742b6596a1f2f35c602ad43fa24b2' expected_hash = '051a04b8ffe580ba6b7018fb4fd72a50' m = hashlib.md5() try: m.update(self.markdown) Loading
tools/test_check.py +11 −0 Original line number Diff line number Diff line Loading @@ -353,6 +353,17 @@ A spacer paragraph """) self.assertFalse(validator._validate_callouts()) def test_fail_if_fixme_present_all_caps(self): """Validation should fail if a line contains the word FIXME (exact)""" validator = self._create_validator("""Incomplete sentence (FIXME).""") self.assertFalse(validator._validate_no_fixme()) def test_fail_if_fixme_present_mixed_case(self): """Validation should fail if a line contains the word FIXME (in any capitalization)""" validator = self._create_validator("""Incomplete sentence (FiXmE).""") self.assertFalse(validator._validate_no_fixme()) class TestTopicPage(BaseTemplateTest): """Verifies that the topic page validator works as expected""" Loading