diff --git a/docs/process_rules.rst b/docs/process_rules.rst index 1cf0c787..7789f57d 100644 --- a/docs/process_rules.rst +++ b/docs/process_rules.rst @@ -74,7 +74,9 @@ This rule checks the indent of the **begin** keyword. process_004 ########### -This rule checks the begin keyword is lowercase. +This rule checks the **begin** keyword has proper case. + +.. NOTE:: The default is lowercase. **Violation** @@ -97,7 +99,9 @@ This rule checks the begin keyword is lowercase. process_005 ########### -This rule checks the process keyword is lowercase. +This rule checks the **process** keyword has proper case. + +.. NOTE:: The default is lowercase. **Violation** @@ -160,7 +164,7 @@ process_008 This rule checks the **end** keyword has proper case. -.. NOTE:: The default is lowercase. +.. NOTE:: The default is lowercase. Refer to the section `Configuring Uppercase and Lowercase Rules `_ for information on changing the default case. @@ -179,7 +183,9 @@ This rule checks the **end** keyword has proper case. process_009 ########### -This rule checks the **process** keyword is lowercase in the **end process** line. +This rule checks the **process** keyword has proper case in the **end process** line. + +.. NOTE:: The default is lowercase. **Violation** @@ -271,7 +277,9 @@ This rule checks for the existence of the **is** keyword on the same line as the process_013 ########### -This rule checks the **is** keyword is lowercase. +This rule checks the **is** keyword has proper case. + +.. NOTE:: The default is lowercase. **Violation** @@ -366,7 +374,9 @@ This rule checks the process has a label. process_017 ########### -This rule checks the process label is uppercase. +This rule checks the process label has proper case. + +.. NOTE:: The default is uppercase. **Violation** diff --git a/vsg/rules/process/rule_004.py b/vsg/rules/process/rule_004.py index 6d102d07..a3251467 100644 --- a/vsg/rules/process/rule_004.py +++ b/vsg/rules/process/rule_004.py @@ -1,26 +1,16 @@ -from vsg import rule +from vsg.rules import case_rule from vsg import utils -from vsg import fix -from vsg import check -class rule_004(rule.rule): +class rule_004(case_rule): ''' - Process rule 004 checks the "begin" keyword is lower case. + Process rule 004 checks the "begin" keyword has proper case. ''' def __init__(self): - rule.rule.__init__(self) - self.name = 'process' - self.identifier = '004' - self.solution = 'Lowercase the "begin" keyword.' - self.phase = 6 + case_rule.__init__(self, 'process', '004', 'isProcessBegin') + self.solution = 'Change "begin" keyword to ' - def _analyze(self, oFile, oLine, iLineNumber): - if oLine.isProcessBegin: - check.is_lowercase(self, utils.get_first_word(oLine), iLineNumber) - - def _fix_violations(self, oFile): - for iLineNumber in self.violations: - fix.lower_case(oFile.lines[iLineNumber], 'begin') + def _extract(self, oLine): + return utils.extract_words(oLine, ['begin']) diff --git a/vsg/rules/process/rule_005.py b/vsg/rules/process/rule_005.py index 16f65021..6a19d36a 100644 --- a/vsg/rules/process/rule_005.py +++ b/vsg/rules/process/rule_005.py @@ -1,24 +1,16 @@ -from vsg import rule -from vsg import fix - -import re +from vsg.rules import case_rule +from vsg import utils -class rule_005(rule.rule): +class rule_005(case_rule): ''' - Process rule 004 checks the "process" keyword is lower case. + Process rule 004 checks the "process" keyword has proper case. ''' def __init__(self): - rule.rule.__init__(self, 'process', '005') - self.solution = 'Lowercase the "process" keyword.' - self.phase = 6 + case_rule.__init__(self, 'process', '005', 'isProcessKeyword') + self.solution = 'Change "process" keyword to ' - def _analyze(self, oFile, oLine, iLineNumber): - if oLine.isProcessKeyword and not re.match('^\s*.*process', oLine.line): - self.add_violation(iLineNumber) - - def _fix_violations(self, oFile): - for iLineNumber in self.violations: - fix.lower_case(oFile.lines[iLineNumber], 'process') + def _extract(self, oLine): + return utils.extract_words(oLine, ['process']) diff --git a/vsg/rules/process/rule_009.py b/vsg/rules/process/rule_009.py index 65785161..c156e3e4 100644 --- a/vsg/rules/process/rule_009.py +++ b/vsg/rules/process/rule_009.py @@ -1,24 +1,16 @@ -from vsg import rule -from vsg import fix - -import re +from vsg.rules import case_rule +from vsg import utils -class rule_009(rule.rule): +class rule_009(case_rule): ''' - Process rule 009 checks the "process" keyword is lowercase on the closing of a process. + Process rule 009 checks the "process" keyword has proper case on the closing of a process. ''' def __init__(self): - rule.rule.__init__(self, 'process', '009') - self.solution = 'Lowercase the "process" keyword.' - self.phase = 6 + case_rule.__init__(self, 'process', '009', 'isEndProcess') + self.solution = 'Change "process" keyword to ' - def _analyze(self, oFile, oLine, iLineNumber): - if oLine.isEndProcess and not re.match('^\s*\w+\s+process', oLine.line): - self.add_violation(iLineNumber) - - def _fix_violations(self, oFile): - for iLineNumber in self.violations: - fix.lower_case(oFile.lines[iLineNumber], 'process') + def _extract(self, oLine): + return utils.extract_words(oLine, ['process']) diff --git a/vsg/rules/process/rule_013.py b/vsg/rules/process/rule_013.py index 42893640..44c85c69 100644 --- a/vsg/rules/process/rule_013.py +++ b/vsg/rules/process/rule_013.py @@ -1,25 +1,16 @@ -from vsg import rule -from vsg import fix - -import re +from vsg.rules import case_rule +from vsg import utils -class rule_013(rule.rule): +class rule_013(case_rule): ''' - Process rule 013 checks the "is" keyword is lowercase. + Process rule 013 checks the "is" keyword has proper case. ''' def __init__(self): - rule.rule.__init__(self, 'process', '013') - self.solution = 'Lowercase "is" keyword.' - self.phase = 6 + case_rule.__init__(self, 'process', '013', 'isSensitivityListEnd') + self.solution = 'Change "is" keyword to ' - def _analyze(self, oFile, oLine, iLineNumber): - if oLine.isSensitivityListEnd and re.match('^.*\)\s*is', oLine.lineLower): - if not re.match('^.*\)\s*is', oLine.line): - self.add_violation(iLineNumber) - - def _fix_violations(self, oFile): - for iLineNumber in self.violations: - fix.lower_case(oFile.lines[iLineNumber], 'is') + def _extract(self, oLine): + return utils.extract_words(oLine, ['is']) diff --git a/vsg/rules/process/rule_017.py b/vsg/rules/process/rule_017.py index fae3dba0..18c13444 100644 --- a/vsg/rules/process/rule_017.py +++ b/vsg/rules/process/rule_017.py @@ -1,25 +1,17 @@ -from vsg import rule -from vsg import check -from vsg import fix +from vsg.rules import case_rule +from vsg import utils -class rule_017(rule.rule): +class rule_017(case_rule): ''' - Process rule 017 checks the process label is uppercase. + Process rule 017 checks the process label has proper case. ''' def __init__(self): - rule.rule.__init__(self, 'process', '017') - self.solution = 'Uppercase process label.' - self.phase = 6 + case_rule.__init__(self, 'process', '017', 'isProcessLabel') + self.case = 'upper' + self.solution = 'Change label name to ' - def _analyze(self, oFile, oLine, iLineNumber): - if oLine.isProcessLabel: - lLine = oLine.line.split(':') - check.is_uppercase(self, lLine[0], iLineNumber) - - def _fix_violations(self, oFile): - for iLineNumber in self.violations: - lLine = oFile.lines[iLineNumber].line.split(':') - fix.upper_case(oFile.lines[iLineNumber], lLine[0].rstrip().lstrip()) + def _extract(self, oLine): + return utils.extract_label(oLine)