Issue-1225 vsg_rule_doc_gen script does not run. (#1226)

* Issue#1225: Corrected tool name in help message for vsg_rule_doc_gen.

* Issue#1225: Added path argument to vsg_rule_doc_gen.

* Issue#1225: Passed path argument to top-level function in vsg_rule_doc_gen.

* Issue#1225: Updated reserved_rules documentation.

* Issue#1225: Updated ieee_rules documentation.

* Issue#1225: Whitespace changes.

* Issue#1225: Simple test added for the main function in vsg_rule_doc_gen.

* Issue#1225: Whitespace changes to appease black formatter.
This commit is contained in:
JHertz5 2024-09-09 01:51:31 +01:00 committed by GitHub
parent 49a4924be3
commit c5bf334136
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 41 additions and 4 deletions

View File

@ -1,4 +1,3 @@
.. include:: includes.rst
IEEE Rules

View File

@ -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.

View File

@ -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)

View File

@ -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)