Issue#1117 Modifed initialisation of the `Rule` class's `name` and `identifier` attributes to reduce duplication. (#1118)

* Issue#1117 Modifed initialisation of the `Rule` class's `identifier` property to reduce duplication.

* Issue#1117 Modifed initialisation of the `Rule` class's `unique_id` property to make the `identifier` input redundant.

* Issue#1117: Updated Rule.name attribute to be initialised from the class's `__module__` variable.
Modified `deprecated_rule` to not initialise `name` and `identifier` attributes.
Modified rule_localized_001 to force the local rule's `name` since this can't be extracted from the module.
Modified test_rule to force Rule's `name`, `identifier` and `unique_id` in some tests.

* Issue#1117: Removed now-redundant name and identifier input arguments on rule `__init__` methods.
Updated rule_localized_001 to force the rule's name.
Update the local rules documentation.

* Issue#1117: Removed unused exception in get_rule_name.

* Issue#1117: Updates after merging master.

* Converting match case to if statement to support python pre version 3.10Converting match case to if statement to support python pre version 3.10.

---------

Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
This commit is contained in:
JHertz5 2024-02-04 21:23:23 +00:00 committed by GitHub
parent a8bff26024
commit 431cdb92c5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
989 changed files with 1146 additions and 1101 deletions

View File

@ -47,7 +47,8 @@ Since this is the first rule, we will number it **001**.
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
Referencing the :doc:`phases`, we decide it should be in phase 1: structural.
@ -59,7 +60,8 @@ Referencing the :doc:`phases`, we decide it should be in phase 1: structural.
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
self.phase = 1
Now we need to add the **analyze** method to perform the check.
@ -72,7 +74,8 @@ Now we need to add the **analyze** method to perform the check.
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
self.phase = 1
def analyze(self, oFile):
@ -89,7 +92,8 @@ We are ready to write the body of the **analyze** method:
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
self.phase = 1
def analyze(self, oFile):
@ -115,7 +119,8 @@ We will tell VSG the rule is not fixable.
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
self.phase = 1
self.fixable = False # User must split the file
@ -133,7 +138,8 @@ We also need to provide a solution to the user so they will know how to fix the
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
self.phase = 1
@ -154,7 +160,8 @@ Finally, we need to add a code tag check so the rule can be disabled via comment
class rule_001(rule.rule):
def __init__(self):
rule.rule.__init__(self, 'localized', '001')
rule.rule.__init__(self)
self.name = 'localized'
self.phase = 1
self.fixable = False # User must split the file
self.solution = 'Split entity and architecture into seperate files.'

View File

@ -11,8 +11,8 @@ from vsg.rules import utils as rules_utils
class Rule(structure.Rule):
def __init__(self, name, identifier):
structure.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
structure.Rule.__init__(self)
self.fixable = False
self.disable = True

View File

@ -4,8 +4,8 @@ from vsg import rule
class Rule(rule.Rule):
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.fixable = False
self.disable = True
self.phase = 0

View File

@ -4,8 +4,8 @@ from vsg import rule
class Rule(rule.Rule):
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.fixable = False
self.disable = True
self.phase = 0

View File

@ -6,10 +6,10 @@ from vsg import utils
class Rule():
def __init__(self, name=None, identifier=None):
self.name = name
self.identifier = identifier
self.unique_id = str(name) + '_' + str(identifier)
def __init__(self):
self.name = get_rule_name(self)
self.identifier = get_rule_identifier(self)
self.unique_id = str(self.name) + '_' + str(self.identifier)
self.solution = None
self.violations = []
self.indentStyle = 'spaces'
@ -264,3 +264,36 @@ def configure_rule_attributes(self, oConfig):
oOption.value = oConfig.dConfig['rule'][self.get_unique_id()][sAttributeName]
except KeyError:
pass
def get_rule_identifier(self):
'''
Extracts the rule's identifier from the name of the class.
'''
sReturn = None
if self.__class__.__name__.startswith('rule_'):
sReturn = self.__class__.__name__[-3:]
return sReturn
def get_rule_name(self):
'''
Extracts the rule's name from the name of the module.
'''
sReturn = None
if self.__module__.startswith('vsg.rules.'):
rule_group_name = self.__module__.split('.')[2]
# Cater for exceptions where the name of the rule doesn't match the name of the module.
if rule_group_name == 'assert_statement':
sReturn = 'assert'
elif rule_group_name == 'file_statement':
sReturn = 'file'
elif rule_group_name == 'if_statement':
sReturn = 'if'
elif rule_group_name == 'ranges':
sReturn = 'range'
elif rule_group_name == 'type_definition':
sReturn = 'type'
elif rule_group_name == 'with_statement':
sReturn = 'with'
else:
sReturn = rule_group_name
return sReturn

