Skip to content

Commit

Permalink
Adding rule interface_incomplete_type_declaration_601.
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiah-c-leary committed Mar 2, 2025
1 parent 5f20f07 commit f3084f3
Show file tree
Hide file tree
Showing 8 changed files with 130 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/configuring_disabled_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ Rules Disabled by Default
* `instantiation_601 <instantiation_rules.html#instantiation-601>`_

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

* `loop_statement_006 <loop_statement_rules.html#loop-statement-006>`_
* `loop_statement_007 <loop_statement_rules.html#loop-statement-007>`_
Expand Down
25 changes: 25 additions & 0 deletions docs/interface_incomplete_type_declaration_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -73,3 +73,28 @@ This rule checks for valid prefixes of type names.
generic (
type gt_generic_data_type
interface_incomplete_type_declaration_601
#########################################

|phase_7| |disabled| |error| |unfixable| |naming|

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
1 change: 1 addition & 0 deletions docs/rule_groups/naming_rule_group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Rules Enforcing Naming Rule Group
* `instantiation_601 <../instantiation_rules.html#instantiation-601>`_

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

* `loop_statement_600 <../loop_statement_rules.html#loop-statement-600>`_
* `loop_statement_601 <../loop_statement_rules.html#loop-statement-601>`_
Expand Down
1 change: 1 addition & 0 deletions docs/unfixable_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ With multiple options available, the user is required to make the decision.
* `instantiation_601 <instantiation_rules.html#instantiation-601>`_

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

* `loop_statement_600 <loop_statement_rules.html#loop-statement-600>`_
* `loop_statement_601 <loop_statement_rules.html#loop-statement-601>`_
Expand Down
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 tests/interface_incomplete_type_declaration/test_rule_601.py
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))
Original file line number Diff line number Diff line change
Expand Up @@ -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 vsg/rules/interface_incomplete_type_declaration/rule_601.py
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"

0 comments on commit f3084f3

Please sign in to comment.