-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adding rule interface_incomplete_type_declaration_601.
- Loading branch information
1 parent
5f20f07
commit f3084f3
Showing
8 changed files
with
130 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 36 additions & 0 deletions
36
tests/interface_incomplete_type_declaration/rule_601_test_input.vhd
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
|
||
entity fifo is | ||
generic ( | ||
type generic_data_type_gt; | ||
type generic_data_type; | ||
type generic_data_type_t | ||
); | ||
port ( | ||
data_in : generic_data_type | ||
); | ||
end entity fifo; | ||
|
||
architecture rtl of fifo is | ||
|
||
component buffer is | ||
generic ( | ||
type generic_data_type_gt; | ||
type generic_data_type; | ||
type generic_data_type_t | ||
); | ||
port ( | ||
data_in : generic_data_type | ||
); | ||
end component buffer; | ||
|
||
begin | ||
|
||
buf1 : buffer | ||
generic map ( | ||
generic_data_type => std_logic | ||
) | ||
port map ( | ||
data_in => '0' | ||
); | ||
|
||
end architecture rtl; |
29 changes: 29 additions & 0 deletions
29
tests/interface_incomplete_type_declaration/test_rule_601.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
import os | ||
import unittest | ||
|
||
from tests import utils | ||
from vsg import vhdlFile | ||
from vsg.rules import interface_incomplete_type_declaration | ||
|
||
sTestDir = os.path.dirname(__file__) | ||
|
||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_601_test_input.vhd")) | ||
|
||
|
||
class test_rule(unittest.TestCase): | ||
def setUp(self): | ||
self.oFile = vhdlFile.vhdlFile(lFile) | ||
self.assertIsNone(eError) | ||
|
||
def test_rule_601(self): | ||
oRule = interface_incomplete_type_declaration.rule_601() | ||
self.assertTrue(oRule) | ||
self.assertEqual(oRule.name, "interface_incomplete_type_declaration") | ||
self.assertEqual(oRule.identifier, "601") | ||
|
||
lExpected = [5, 6, 18, 19] | ||
|
||
oRule.analyze(self.oFile) | ||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,3 +4,4 @@ | |
from .rule_501 import rule_501 | ||
|
||
from .rule_600 import rule_600 | ||
from .rule_601 import rule_601 |
36 changes: 36 additions & 0 deletions
36
vsg/rules/interface_incomplete_type_declaration/rule_601.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
# -*- coding: utf-8 -*- | ||
|
||
from vsg import token | ||
from vsg.rules import token_suffix | ||
|
||
lTokens = [] | ||
lTokens.append(token.interface_incomplete_type_declaration.identifier) | ||
|
||
|
||
class rule_601(token_suffix): | ||
""" | ||
This rule checks for valid suffixes of type names. | ||
.. NOTE:: The default prefix is *_gt*. | ||
|configuring_prefix_and_suffix_rules_link| | ||
**Violation** | ||
.. code-block:: vhdl | ||
generic ( | ||
type generic_data_type | ||
**Fix** | ||
.. code-block:: vhdl | ||
generic ( | ||
type generic_data_type_gt | ||
""" | ||
|
||
def __init__(self): | ||
super().__init__(lTokens) | ||
self.suffixes = ["_gt"] | ||
self.solution = "Type identifiers" |