from vsg.rules.variable import variable_rule from vsg import line from vsg import fix from vsg import check class rule_009(variable_rule): ''' Signal rule 009 checks the colons are in the same column for all variables. ''' def __init__(self): variable_rule.__init__(self) self.identifier = '009' self.solution = 'Align colon with right most colon.' self.phase = 5 def analyze(self, oFile): lGroup = [] fGroupFound = False iStartGroupIndex = None for iLineNumber, oLine in enumerate(oFile.lines): if oLine.isArchitectureKeyword and not fGroupFound: fGroupFound = True iStartGroupIndex = iLineNumber if oLine.isEndArchitecture: lGroup.append(oLine) fGroupFound = False check.keyword_alignment(self, iStartGroupIndex, ':', lGroup) lGroup = [] iStartGroupIndex = None if fGroupFound: if oLine.isVariable: lGroup.append(oLine) else: lGroup.append(line.line('Removed line')) def _fix_violations(self, oFile): fix.keyword_alignment(self, oFile)