How to use the vsg.utils.get_violation_linenumber function in vsg

To help you get started, we’ve selected a few vsg examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github jeremiah-c-leary / vhdl-style-guide / vsg / rules / function / rule_009.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations[::-1]:
            iLineNumber = utils.get_violation_linenumber(dViolation)
            utils.copy_line(oFile, iLineNumber)
            oLine = oFile.lines[iLineNumber]
            oLine.update_line(oLine.line.split('(')[0] + '(')
            oLine.isFunctionParameter = False
            oLine = oFile.lines[iLineNumber + 1]
            oLine.update_line('  ' + oLine.line.split('(')[1])
            oLine.isFunctionKeyword = False
            oLine.indentLevel = oFile.lines[iLineNumber].indentLevel + 1
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / constant / rule_014.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations:
            iLineNumber = utils.get_violation_linenumber(dViolation)
            sLine = oFile.lines[iLineNumber].line
            sNewLine = ' ' * dViolation['column'] + sLine.strip()
            oFile.lines[iLineNumber].update_line(sNewLine)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / constant / rule_013.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations:
            sWord = dViolation['constant']
            iLineNumber = utils.get_violation_linenumber(dViolation)
            sReplacementWord = get_replacement_word(self, sWord)
            utils.change_word(oFile.lines[iLineNumber], sWord, sReplacementWord, 20)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / component / rule_005.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations:
            iLineNumber = utils.get_violation_linenumber(dViolation)
            oLine = oFile.lines[iLineNumber]
            oLine.update_line(re.sub(r'^(\s*component\s+\w+)', r'\1 is', oLine.lineLower, re.IGNORECASE))
            # Search for "is" on the next line
            fix.replace_is_keyword(oFile, iLineNumber)
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / if_statement / rule_002.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations:
            iLineNumber = utils.get_violation_linenumber(dViolation)
            oLine = oFile.lines[iLineNumber]
            if oLine.isIfKeyword:
                oLine.update_line(re.sub(r'^(\s*)[i|I][f|F]', r'\1if (', oLine.line))
            if oLine.isElseIfKeyword:
                oLine.update_line(re.sub('^(\s*)[e|E][l|L][s|S][i|I][f|F]', r'\1elsif (', oLine.line))
            iThenLineIndex = iLineNumber
            while not oLine.isThenKeyword:
                iThenLineIndex += 1
                oLine = oFile.lines[iThenLineIndex]
            oLine.update_line(re.sub('[t|T][h|H][e|E][n|N]', ') then', oLine.line))
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / instantiation / rule_020.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations[::-1]:
            iLineNumber = utils.get_violation_linenumber(dViolation)
            utils.split_line_after_word(oFile, iLineNumber, '(')
            oFile.lines[iLineNumber].isInstantiationPortAssignment = False
            oFile.lines[iLineNumber + 1].isInstantiationPortKeyword = False
            oFile.lines[iLineNumber + 1].indentLevel += 1
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / port / rule_014.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations[::-1]:
            iLineNumber = utils.get_violation_linenumber(dViolation)
            oFile.lines[iLineNumber].update_line(re.sub(r'\)(\s*);', r' \1 ', oFile.lines[iLineNumber].line))
            oFile.lines[iLineNumber].isEndPortMap = False
            oFile.lines[iLineNumber].indentLevel += 1
            oFile.lines.insert(iLineNumber + 1, line.line('  );'))
            oFile.lines[iLineNumber + 1].isEndPortMap = True
            oFile.lines[iLineNumber + 1].insidePortMap = True
            oFile.lines[iLineNumber + 1].insideEntity = oFile.lines[iLineNumber].insideEntity
            oFile.lines[iLineNumber + 1].indentLevel = oFile.lines[iLineNumber].indentLevel - 1
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / process / rule_015.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations[::-1]:
            fix.insert_blank_line_above(self, oFile, utils.get_violation_linenumber(dViolation))
github jeremiah-c-leary / vhdl-style-guide / vsg / rules / process / rule_012.py View on Github external
def _fix_violations(self, oFile):
        for dViolation in self.violations:
            oLine = utils.get_violating_line(oFile, dViolation)
            iInsertIndex = oLine.line.rfind(')')
            oLine.update_line(oLine.line[:iInsertIndex + 1] + ' is ' + oLine.line[iInsertIndex + 1:])
            oLine.isProcessIs = True
            search_for_and_remove_extraneous_is(oFile, utils.get_violation_linenumber(dViolation))