Fixed issue where multiline types were not split correctly.
This commit is contained in:
parent
e3fcc508fc
commit
0fc7e511fb
|
|
@ -1,5 +1,6 @@
|
|||
|
||||
from vsg import rule
|
||||
from vsg import utilities
|
||||
|
||||
import re
|
||||
import copy
|
||||
|
|
@ -20,15 +21,12 @@ class rule_009(rule.rule):
|
|||
def analyze(self, oFile):
|
||||
for iLineNumber, oLine in enumerate(oFile.lines):
|
||||
if oLine.isTypeKeyword and not oLine.isTypeEnd:
|
||||
if re.match('^.*\sis\s*\(\w', oLine.lineLower):
|
||||
if re.match('^.*\sis\s*\(\s*\w', oLine.lineLower):
|
||||
self.add_violation(iLineNumber)
|
||||
|
||||
def _fix_violations(self, oFile):
|
||||
for iLineNumber in self.violations[::-1]:
|
||||
oFile.lines.insert(iLineNumber + 1, copy.deepcopy(oFile.lines[iLineNumber]))
|
||||
oLine = oFile.lines[iLineNumber]
|
||||
oLine.update_line(oLine.line.split('(')[0] + ' (')
|
||||
utilities.split_line_after_word(oFile, iLineNumber, '(')
|
||||
oLine = oFile.lines[iLineNumber + 1]
|
||||
oLine.update_line(' ' + oLine.line.split('(')[1])
|
||||
oLine.isTypeKeyword = False
|
||||
oLine.indentLevel += 1
|
||||
|
|
|
|||
|
|
@ -6,10 +6,13 @@ sys.path.append('vsg')
|
|||
|
||||
from vsg.rules import type
|
||||
from vsg import vhdlFile
|
||||
from vsg.tests import utils
|
||||
|
||||
|
||||
# Read in test file used for all tests
|
||||
oFile = vhdlFile.vhdlFile(os.path.join(os.path.dirname(__file__),'..','type','type_test_input.vhd'))
|
||||
|
||||
|
||||
class testFixRuleSignalMethods(unittest.TestCase):
|
||||
|
||||
def test_fix_rule_001(self):
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ architecture ARCH of ENTITY1 is
|
|||
|
||||
type a is (B, C, D, E ,F, G);
|
||||
|
||||
type a is (B, C,
|
||||
type a is ( B, C,
|
||||
D, E,
|
||||
-- This is a comment
|
||||
F, G);
|
||||
|
|
|
|||
Loading…
Reference in New Issue