Skip to content

Commit f3084f3

Browse files
Adding rule interface_incomplete_type_declaration_601.
1 parent 5f20f07 commit f3084f3

File tree

8 files changed

+130
-0
lines changed

8 files changed

+130
-0
lines changed

docs/configuring_disabled_rules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ Rules Disabled by Default
6161
* `instantiation_601 <instantiation_rules.html#instantiation-601>`_
6262

6363
* `interface_incomplete_type_declaration_600 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-600>`_
64+
* `interface_incomplete_type_declaration_601 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-601>`_
6465

6566
* `loop_statement_006 <loop_statement_rules.html#loop-statement-006>`_
6667
* `loop_statement_007 <loop_statement_rules.html#loop-statement-007>`_

docs/interface_incomplete_type_declaration_rules.rst

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,3 +73,28 @@ This rule checks for valid prefixes of type names.
7373
7474
generic (
7575
type gt_generic_data_type
76+
77+
interface_incomplete_type_declaration_601
78+
#########################################
79+
80+
|phase_7| |disabled| |error| |unfixable| |naming|
81+
82+
This rule checks for valid suffixes of type names.
83+
84+
.. NOTE:: The default prefix is *_gt*.
85+
86+
|configuring_prefix_and_suffix_rules_link|
87+
88+
**Violation**
89+
90+
.. code-block:: vhdl
91+
92+
generic (
93+
type generic_data_type
94+
95+
**Fix**
96+
97+
.. code-block:: vhdl
98+
99+
generic (
100+
type generic_data_type_gt

docs/rule_groups/naming_rule_group.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ Rules Enforcing Naming Rule Group
2626
* `instantiation_601 <../instantiation_rules.html#instantiation-601>`_
2727

2828
* `interface_incomplete_type_declaration_600 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-600>`_
29+
* `interface_incomplete_type_declaration_601 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-601>`_
2930

3031
* `loop_statement_600 <../loop_statement_rules.html#loop-statement-600>`_
3132
* `loop_statement_601 <../loop_statement_rules.html#loop-statement-601>`_

docs/unfixable_rules.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ With multiple options available, the user is required to make the decision.
105105
* `instantiation_601 <instantiation_rules.html#instantiation-601>`_
106106

107107
* `interface_incomplete_type_declaration_600 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-600>`_
108+
* `interface_incomplete_type_declaration_601 <../interface_incomplete_type_declaration_rules.html#interface-incomplete-type-declaration-601>`_
108109

109110
* `loop_statement_600 <loop_statement_rules.html#loop-statement-600>`_
110111
* `loop_statement_601 <loop_statement_rules.html#loop-statement-601>`_
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
2+
entity fifo is
3+
generic (
4+
type generic_data_type_gt;
5+
type generic_data_type;
6+
type generic_data_type_t
7+
);
8+
port (
9+
data_in : generic_data_type
10+
);
11+
end entity fifo;
12+
13+
architecture rtl of fifo is
14+
15+
component buffer is
16+
generic (
17+
type generic_data_type_gt;
18+
type generic_data_type;
19+
type generic_data_type_t
20+
);
21+
port (
22+
data_in : generic_data_type
23+
);
24+
end component buffer;
25+
26+
begin
27+
28+
buf1 : buffer
29+
generic map (
30+
generic_data_type => std_logic
31+
)
32+
port map (
33+
data_in => '0'
34+
);
35+
36+
end architecture rtl;
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# -*- coding: utf-8 -*-
2+
3+
import os
4+
import unittest
5+
6+
from tests import utils
7+
from vsg import vhdlFile
8+
from vsg.rules import interface_incomplete_type_declaration
9+
10+
sTestDir = os.path.dirname(__file__)
11+
12+
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_601_test_input.vhd"))
13+
14+
15+
class test_rule(unittest.TestCase):
16+
def setUp(self):
17+
self.oFile = vhdlFile.vhdlFile(lFile)
18+
self.assertIsNone(eError)
19+
20+
def test_rule_601(self):
21+
oRule = interface_incomplete_type_declaration.rule_601()
22+
self.assertTrue(oRule)
23+
self.assertEqual(oRule.name, "interface_incomplete_type_declaration")
24+
self.assertEqual(oRule.identifier, "601")
25+
26+
lExpected = [5, 6, 18, 19]
27+
28+
oRule.analyze(self.oFile)
29+
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

vsg/rules/interface_incomplete_type_declaration/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,3 +4,4 @@
44
from .rule_501 import rule_501
55

66
from .rule_600 import rule_600
7+
from .rule_601 import rule_601
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# -*- coding: utf-8 -*-
2+
3+
from vsg import token
4+
from vsg.rules import token_suffix
5+
6+
lTokens = []
7+
lTokens.append(token.interface_incomplete_type_declaration.identifier)
8+
9+
10+
class rule_601(token_suffix):
11+
"""
12+
This rule checks for valid suffixes of type names.
13+
14+
.. NOTE:: The default prefix is *_gt*.
15+
16+
|configuring_prefix_and_suffix_rules_link|
17+
18+
**Violation**
19+
20+
.. code-block:: vhdl
21+
22+
generic (
23+
type generic_data_type
24+
25+
**Fix**
26+
27+
.. code-block:: vhdl
28+
29+
generic (
30+
type generic_data_type_gt
31+
"""
32+
33+
def __init__(self):
34+
super().__init__(lTokens)
35+
self.suffixes = ["_gt"]
36+
self.solution = "Type identifiers"

0 commit comments

Comments
 (0)