View File

@ -16,8 +16,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 5
self.groups.append('alignment')
self.configuration_documentation_link = 'configuring_keyword_alignment_rules_link'

View File

@ -16,8 +16,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 3
self.groups.append('blank_line')
self.configuration_documentation_link = 'configuring_blank_lines_link'

View File

@ -16,8 +16,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 6
self.groups.append('case')
self.configuration_documentation_link = 'configuring_uppercase_and_lowercase_rules_link'

View File

@ -16,7 +16,7 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 4
self.groups.append('indent')

View File

@ -17,8 +17,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 7
self.fixable = False
self.groups.append('length')

View File

@ -16,8 +16,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 7
self.groups.append('naming')
self.configuration_documentation_link = 'configuring_prefix_and_suffix_rules_link'

View File

@ -16,8 +16,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 1
self.groups.append('structure')
self.configuration_documentation_link = 'configuring_simple_multiline_structure_rules_link'

View File

@ -16,8 +16,8 @@ class Rule(rule.Rule):
unique identifier. Usually in the form of 00N.
'''
def __init__(self, name, identifier):
rule.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
rule.Rule.__init__(self)
self.phase = 2
self.groups.append('whitespace')
self.configuration_documentation_link = 'configuring_whitespace_rules_link'

View File

@ -70,7 +70,7 @@ class rule_001(structure.Rule):
'''
def __init__(self):
structure.Rule.__init__(self, 'after', '001')
structure.Rule.__init__(self)
self.disable = True
self.oStart = oStart
self.oEnd = oEnd

View File

@ -60,7 +60,7 @@ class rule_002(alignment.Rule):
'''
def __init__(self):
alignment.Rule.__init__(self, 'after', '002')
alignment.Rule.__init__(self)
self.solution = 'Align **after** keyword.'
self.disable = True
self.subphase = 2

View File

@ -61,7 +61,7 @@ class rule_003(structure.Rule):
'''
def __init__(self):
structure.Rule.__init__(self, 'after', '003')
structure.Rule.__init__(self)
self.disable = True
self.oStart = oStart
self.oEnd = oEnd

View File

@ -26,5 +26,5 @@ class rule_001(Rule):
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '001', lTokens)
Rule.__init__(self, lTokens)
self.solution = 'Move *alias* keyword and code after end to the next line'

View File

@ -25,4 +25,4 @@ class rule_100(Rule):
alias alias_designator : subtype_indication is name;
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '100', [token.colon])
Rule.__init__(self, [token.colon])

View File

@ -25,6 +25,6 @@ class rule_101(Rule):
alias alias_designator is name;
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '101')
Rule.__init__(self)
self.oFirstToken = token.is_keyword
self.oExceptToken = token.colon

View File

@ -26,4 +26,4 @@ class rule_102(Rule):
alias alias_designator is name;
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '102', lTokens)
Rule.__init__(self, lTokens)

View File

@ -23,7 +23,7 @@ class rule_103(Rule):
alias alias_designator is name;
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '103')
Rule.__init__(self)
self.disable = True
self.left_token = token.alias_keyword
self.right_token = token.alias_designator

View File

@ -29,4 +29,4 @@ class rule_300(Rule):
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '300', lTokens)
Rule.__init__(self, lTokens)

View File

