-
Notifications
You must be signed in to change notification settings - Fork 60
Add blank line rule in port_map #1450
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
lgu-appear
wants to merge
10
commits into
jeremiah-c-leary:master
Choose a base branch
from
lgu-appear:Add_blank_line_rule
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 1 commit
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
ee49336
Add rule_201 for port_map rules
lgu-appear f2ee17e
Forgot __init__ file
lgu-appear 9e27755
Fix tests with errors
lgu-appear b4ac4cd
Add generic_map_201 identical to port_map_201
lgu-appear 2666398
Remove maxDiff
lgu-appear 0829f5c
Disabling new rules for jcl style.
jeremiah-c-leary 0736f74
Fixing style issues.
jeremiah-c-leary 585486a
Updating rules to take comments into account.
jeremiah-c-leary 0b94ad0
fix SyntaxWarning for py3.13 compatibility (#1441)
chenrui333 ac04129
Fixing test failure on documentation.
jeremiah-c-leary File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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,45 @@ | ||
|
|
||
| architecture ARCH of ENTITY1 is | ||
|
|
||
| begin | ||
|
|
||
| U_INST1 : INST1 | ||
| generic map ( | ||
| G_GEN_1 => 3, | ||
| G_GEN_2 => 4, | ||
| G_GEN_3 => 5 | ||
| ) | ||
| port map ( | ||
| PORT_1 => w_port_1, | ||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
| -- Violations below | ||
|
|
||
| U_INST1 : INST1 | ||
| generic map ( | ||
| G_GEN_1 => 3, | ||
| G_GEN_2 => 4, | ||
| G_GEN_3 => 5 | ||
| ) | ||
| port map ( | ||
| PORT_1 => w_port_1, | ||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
| U_INST1 : INST1 | ||
| generic map ( | ||
| G_GEN_1 => 3, | ||
| G_GEN_2 => 4, | ||
| G_GEN_3 => 5 | ||
| ) | ||
| port map ( | ||
| PORT_1 => w_port_1, | ||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
|
|
||
| end architecture ARCH; |
This file contains hidden or 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,49 @@ | ||
|
|
||
| architecture ARCH of ENTITY1 is | ||
|
|
||
| begin | ||
|
|
||
| U_INST1 : INST1 | ||
| generic map ( | ||
| G_GEN_1 => 3, | ||
| G_GEN_2 => 4, | ||
| G_GEN_3 => 5 | ||
| ) | ||
| port map ( | ||
| PORT_1 => w_port_1, | ||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
| -- Violations below | ||
|
|
||
| U_INST1 : INST1 | ||
| generic map ( | ||
| G_GEN_1 => 3, | ||
| G_GEN_2 => 4, | ||
| G_GEN_3 => 5 | ||
| ) | ||
| port map ( | ||
| PORT_1 => w_port_1, | ||
|
|
||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
| U_INST1 : INST1 | ||
| generic map ( | ||
| G_GEN_1 => 3, | ||
| G_GEN_2 => 4, | ||
| G_GEN_3 => 5 | ||
| ) | ||
| port map ( | ||
| PORT_1 => w_port_1, | ||
|
|
||
| PORT_2 => w_port_2, | ||
|
|
||
|
|
||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
|
|
||
| end architecture ARCH; |
This file contains hidden or 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,49 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| import os | ||
| import unittest | ||
|
|
||
| from tests import utils | ||
| from vsg import vhdlFile | ||
| from vsg.rules import port_map | ||
|
|
||
| sTestDir = os.path.dirname(__file__) | ||
|
|
||
| lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_201_test_input.vhd")) | ||
|
|
||
| lExpected = [] | ||
| lExpected.append("") | ||
| utils.read_file(os.path.join(sTestDir, "rule_201_test_input.fixed.vhd"), lExpected) | ||
|
|
||
|
|
||
| class test_port_map_rule(unittest.TestCase): | ||
|
|
||
| maxDiff = None | ||
|
|
||
| def setUp(self): | ||
| self.oFile = vhdlFile.vhdlFile(lFile) | ||
| self.assertIsNone(eError) | ||
|
|
||
| def test_rule_201(self): | ||
| oRule = port_map.rule_201() | ||
| self.assertTrue(oRule) | ||
| self.assertEqual(oRule.name, "port_map") | ||
| self.assertEqual(oRule.identifier, "201") | ||
| self.assertEqual(oRule.groups, ["blank_line"]) | ||
|
|
||
| lExpected = [28, 41, 43, 44] | ||
|
|
||
| oRule.analyze(self.oFile) | ||
| self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations)) | ||
|
|
||
| def test_fix_rule_201(self): | ||
| oRule = port_map.rule_201() | ||
|
|
||
| oRule.fix(self.oFile) | ||
|
|
||
| lActual = self.oFile.get_lines() | ||
|
|
||
| self.assertEqual(lExpected, lActual) | ||
|
|
||
| oRule.analyze(self.oFile) | ||
| self.assertEqual(oRule.violations, []) | ||
This file contains hidden or 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,38 @@ | ||
| # -*- coding: utf-8 -*- | ||
|
|
||
| from vsg import token | ||
| from vsg.rules import blank_lines_between_token_pairs as Rule | ||
|
|
||
| lTokenPairs = [] | ||
| lTokenPairs.append([token.port_map_aspect.open_parenthesis, token.port_map_aspect.close_parenthesis]) | ||
|
|
||
| class rule_201(Rule): | ||
| """ | ||
| This rule checks for blank lines in a port map. | ||
|
|
||
| |configuring_blank_lines_link| | ||
|
|
||
| **Violation** | ||
|
|
||
| .. code-block:: vhdl | ||
|
|
||
| port map ( | ||
| PORT_1 => w_port_1, | ||
|
|
||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
|
|
||
| **Fix** | ||
|
|
||
| .. code-block:: vhdl | ||
|
|
||
| port map ( | ||
| PORT_1 => w_port_1, | ||
| PORT_2 => w_port_2, | ||
| PORT_3 => w_port_3 | ||
| ); | ||
| """ | ||
|
|
||
| def __init__(self): | ||
| super().__init__(lTokenPairs) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.