Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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
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)
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)
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)
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))
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
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
def _fix_violations(self, oFile):
for dViolation in self.violations[::-1]:
fix.insert_blank_line_above(self, oFile, utils.get_violation_linenumber(dViolation))
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))