@ -27,5 +27,5 @@ class rule_500(token_case):
'''
def __init__(self):
token_case.__init__(self, 'alias_declaration', '500', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -27,5 +27,5 @@ class rule_501(token_case):
'''
def __init__(self):
token_case.__init__(self, 'alias_declaration', '501', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -27,5 +27,5 @@ class rule_502(token_case_with_prefix_suffix):
'''
def __init__(self):
token_case_with_prefix_suffix.__init__(self, 'alias_declaration', '502', lTokens)
token_case_with_prefix_suffix.__init__(self, lTokens)
self.groups.append('case::name')

View File

@ -73,5 +73,5 @@ class rule_503(Rule):
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '503', lTokens, lNames)
Rule.__init__(self, lTokens, lNames)
self.bIncludeDeclarativePartNames = True

View File

@ -31,6 +31,6 @@ class rule_600(Rule):
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '600', lTokens)
Rule.__init__(self, lTokens)
self.prefixes = ['a_']
self.solution = 'Alias designators'

View File

@ -31,6 +31,6 @@ class rule_601(Rule):
'''
def __init__(self):
Rule.__init__(self, 'alias_declaration', '601', lTokens)
Rule.__init__(self, lTokens)
self.suffixes = ['_a']
self.solution = 'Alias designators'

View File

@ -11,8 +11,8 @@ class align_consecutive_lines_after_line_starting_with_token_and_stopping_with_t
'''
'''
def __init__(self, name, identifier):
alignment.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self):
alignment.Rule.__init__(self)
self.alignment = 'report'
self.configuration.append('alignment')
self.phase = 4

View File

@ -25,8 +25,8 @@ class align_consecutive_lines_starting_with_a_comment_above_line_starting_with_t
reference token to align comments with
'''
def __init__(self, name, identifier, token, bIncrement=False):
alignment.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self, token, bIncrement=False):
alignment.Rule.__init__(self)
self.phase = 4
self.subphase = 2
self.token = token

View File

@ -30,8 +30,8 @@ class align_left_token_with_right_token_if_right_token_starts_a_line(alignment.R
The second token that defines the region
'''
def __init__(self, name, identifier, left_token, right_token):
alignment.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self, left_token, right_token):
alignment.Rule.__init__(self)
self.left_token = left_token
self.right_token = right_token
self.configuration.append('align_to')

View File

@ -32,8 +32,8 @@ class align_tokens_in_region_between_tokens(alignment.Rule):
The second token that defines the region
'''
def __init__(self, name, identifier, lTokens, left_token, right_token):
alignment.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self, lTokens, left_token, right_token):
alignment.Rule.__init__(self)
self.lTokens = lTokens
self.left_token = left_token
self.right_token = right_token

View File

@ -36,8 +36,8 @@ class align_tokens_in_region_between_tokens_skipping_lines_starting_with_tokens(
List of tokens to skip if they start a line.
'''
def __init__(self, name, identifier, lTokens, left_token, right_token, lSkip):
alignment.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self, lTokens, left_token, right_token, lSkip):
alignment.Rule.__init__(self)
self.lTokens = lTokens
self.left_token = left_token
self.right_token = right_token

View File

@ -28,8 +28,8 @@ class align_tokens_in_region_between_tokens_unless_between_tokens(Rule):
A list of pairs of tokens in which to exclude alignment
'''
def __init__(self, name, identifier, lTokens, left_token, right_token, lUnless):
Rule.__init__(self, name=name, identifier=identifier, lTokens=lTokens, left_token=left_token, right_token=right_token)
def __init__(self, lTokens, left_token, right_token, lUnless):
Rule.__init__(self, lTokens=lTokens, left_token=left_token, right_token=right_token)
self.lUnless = lUnless
def _get_tokens_of_interest(self, oFile):

View File

@ -28,8 +28,8 @@ class align_tokens_in_region_between_tokens_when_between_tokens_unless_between_t
A list of pairs of tokens in which to exclude alignment
'''
def __init__(self, name, identifier, lTokens, left_token, right_token, lBetween, lUnless):
Rule.__init__(self, name=name, identifier=identifier, lTokens=lTokens, left_token=left_token, right_token=right_token)
def __init__(self, lTokens, left_token, right_token, lBetween, lUnless):
Rule.__init__(self, lTokens=lTokens, left_token=left_token, right_token=right_token)
self.lBetween = lBetween[0]
self.lUnless = lUnless

