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

28 lines
737 B
Python

from vsg import rule
import re
class rule_019(rule.rule):
'''
Component rule 019 checks for comments after port and generic assignments.
'''
def __init__(self):
rule.rule.__init__(self)
self.name = 'component'
self.identifier = '019'
self.solution = 'Remove comment.'
self.phase = 1
def _analyze(self, oFile, oLine, iLineNumber):
if oLine.insideComponent and oLine.hasInlineComment:
self.add_violation(iLineNumber)
def _fix_violations(self, oFile):
for iLineNumber in self.violations:
oLine = oFile.lines[iLineNumber]
oLine.update_line(re.sub('\s*--.*', '', oLine.line))
oLine.hasInlineComment = False