diff --git a/docs/variable_rules.rst b/docs/variable_rules.rst index 8d060e62..94542d94 100644 --- a/docs/variable_rules.rst +++ b/docs/variable_rules.rst @@ -172,7 +172,9 @@ This rule checks the alignment of colons over multiple lines in the architecture variable_010 ############ -This rule checks the variable type is lowercase. +This rule checks the variable type has proper case. + +.. NOTE:: The default is lowercase. **Violation** diff --git a/vsg/rules/variable/rule_001.py b/vsg/rules/variable/rule_001.py index 42d05102..dff861a2 100644 --- a/vsg/rules/variable/rule_001.py +++ b/vsg/rules/variable/rule_001.py @@ -4,7 +4,7 @@ from vsg.rules import indent_rule class rule_001(indent_rule): ''' - Signal rule 001 checks for the proper indentation at the beginning of the line. + Variable rule 001 checks for the proper indentation at the beginning of the line. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_002.py b/vsg/rules/variable/rule_002.py index 38a155e9..d05b821f 100644 --- a/vsg/rules/variable/rule_002.py +++ b/vsg/rules/variable/rule_002.py @@ -5,7 +5,7 @@ from vsg import utils class rule_002(case_rule): ''' - Signal rule 002 checks the "variable" keyword has proper case. + Variable rule 002 checks the "variable" keyword has proper case. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_003.py b/vsg/rules/variable/rule_003.py index 4ab291f0..20f95c6f 100644 --- a/vsg/rules/variable/rule_003.py +++ b/vsg/rules/variable/rule_003.py @@ -4,7 +4,7 @@ from vsg.rules import single_space_after_rule class rule_003(single_space_after_rule): ''' - Signal rule 003 checks there is a single space after the "variable" keyword. + Variable rule 003 checks there is a single space after the "variable" keyword. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_005.py b/vsg/rules/variable/rule_005.py index 0df66b3d..9bc4afcd 100644 --- a/vsg/rules/variable/rule_005.py +++ b/vsg/rules/variable/rule_005.py @@ -4,7 +4,7 @@ from vsg.rules import single_space_after_character_rule class rule_005(single_space_after_character_rule): ''' - Signal rule 005 checks there is a single space after the colon. + Variable rule 005 checks there is a single space after the colon. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_006.py b/vsg/rules/variable/rule_006.py index 4adcea33..4c4b1e7a 100644 --- a/vsg/rules/variable/rule_006.py +++ b/vsg/rules/variable/rule_006.py @@ -4,7 +4,7 @@ from vsg.rules import single_space_before_character_rule class rule_006(single_space_before_character_rule): ''' - Signal rule 006 checks there is at least a single space before the colon. + Variable rule 006 checks there is at least a single space before the colon. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_007.py b/vsg/rules/variable/rule_007.py index 31bdff4c..32104c69 100644 --- a/vsg/rules/variable/rule_007.py +++ b/vsg/rules/variable/rule_007.py @@ -4,7 +4,7 @@ from vsg import rule class rule_007(rule.rule): ''' - Signal rule 007 checks for default assignments in variable declarations. + Variable rule 007 checks for default assignments in variable declarations. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_009.py b/vsg/rules/variable/rule_009.py index eb9fc5ff..214a36b3 100644 --- a/vsg/rules/variable/rule_009.py +++ b/vsg/rules/variable/rule_009.py @@ -4,7 +4,7 @@ from vsg.rules import keyword_alignment_rule class rule_009(keyword_alignment_rule): ''' - Signal rule 009 checks the colons are in the same column for all variables. + Variable rule 009 checks the colons are in the same column for all variables. ''' def __init__(self): diff --git a/vsg/rules/variable/rule_010.py b/vsg/rules/variable/rule_010.py index 28fb17ae..d449ede6 100644 --- a/vsg/rules/variable/rule_010.py +++ b/vsg/rules/variable/rule_010.py @@ -1,36 +1,16 @@ -from vsg import rule -from vsg import fix -from vsg import check - -import re +from vsg.rules import case_rule +from vsg import utils -class rule_010(rule.rule): +class rule_010(case_rule): ''' - Signal rule 010 checks the variable type is lowercase. + Variable rule 010 checks the variable type has proper case. ''' def __init__(self): - rule.rule.__init__(self, 'variable', '010') - self.solution = 'Change variable type to lowercase.' - self.phase = 6 + case_rule.__init__(self, 'variable', '010', 'isVariable') + self.solution = 'Change variable type name to ' - def _analyze(self, oFile, oLine, iLineNumber): - if oLine.isVariable: - if re.match('^\s*variable\s+.*:\s*\w', oLine.lineLower): - sLine = oLine.line.split(':')[1].lstrip().rstrip().replace(';', '') - sLine = re.sub('range\s+.*$', ' ', sLine) - if '(' in sLine: - check.is_lowercase(self, sLine.split('(')[0], iLineNumber) - else: - check.is_lowercase(self, sLine, iLineNumber) - - def _fix_violations(self, oFile): - for iLineNumber in self.violations: - oLine = oFile.lines[iLineNumber] - sLine = oLine.line.split(':')[1].lstrip().rstrip().replace(';', '') - if '(' in sLine: - fix.lower_case(oFile.lines[iLineNumber], sLine.split('(')[0]) - else: - fix.lower_case(oFile.lines[iLineNumber], sLine) + def _extract(self, oLine): + return utils.extract_type_name(oLine) diff --git a/vsg/rules/variable/rule_011.py b/vsg/rules/variable/rule_011.py index ee531855..10b9257e 100644 --- a/vsg/rules/variable/rule_011.py +++ b/vsg/rules/variable/rule_011.py @@ -5,7 +5,7 @@ from vsg import utils class rule_011(rule.rule): ''' - General rule 011 checks capitalization consistency of variable names. + Variable rule 011 checks capitalization consistency of variable names. ''' def __init__(self):