View File

@ -24,4 +24,4 @@ class rule_001(token_indent):
'''
def __init__(self):
token_indent.__init__(self, 'architecture', '001', [token.architecture_keyword])
token_indent.__init__(self, [token.architecture_keyword])

View File

@ -13,7 +13,7 @@ class rule_002(deprecated_rule.Rule):
'''
def __init__(self):
deprecated_rule.Rule.__init__(self, 'architecture', '002')
deprecated_rule.Rule.__init__(self)
self.message.append('Rule ' + self.unique_id + ' has been split into the following rules:')
self.message.append(' architecture_030')
self.message.append(' architecture_031')

View File

@ -27,5 +27,5 @@ class rule_003(previous_line):
'''
def __init__(self):
previous_line.__init__(self, 'architecture', '003', [token.architecture_keyword])
previous_line.__init__(self, [token.architecture_keyword])
self.style = 'require_blank_line'

View File

@ -22,5 +22,5 @@ class rule_004(token_case):
'''
def __init__(self):
token_case.__init__(self, 'architecture', '004', [token.architecture_keyword])
token_case.__init__(self, [token.architecture_keyword])
self.groups.append('case::keyword')

View File

@ -25,5 +25,5 @@ class rule_005(move_token_next_to_another_token):
'''
def __init__(self):
move_token_next_to_another_token.__init__(self, 'architecture', '005', token.identifier, token.of_keyword)
move_token_next_to_another_token.__init__(self, token.identifier, token.of_keyword)
self.solution = 'Ensure *of* keyword is on the same line as the architecture identifier.'

View File

@ -27,5 +27,5 @@ class rule_006(move_token_next_to_another_token):
'''
def __init__(self):
move_token_next_to_another_token.__init__(self, 'architecture', '006', token.entity_name, token.is_keyword)
move_token_next_to_another_token.__init__(self, token.entity_name, token.is_keyword)
self.solution = 'Ensure *is* keyword is on the same line as the entity name.'

View File

@ -24,4 +24,4 @@ class rule_007(token_indent):
'''
def __init__(self):
token_indent.__init__(self, 'architecture', '007', [token.begin_keyword])
token_indent.__init__(self, [token.begin_keyword])

View File

@ -26,4 +26,4 @@ class rule_008(token_indent):
'''
def __init__(self):
token_indent.__init__(self, 'architecture', '008', [token.end_keyword])
token_indent.__init__(self, [token.end_keyword])

View File

@ -28,5 +28,5 @@ class rule_009(token_case):
'''
def __init__(self):
token_case.__init__(self, 'architecture', '009', [token.end_keyword])
token_case.__init__(self, [token.end_keyword])
self.groups.append('case::keyword')

View File

@ -24,6 +24,6 @@ class rule_010(insert_token_right_of_token_if_it_does_not_exist_before_token):
end architecture architecture_name;
'''
def __init__(self):
insert_token_right_of_token_if_it_does_not_exist_before_token.__init__(self, 'architecture', '010', token.end_architecture_keyword('architecture'), token.end_keyword, token.semicolon)
insert_token_right_of_token_if_it_does_not_exist_before_token.__init__(self, token.end_architecture_keyword('architecture'), token.end_keyword, token.semicolon)
self.solution = 'architecture keyword.'
self.groups.append('structure::optional')

View File

@ -28,5 +28,5 @@ class rule_011(token_case_with_prefix_suffix):
'''
def __init__(self):
token_case_with_prefix_suffix.__init__(self, 'architecture', '011', lTokens)
token_case_with_prefix_suffix.__init__(self, lTokens)
self.groups.append('case::name')

View File

@ -23,6 +23,6 @@ class rule_012(Rule):
end architecture architecture_name;
'''
def __init__(self):
Rule.__init__(self, 'architecture', '012')
Rule.__init__(self)
self.left_token = token.end_keyword
self.right_token = token.end_architecture_keyword

