Refactoring fix violations to not require _fix_violations in the rule if the rule is not fixable.

This commit is contained in:
Jeremiah C Leary 2017-12-01 05:39:58 -06:00
parent 6aee8bad9b
commit fe0fb074e9
4 changed files with 10 additions and 14 deletions

View File

@ -44,23 +44,16 @@ class rule():
return 0
def fix(self, oFile):
self.analyze(oFile)
self._fix_violations(oFile)
self.violations = []
self.dFix = {}
self.dFix['violations'] = {}
def _fix_violations(self, oFile):
return
if self.fixable:
self.analyze(oFile)
self._fix_violations(oFile)
self.violations = []
self.dFix = {}
self.dFix['violations'] = {}
def add_violation(self, lineNumber):
self.violations.append(lineNumber)
# def _clear_violations(self):
# self.violations = []
# self.dFix = {}
# self.dFix['violations'] = {}
def _configure_global_rule_attributes(self, dConfiguration):
try:
for sAttributeName in dConfiguration['rule']['global']:

View File

@ -10,6 +10,7 @@ class rule_005(architecture_rule):
self.identifier = '005'
self.solution = 'Ensure "of" keyword is on the same line as the "architecture" keyword.'
self.phase = 1
self.fixable = False # There is an example of this for entity
def analyze(self, oFile):
for iLineNumber, oLine in enumerate(oFile.lines):

View File

@ -10,6 +10,7 @@ class rule_006(architecture_rule):
self.identifier = '006'
self.solution = 'Ensure "is" keyword is on the same line as the "architecture" keyword.'
self.phase = 1
self.fixable = False # There is an example of this for entity
def analyze(self, oFile):
for iLineNumber, oLine in enumerate(oFile.lines):

View File

@ -10,8 +10,9 @@ class rule_016(generic_rule):
def __init__(self):
generic_rule.__init__(self)
self.identifier = '016'
self.solution = 'Move multiple generates to their own lines.'
self.solution = 'Move multiple generics to their own lines.'
self.phase = 1
self.fixable = False # Need to figure out how to fix this
def analyze(self, oFile):
for iLineNumber, oLine in enumerate(oFile.lines):