vhdl-style-guide/vsg/rules/comment/rule_001.py

28 lines
810 B
Python

from vsg import rule
from vsg import check
from vsg import fix
class rule_001(rule.rule):
'''
Comment rule 001 checks consecutive comment lines above a "use" keyword
in a library declaration "use" keyword.
'''
def __init__(self):
rule.rule.__init__(self)
self.name = 'comment'
self.identifier = '001'
self.solution = 'Align comment with "use" keyword.'
self.phase = 4
def _analyze(self, oFile, oLine, iLineNumber):
if oLine.isLibraryUse:
check.indent_of_comments_above(self, oFile, iLineNumber)
def _fix_violations(self, oFile):
for iLineNumber in self.violations:
oFile.lines[iLineNumber].indentLevel = self.dFix['violations'][iLineNumber]
fix.indent(self, oFile.lines[iLineNumber])