Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions docs/array_constraint_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,27 @@
Array Constraint Rules
----------------------

array_constraint_100
####################

|phase_2| |error| |whitespace|

This rule checks for whitespace before the opening parenthesis.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl
subtype my_array3 is my_array2 (open)(7 downto 0);
**Fix**

.. code-block:: vhdl
subtype my_array3 is my_array2(open)(7 downto 0);
array_constraint_500
####################

Expand Down
2 changes: 2 additions & 0 deletions docs/configuring_whitespace_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,7 @@ Rules Enforcing Whitespace
* `architecture_031 <architecture_rules.html#architecture-031>`_
* `architecture_032 <architecture_rules.html#architecture-032>`_
* `architecture_033 <architecture_rules.html#architecture-033>`_
* `array_constraint_100 <array_constraint_rules.html#array-constraint-100>`_
* `assert_100 <assert_rules.html#assert-100>`_
* `assert_101 <assert_rules.html#assert-101>`_
* `assert_102 <assert_rules.html#assert-102>`_
Expand Down Expand Up @@ -212,6 +213,7 @@ Rules Enforcing Whitespace
* `if_004 <if_rules.html#if-004>`_
* `if_005 <if_rules.html#if-005>`_
* `if_015 <if_rules.html#if-015>`_
* `index_constraint_100 <index_constraint_rules.html#index-constraint-100>`_
* `index_subtype_definition_100 <index_subtype_definition_rules.html#index-subtype-definition-100>`_
* `index_subtype_definition_101 <index_subtype_definition_rules.html#index-subtype-definition-101>`_
* `instantiation_002 <instantiation_rules.html#instantiation-002>`_
Expand Down
25 changes: 25 additions & 0 deletions docs/index_constraint_rules.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
.. include:: includes.rst

Index Constraint Rules
----------------------

index_constraint_100
####################

|phase_2| |error| |whitespace|

This rule checks for whitespace before the opening parenthesis.

|configuring_whitespace_rules_link|

**Violation**

.. code-block:: vhdl
subtype my_array3 is my_array2(open) (7 downto 0);
**Fix**

.. code-block:: vhdl
subtype my_array3 is my_array2(open)(7 downto 0);
3 changes: 2 additions & 1 deletion docs/rule_groups/whitespace_rule_group.rst
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ Rules Enforcing Whitespace Rule Group
* `architecture_031 <../architecture_rules.html#architecture-031>`_
* `architecture_032 <../architecture_rules.html#architecture-032>`_
* `architecture_033 <../architecture_rules.html#architecture-033>`_
* `array_constraint_100 <../array_constraint_rules.html#array-constraint-100>`_
* `assert_100 <../assert_rules.html#assert-100>`_
* `assert_101 <../assert_rules.html#assert-101>`_
* `assert_102 <../assert_rules.html#assert-102>`_
Expand Down Expand Up @@ -106,6 +107,7 @@ Rules Enforcing Whitespace Rule Group
* `if_004 <../if_rules.html#if-004>`_
* `if_005 <../if_rules.html#if-005>`_
* `if_015 <../if_rules.html#if-015>`_
* `index_constraint_100 <../index_constraint_rules.html#index-constraint-100>`_
* `index_subtype_definition_100 <../index_subtype_definition_rules.html#index-subtype-definition-100>`_
* `index_subtype_definition_101 <../index_subtype_definition_rules.html#index-subtype-definition-101>`_
* `instantiation_002 <../instantiation_rules.html#instantiation-002>`_
Expand Down Expand Up @@ -195,7 +197,6 @@ Rules Enforcing Whitespace Rule Group
* `whitespace_005 <../whitespace_rules.html#whitespace-005>`_
* `whitespace_006 <../whitespace_rules.html#whitespace-006>`_
* `whitespace_007 <../whitespace_rules.html#whitespace-007>`_
* `whitespace_008 <../whitespace_rules.html#whitespace-008>`_
* `whitespace_010 <../whitespace_rules.html#whitespace-010>`_
* `whitespace_011 <../whitespace_rules.html#whitespace-011>`_
* `whitespace_013 <../whitespace_rules.html#whitespace-013>`_
Expand Down
18 changes: 1 addition & 17 deletions docs/whitespace_rules.rst
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,7 @@ This rule checks for spaces after a comma.
whitespace_008
##############

|phase_2| |error| |whitespace|

This rule checks for spaces after the **std_logic_vector** keyword.

**Violation**

.. code-block:: vhdl

signal data : std_logic_vector (7 downto 0);
signal counter : std_logic_vector (7 downto 0);

**Fix**

.. code-block:: vhdl

signal data : std_logic_vector(7 downto 0);
signal counter : std_logic_vector(7 downto 0);
This rule has been deprecated and replaced with rule `index_constraint_100 <index_constraint_rules.html#index_constraint-100>`_.