View File

@ -27,5 +27,5 @@ class rule_013(token_case_with_prefix_suffix):
'''
def __init__(self):
token_case_with_prefix_suffix.__init__(self, 'architecture', '013', lTokens)
token_case_with_prefix_suffix.__init__(self, lTokens)
self.groups.append('case::name')

View File

@ -27,5 +27,5 @@ class rule_014(token_case_with_prefix_suffix):
'''
def __init__(self):
token_case_with_prefix_suffix.__init__(self, 'architecture', '014', lTokens)
token_case_with_prefix_suffix.__init__(self, lTokens)
self.groups.append('case::name')

View File

@ -29,4 +29,4 @@ class rule_015(blank_line_below_line_ending_with_token):
'''
def __init__(self):
blank_line_below_line_ending_with_token.__init__(self, 'architecture', '015', [token.is_keyword])
blank_line_below_line_ending_with_token.__init__(self, [token.is_keyword])

View File

@ -31,4 +31,4 @@ class rule_016(blank_line_above_line_starting_with_token):
'''
def __init__(self):
blank_line_above_line_starting_with_token.__init__(self, 'architecture', '016', [token.begin_keyword])
blank_line_above_line_starting_with_token.__init__(self, [token.begin_keyword])

View File

@ -27,4 +27,4 @@ class rule_017(blank_line_below_line_ending_with_token):
'''
def __init__(self):
blank_line_below_line_ending_with_token.__init__(self, 'architecture', '017', [token.begin_keyword])
blank_line_below_line_ending_with_token.__init__(self, [token.begin_keyword])

View File

@ -27,4 +27,4 @@ class rule_018(blank_line_above_line_starting_with_token):
'''
def __init__(self):
blank_line_above_line_starting_with_token.__init__(self, 'architecture', '018', [token.end_keyword])
blank_line_above_line_starting_with_token.__init__(self, [token.end_keyword])

View File

@ -24,5 +24,5 @@ class rule_019(token_case):
'''
def __init__(self):
token_case.__init__(self, 'architecture', '019', [token.of_keyword])
token_case.__init__(self, [token.of_keyword])
self.groups.append('case::keyword')

View File

@ -24,5 +24,5 @@ class rule_020(token_case):
'''
def __init__(self):
token_case.__init__(self, 'architecture', '020', [token.is_keyword])
token_case.__init__(self, [token.is_keyword])
self.groups.append('case::keyword')

View File

@ -26,5 +26,5 @@ class rule_021(token_case):
'''
def __init__(self):
token_case.__init__(self, 'architecture', '021', [token.begin_keyword])
token_case.__init__(self, [token.begin_keyword])
self.groups.append('case::keyword')

View File

@ -23,6 +23,6 @@ class rule_022(Rule):
end architecture fifo;
'''
def __init__(self):
Rule.__init__(self, 'architecture', '022')
Rule.__init__(self)
self.left_token = token.end_architecture_keyword
self.right_token = token.architecture_simple_name

View File

