diff --git a/docs/ieee_rules.rst b/docs/ieee_rules.rst index 7b6a1cbb..531fe800 100644 --- a/docs/ieee_rules.rst +++ b/docs/ieee_rules.rst @@ -1,4 +1,3 @@ - .. include:: includes.rst IEEE Rules diff --git a/docs/reserved_rules.rst b/docs/reserved_rules.rst index 575a8535..d35ee364 100644 --- a/docs/reserved_rules.rst +++ b/docs/reserved_rules.rst @@ -6,7 +6,7 @@ Reserved Rules reserved_001 ############ -|phase_1| |error| |structure| +|phase_1| |error| |unfixable| |structure| This rule checks for VHDL reserved words being used as identifiers and names. diff --git a/tests/rule_doc/test_rule_doc_gen_main.py b/tests/rule_doc/test_rule_doc_gen_main.py new file mode 100644 index 00000000..9d817376 --- /dev/null +++ b/tests/rule_doc/test_rule_doc_gen_main.py @@ -0,0 +1,34 @@ +# -*- coding: utf-8 -*- +import os +import sys +import unittest +from tempfile import TemporaryDirectory +from unittest import mock + +from vsg import __rule_doc_gen__ + + +class testMain(unittest.TestCase): + def setUp(self): + self._tmpdir = TemporaryDirectory() + + def tearDown(self): + self._tmpdir.cleanup() + + @mock.patch("sys.stdout") + def test_w_user_provided_path(self, mock_stdout): + lExpected = [] + + sys.argv = ["vsg_rule_doc_gen"] + sys.argv.extend(["-p", self._tmpdir.name]) + + try: + __rule_doc_gen__.main() + except SystemExit: + pass + + # Check that the temporary directory is not empty after document + # generation. Detailed checking is left to test_rule_doc. + self.assertNotEqual([], os.listdir(self._tmpdir.name)) + + mock_stdout.write.assert_has_calls(lExpected) diff --git a/vsg/__rule_doc_gen__.py b/vsg/__rule_doc_gen__.py index dfbb8795..416e4689 100644 --- a/vsg/__rule_doc_gen__.py +++ b/vsg/__rule_doc_gen__.py @@ -9,7 +9,11 @@ from . import config, rule_list, vhdlFile def parse_command_line_arguments(): """Parses the command line arguments and returns them.""" - parser = argparse.ArgumentParser(prog="VHDL Style Guide (VSG) Parser", description="""Outputs formatted rule documentation.""") + parser = argparse.ArgumentParser(prog="VHDL Style Guide (VSG) Rule Documentation Generator", description="""Outputs formatted rule documentation.""") + + sDocsPath = os.path.join(os.path.dirname(__file__), "../docs") + + parser.add_argument("-p", "--path", default=sDocsPath, help="Path in which to generate the rule documentation") return parser.parse_args() @@ -21,7 +25,7 @@ def main(): commandLineArguments = parse_command_line_arguments() - create_rule_documentation() + create_rule_documentation(commandLineArguments.path) sys.exit(fExitStatus)