vhdl-style-guide/vsg/rules/component/rule_007.py

25 lines
776 B
Python

from vsg import rule
from vsg import check
from vsg import fix
class rule_007(rule.rule):
'''Component rule 007 checks for a single space before the "is" keyword.'''
def __init__(self):
rule.rule.__init__(self)
self.name = 'component'
self.identifier = '007'
self.solution = 'Remove extra spaces before "is" keyword.'
self.phase = 2
def _analyze(self, oFile, oLine, iLineNumber):
if oLine.isComponentDeclaration and len(oLine.line.split()) > 2:
check.is_single_space_before(self, 'is', oLine, iLineNumber)
def _fix_violations(self, oFile):
for iLineNumber in self.violations:
oLine = oFile.lines[iLineNumber]
fix.enforce_one_space_before_word(self, oLine, 'is')