whitespace_010
##############
Expand Down
10 changes: 10 additions & 0 deletions tests/array_constraint/rule_100_test_input.fixed.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

subtype t_my_array is t_array(open)(t_range);
subtype t_my_array is t_array(open)(t_range);
subtype t_my_array is t_array(open)(t_range);

begin

end architecture rtl;
10 changes: 10 additions & 0 deletions tests/array_constraint/rule_100_test_input.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

architecture rtl of fifo is

subtype t_my_array is t_array (open)(t_range);
subtype t_my_array is t_array (open)(t_range);
subtype t_my_array is t_array(open)(t_range);

begin

end architecture rtl;
45 changes: 45 additions & 0 deletions tests/array_constraint/test_rule_100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

import os
import unittest

from tests import utils
from vsg import vhdlFile
from vsg.rules import array_constraint

sTestDir = os.path.dirname(__file__)

lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_100_test_input.vhd"))

lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_100_test_input.fixed.vhd"), lExpected)


class test_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)

def test_rule_100(self):
oRule = array_constraint.rule_100()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "array_constraint")
self.assertEqual(oRule.identifier, "100")

lExpected = [4, 5]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

def test_fix_rule_100(self):
oRule = array_constraint.rule_100()

oRule.fix(self.oFile)

lActual = self.oFile.get_lines()

self.assertEqual(lExpected, lActual)

oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])
Empty file.
19 changes: 19 additions & 0 deletions tests/index_constraint/rule_100_test_input.fixed.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

entity fifo is
port (
i_data : in signed(15 downto 0);
i_data : in signed(15 downto 0);
i_data : in signed(15 downto 0)
);
end entity fifo;


architecture rtl of fifo is

subtype t_my_array is t_array(open)(t_range);
subtype t_my_array is t_array(open)(t_range);
subtype t_my_array is t_array(open)(t_range);

begin

end architecture rtl;
19 changes: 19 additions & 0 deletions tests/index_constraint/rule_100_test_input.vhd
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@

entity fifo is
port (
i_data : in signed (15 downto 0);
i_data : in signed (15 downto 0);
i_data : in signed(15 downto 0)
);
end entity fifo;


architecture rtl of fifo is

subtype t_my_array is t_array(open) (t_range);
subtype t_my_array is t_array(open) (t_range);
subtype t_my_array is t_array(open)(t_range);

begin

end architecture rtl;
45 changes: 45 additions & 0 deletions tests/index_constraint/test_rule_100.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# -*- coding: utf-8 -*-

import os
import unittest

from tests import utils
from vsg import vhdlFile
from vsg.rules import index_constraint

sTestDir = os.path.dirname(__file__)

lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_100_test_input.vhd"))

lExpected = []
lExpected.append("")
utils.read_file(os.path.join(sTestDir, "rule_100_test_input.fixed.vhd"), lExpected)


class test_rule(unittest.TestCase):
def setUp(self):
self.oFile = vhdlFile.vhdlFile(lFile)
self.assertIsNone(eError)

def test_rule_100(self):
oRule = index_constraint.rule_100()
self.assertTrue(oRule)
self.assertEqual(oRule.name, "index_constraint")
self.assertEqual(oRule.identifier, "100")

lExpected = [4, 5, 13, 14]

oRule.analyze(self.oFile)
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))

def test_fix_rule_100(self):
oRule = index_constraint.rule_100()

oRule.fix(self.oFile)

lActual = self.oFile.get_lines()

self.assertEqual(lExpected, lActual)

oRule.analyze(self.oFile)
self.assertEqual(oRule.violations, [])
108 changes: 54 additions & 54 deletions tests/rule_list/extract_violation_dictionary_w_all_phases_enabled.json
Original file line number Diff line number Diff line change
Expand Up @@ -2646,6 +2646,60 @@
"severity": "Error",
"solution": "Insert blank line above"
},
{
"rule": "index_constraint_100",
"linenumber": 191,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 195,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 202,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 207,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 243,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 244,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 248,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 260,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "index_constraint_100",
"linenumber": 261,
"severity": "Error",
"solution": "Change the number of space(s) between std_logic_vector and ( to 0"
},
{
"rule": "length_001",
"linenumber": 12,
Expand Down Expand Up @@ -5250,60 +5304,6 @@
"severity": "Error",
"solution": "Remove spaces before close )."
},
{
"rule": "whitespace_008",
"linenumber": 191,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 195,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 202,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 207,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 243,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 244,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 248,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 260,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_008",
"linenumber": 261,
"severity": "Error",
"solution": "Remove spaces after std_logic_vector"
},
{
"rule": "whitespace_011",
"linenumber": 191,
Expand Down
Loading
Loading