@ -25,6 +25,6 @@ class rule_024(insert_token_left_of_token_if_it_does_not_exist_between_tokens_us
'''
def __init__(self):
insert_token_left_of_token_if_it_does_not_exist_between_tokens_using_value_from_token.__init__(self, 'architecture', '024', token.architecture_simple_name, token.semicolon, token.end_keyword, token.semicolon, token.identifier)
insert_token_left_of_token_if_it_does_not_exist_between_tokens_using_value_from_token.__init__(self, token.architecture_simple_name, token.semicolon, token.end_keyword, token.semicolon, token.identifier)
self.solution = 'architecture simple name'
self.groups.append('structure::optional')

View File

@ -37,7 +37,7 @@ class rule_025(is_token_value_one_of):
'''
def __init__(self):
is_token_value_one_of.__init__(self, 'architecture', '025', token.identifier)
is_token_value_one_of.__init__(self, token.identifier)
def _get_solution(self, iLineNumber):
return 'Architecture identifier must be from this list: ' + ', '.join(self.names)

View File

@ -47,7 +47,7 @@ class rule_026(Rule):
'''
def __init__(self):
Rule.__init__(self, 'architecture', '026', lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lUnless)
Rule.__init__(self, lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lUnless)
self.solution = 'Align identifer.'
self.subphase = 3
self.configuration.append('include_type_is_keyword')

View File

@ -43,6 +43,6 @@ class rule_027(align_tokens_in_region_between_tokens_skipping_lines_starting_wit
'''
def __init__(self):
align_tokens_in_region_between_tokens_skipping_lines_starting_with_tokens.__init__(self, 'architecture', '027', lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lSkip)
align_tokens_in_region_between_tokens_skipping_lines_starting_with_tokens.__init__(self, lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lSkip)
self.solution = 'Align comments.'
self.subphase = 5

View File

@ -28,5 +28,5 @@ class rule_028(token_case):
'''
def __init__(self):
token_case.__init__(self, 'architecture', '028', [token.end_architecture_keyword])
token_case.__init__(self, [token.end_architecture_keyword])
self.groups.append('case::keyword')

View File

@ -43,7 +43,7 @@ class rule_029(align_tokens_in_region_between_tokens_unless_between_tokens):
'''
def __init__(self):
align_tokens_in_region_between_tokens_unless_between_tokens.__init__(self, 'architecture', '029', lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lUnless)
align_tokens_in_region_between_tokens_unless_between_tokens.__init__(self, lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lUnless)
self.solution = 'Align identifer.'
self.configuration_documentation_link = 'configuring_identifier_alignment_rules_link'
self.configuration.remove('separate_generic_port_alignment')

View File

@ -23,6 +23,6 @@ class rule_030(Rule):
architecture rtl of fifo is
'''
def __init__(self):
Rule.__init__(self, 'architecture', '030')
Rule.__init__(self)
self.left_token = token.architecture_keyword
self.right_token = token.identifier

View File

@ -23,6 +23,6 @@ class rule_031(Rule):
architecture rtl of fifo is
'''
def __init__(self):
Rule.__init__(self, 'architecture', '031')
Rule.__init__(self)
self.left_token = token.identifier
self.right_token = token.of_keyword

View File

@ -23,6 +23,6 @@ class rule_032(Rule):
architecture rtl of fifo is
'''
def __init__(self):
Rule.__init__(self, 'architecture', '032')
Rule.__init__(self)
self.left_token = token.of_keyword
self.right_token = token.entity_name

View File

@ -23,6 +23,6 @@ class rule_033(Rule):
architecture rtl of fifo is
'''
def __init__(self):
Rule.__init__(self, 'architecture', '033')
Rule.__init__(self)
self.left_token = token.entity_name
self.right_token = token.is_keyword

View File

@ -30,4 +30,4 @@ class rule_200(blank_line_below_line_ending_with_token):
'''
def __init__(self):
blank_line_below_line_ending_with_token.__init__(self, 'architecture', '200', lTokens)
blank_line_below_line_ending_with_token.__init__(self, lTokens)

View File

@ -34,6 +34,6 @@ class rule_400(Rule):
'''
def __init__(self):
Rule.__init__(self, 'architecture', '400', lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lUnless)
Rule.__init__(self, lAlign, token.architecture_body.is_keyword, token.architecture_body.begin_keyword, lUnless)
self.solution = 'Align colon.'
self.configuration.remove('separate_generic_port_alignment')

View File

@ -63,7 +63,7 @@ class rule_600(Rule):
'''
def __init__(self):
Rule.__init__(self, 'architecture', '600', lTokens, lNames)
Rule.__init__(self, lTokens, lNames)
def _get_tokens_of_interest(self, oFile):

View File

@ -65,7 +65,7 @@ class rule_601(case.Rule):
'''
def __init__(self):
case.Rule.__init__(self, name="architecture", identifier="601")
case.Rule.__init__(self)
self.subphase = 2
self.configuration_documentation_link = None

View File

@ -33,4 +33,4 @@ class rule_001(token_indent):
'''
def __init__(self):
token_indent.__init__(self, 'assert', '001', lTokens)
token_indent.__init__(self, lTokens)

View File

@ -42,5 +42,5 @@ class rule_002(split_line_at_token_when_between_tokens_unless_token_is_found):
'''
def __init__(self):
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, 'assert', '002', lTokens, oStart, oEnd, oStop)
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, lTokens, oStart, oEnd, oStop)
self.solution = "Place **report** keyword on its own line."

