diff --git a/vsg/rules/entity/rule_016.py b/vsg/rules/entity/rule_016.py index ae8301d1..74cc4891 100644 --- a/vsg/rules/entity/rule_016.py +++ b/vsg/rules/entity/rule_016.py @@ -1,12 +1,15 @@ -from vsg.rules import remove_blank_lines_above_rule +from vsg.rules import remove_blank_lines_above_item_rule + +from vsg.token import entity as token -class rule_016(remove_blank_lines_above_rule): +class rule_016(remove_blank_lines_above_item_rule): ''' Entity rule 016 checks for a blank line above the "end entity" keywords. ''' def __init__(self): - remove_blank_lines_above_rule.__init__(self, 'entity', '016', 'isEndEntityDeclaration') - self.solution = 'Remove blank line(s) above "end entity" keywords.' + remove_blank_lines_above_item_rule.__init__(self, 'entity', '016', token.end_keyword, 0) + self.regionBegin = token.end_keyword + self.regionEnd = token.end_keyword diff --git a/vsg/tests/entity/test_rule_entity.py b/vsg/tests/entity/test_rule_entity.py index 454c7a53..5d2f21b9 100644 --- a/vsg/tests/entity/test_rule_entity.py +++ b/vsg/tests/entity/test_rule_entity.py @@ -197,9 +197,9 @@ class testRuleEntityMethods(unittest.TestCase): self.assertEqual(oRule.name, 'entity') self.assertEqual(oRule.identifier, '016') - dExpected = utils.add_violation_list([33,146]) + lExpected = [33,146] oRule.analyze(oFile) - self.assertEqual(oRule.violations, dExpected) + self.assertEqual(lExpected, utils.extract_violation_lines(oRule.violations)) def test_rule_017(self): oRule = entity.rule_017() diff --git a/vsg/vhdlFile/vhdlFile.py b/vsg/vhdlFile/vhdlFile.py index 3188b668..b979ca48 100644 --- a/vsg/vhdlFile/vhdlFile.py +++ b/vsg/vhdlFile/vhdlFile.py @@ -389,6 +389,10 @@ class vhdlFile(): dIndent['insideContextDeclaration'] = False dIndent['level'] = 0 for oLine in self.lines: + + if len(oLine.objects) == 0: + continue + if _does_line_start_with_item_or_whitespace_and_then_item(oLine, parser.context_keyword): oLine.indentLevel = 0 dIndent['insideContextDeclaration'] = True @@ -415,9 +419,6 @@ class vhdlFile(): dIndent['level'] = 1 oLine.indentLevel = 0 - if len(oLine.objects) == 0: - continue - if _does_line_start_with_item_or_whitespace_and_then_item(oLine, constant_declaration.assignment_expression): if type(oLine.objects[0]) == constant_declaration.assignment_expression: if oLine.objects[0].get_value() == '(':