Issue#1320: Added rules port_map_011 and generic_map_101.

This commit is contained in:
JHertz5 2024-11-13 10:47:39 +00:00
parent 29fe733ab4
commit a0cb01d30f
3 changed files with 72 additions and 0 deletions

View File

@ -10,5 +10,7 @@ from .rule_007 import rule_007
from .rule_008 import rule_008
from .rule_009 import rule_009
from .rule_010 import rule_010
from .rule_011 import rule_011
from .rule_100 import rule_100
from .rule_101 import rule_101
from .rule_200 import rule_200

View File

@ -0,0 +1,39 @@
# -*- coding: utf-8 -*-
from vsg.rules import move_token_next_to_another_token
from vsg.token import port_map_aspect as token
class rule_011(move_token_next_to_another_token):
"""
This rule checks the **map** keyword is on the same line as the **port** keyword.
**Violation**
.. code-block:: vhdl
port
map (
WR_EN => WR_EN,
RD_EN => RD_EN,
OVERFLOW => OVERFLOW
);
**Fix**
Use explicit port mapping.
.. code-block:: vhdl
port map (
WR_EN => WR_EN,
RD_EN => RD_EN,
OVERFLOW => OVERFLOW
);
"""
def __init__(self):
super().__init__(token.port_keyword, token.map_keyword)
# The subphase must be changed so that this rule runs after the rule to move the map keyword.
self.solution = "Move the *port* keyword to the same line as the *map* keyword."

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules.whitespace_between_token_pairs import Rule
lTokens = []
lTokens.append([token.port_map_aspect.port_keyword, token.port_map_aspect.map_keyword])
class rule_101(Rule):
"""
This rule checks for a single space between the **port** keyword and the **map** keyword.
|configuring_whitespace_rules_link|
**Violation**
.. code-block:: vhdl
port map (
**Fix**
.. code-block:: vhdl
port map (
"""
def __init__(self):
super().__init__(lTokens)
self.solution = 'Ensure a single space exists between "port" and "map".'