View File

@ -52,5 +52,5 @@ class rule_003(split_line_at_token_when_between_tokens_unless_token_is_found):
'''
def __init__(self):
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, 'assert', '003', lTokens, oStart, oEnd, oStop)
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, lTokens, oStart, oEnd, oStop)
self.solution = "Place **report** keyword on its own line."

View File

@ -42,5 +42,5 @@ class rule_004(split_line_at_token_when_between_tokens_unless_token_is_found):
'''
def __init__(self):
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, 'assert', '004', lTokens, oStart, oEnd, oStop)
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, lTokens, oStart, oEnd, oStop)
self.solution = "Place **severity** keyword on its own line."

View File

@ -48,5 +48,5 @@ class rule_005(split_line_at_token_when_between_tokens_unless_token_is_found):
'''
def __init__(self):
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, 'assert', '005', lTokens, oStart, oEnd, oStop)
split_line_at_token_when_between_tokens_unless_token_is_found.__init__(self, lTokens, oStart, oEnd, oStop)
self.solution = "Place **severity** keyword on its own line."

View File

@ -30,4 +30,4 @@ class rule_100(Rule):
severity FAILURE;
'''
def __init__(self):
Rule.__init__(self, 'assert', '100', lTokens)
Rule.__init__(self, lTokens)

View File

@ -30,4 +30,4 @@ class rule_101(Rule):
severity FAILURE;
'''
def __init__(self):
Rule.__init__(self, 'assert', '101', lTokens)
Rule.__init__(self, lTokens)

View File

@ -30,4 +30,4 @@ class rule_102(Rule):
severity FAILURE;
'''
def __init__(self):
Rule.__init__(self, 'assert', '102', lTokens)
Rule.__init__(self, lTokens)

View File

