Merge pull request #640 from jeremiah-c-leary/issue-636

Issue 636
This commit is contained in:
Jeremiah Leary 2021-10-19 05:57:36 -05:00 committed by GitHub
commit 71ccbf7cb0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 47 additions and 0 deletions

View File

@ -354,6 +354,7 @@ class rule_list():
dTemp = {}
dTemp['rule'] = oRule.unique_id
dTemp['linenumber'] = oViolation.get_line_number()
dTemp['severity'] = oRule.severity.name
dTemp['solution'] = oViolation.get_solution()
dReturn['violations'].append(dTemp)
return dReturn

View File

@ -0,0 +1,34 @@
{
"files": [
{
"file_path": "vsg/tests/vsg/entity2.vhd",
"violations": [
{
"rule": "port_008",
"linenumber": 8,
"severity": "Error",
"solution": "Change the number of spaces after the *out* keyword to three spaces."
}
]
},
{
"file_path": "vsg/tests/vsg/entity_architecture.fixed.vhd",
"violations": []
},
{
"file_path": "vsg/tests/vsg/entity_architecture.vhd",
"violations": []
},
{
"file_path": "vsg/tests/vsg/entity1.vhd",
"violations": [
{
"rule": "port_007",
"linenumber": 7,
"severity": "Error",
"solution": "Change the number of spaces after the *in* keyword to four spaces."
}
]
}
]
}

View File

@ -397,6 +397,18 @@ class testMain(unittest.TestCase):
self.assertTrue(os.path.isfile('deleteme.json'))
# Read in the expected JSON file for comparison
lExpected = []
utils.read_file(os.path.join(os.path.dirname(__file__),'json-expected.json'), lExpected)
# Read in the actual JSON file for comparison
lActual = []
utils.read_file(os.path.join('deleteme.json'), lActual)
self.assertEqual(len(lExpected), len(lActual))
for sActual, sExpected in zip(lActual, lExpected):
self.assertEqual(sActual, sExpected)
@mock.patch('sys.stdout')
def test_backup_file(self, mock_stdout):