@ -32,7 +32,7 @@ class rule_400(Rule):
'''
def __init__(self):
Rule.__init__(self, name="assert", identifier="400")
Rule.__init__(self)
self.lStartTokens = [assertion.report_keyword]
self.lEndTokens = [assertion.severity_keyword, assertion_statement.semicolon, concurrent_assertion_statement.semicolon]
self.configuration_documentation_link = None

View File

@ -29,5 +29,5 @@ class rule_500(token_case):
'''
def __init__(self):
token_case.__init__(self, 'assert', '500', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -29,5 +29,5 @@ class rule_501(token_case):
'''
def __init__(self):
token_case.__init__(self, 'assert', '501', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -29,5 +29,5 @@ class rule_502(token_case):
'''
def __init__(self):
token_case.__init__(self, 'assert', '502', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -11,5 +11,5 @@ class rule_001(deprecated_rule.Rule):
'''
def __init__(self):
deprecated_rule.Rule.__init__(self, 'attribute', '001')
deprecated_rule.Rule.__init__(self)
self.message.append('Rule ' + self.unique_id + ' has been superceeded by attribute_declaration_300 and attribute_specification_300.')

View File

@ -11,5 +11,5 @@ class rule_002(deprecated_rule.Rule):
'''
def __init__(self):
deprecated_rule.Rule.__init__(self, 'attribute', '002')
deprecated_rule.Rule.__init__(self)
self.message.append('Rule ' + self.unique_id + ' has been superceeded by attribute_declaration_500 and attribute_specification_500.')

View File

@ -27,5 +27,5 @@ class rule_500(Rule):
'''
def __init__(self):
Rule.__init__(self, 'attribute', '500', lTokens)
Rule.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -27,4 +27,4 @@ class rule_100(Rule):
attribute max_delay : time;
'''
def __init__(self):
Rule.__init__(self, 'attribute_declaration', '100', lTokens)
Rule.__init__(self, lTokens)

View File

@ -26,5 +26,5 @@ class rule_101(Rule):
attribute max_delay : time;
'''
def __init__(self):
Rule.__init__(self, 'attribute_declaration', '101', lTokens)
Rule.__init__(self, lTokens)
self.number_of_spaces = '>=1'

View File

@ -27,4 +27,4 @@ class rule_300(token_indent):
'''
def __init__(self):
token_indent.__init__(self, 'attribute_declaration', '300', lTokens)
token_indent.__init__(self, lTokens)

View File

@ -27,5 +27,5 @@ class rule_500(token_case):
'''
def __init__(self):
token_case.__init__(self, 'attribute_declaration', '500', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -27,5 +27,5 @@ class rule_501(token_case_with_prefix_suffix):
'''
def __init__(self):
token_case_with_prefix_suffix.__init__(self, 'attribute_declaration', '501', lTokens)
token_case_with_prefix_suffix.__init__(self, lTokens)
self.groups.append('case::name')

View File

@ -31,6 +31,6 @@ class rule_502(token_case_in_range_bounded_by_tokens):
'''
def __init__(self):
token_case_in_range_bounded_by_tokens.__init__(self, 'attribute_declaration', '502', lTokens, oStartToken, oEndToken)
token_case_in_range_bounded_by_tokens.__init__(self, lTokens, oStartToken, oEndToken)
self.groups.append('case::name')
self.configuration.append('case_exceptions')

View File

@ -33,4 +33,4 @@ class rule_100(Rule):
attribute coordinate of comp_1:component is (0.0, 17.5);
'''
def __init__(self):
Rule.__init__(self, 'attribute_specification', '100', lTokens)
Rule.__init__(self, lTokens)

View File

@ -28,4 +28,4 @@ class rule_101(Rule):
attribute coordinate of comp_1 : component is (0.0, 17.5);
'''
def __init__(self):
Rule.__init__(self, 'attribute_specification', '101', lTokens)
Rule.__init__(self, lTokens)

View File

@ -27,4 +27,4 @@ class rule_300(token_indent):
'''
def __init__(self):
token_indent.__init__(self, 'attribute_specification', '300', lTokens)
token_indent.__init__(self, lTokens)

View File

@ -27,5 +27,5 @@ class rule_500(token_case):
'''
def __init__(self):
token_case.__init__(self, 'attribute_specification', '500', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -27,5 +27,5 @@ class rule_501(token_case_with_prefix_suffix):
'''
def __init__(self):
token_case_with_prefix_suffix.__init__(self, 'attribute_specification', '501', lTokens)
token_case_with_prefix_suffix.__init__(self, lTokens)
self.groups.append('case::name')

View File

@ -27,5 +27,5 @@ class rule_502(token_case):
'''
def __init__(self):
token_case.__init__(self, 'attribute_specification', '502', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -27,5 +27,5 @@ class rule_503(token_case):
'''
def __init__(self):
token_case.__init__(self, 'attribute_specification', '503', lTokens)
token_case.__init__(self, lTokens)
self.groups.append('case::keyword')

View File

@ -21,8 +21,8 @@ class blank_line_above_line_starting_with_token(blank_line.Rule):
token object that a blank line above should appear
'''
def __init__(self, name, identifier, lTokens, lAllowTokens=None):
blank_line.Rule.__init__(self, name=name, identifier=identifier)
def __init__(self, lTokens, lAllowTokens=None):
blank_line.Rule.__init__(self)
self.lTokens = lTokens
if lAllowTokens is None:
self.lAllowTokens = []

Some files were not shown because too many files have changed in this diff Show More