From db485d1842742df36b565a43b6bdde1a809fd668 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Kruszewski?= Date: Fri, 3 Apr 2020 17:39:47 +0200 Subject: [PATCH] Adjust prefix/suffix rules to lowercase. --- docs/constant_rules.rst | 5 ++-- docs/generic_rules.rst | 9 +++---- docs/port_rules.rst | 42 +++++++++++++++----------------- docs/signal_rules.rst | 5 ++-- docs/subtype_rules.rst | 3 +-- docs/type_rules.rst | 5 ++-- docs/variable_rules.rst | 5 ++-- vsg/rules/generic/rule_020.py | 2 +- vsg/rules/port/rule_011.py | 2 +- vsg/rules/port/rule_025.py | 2 +- vsg/tests/port/test_rule_port.py | 2 +- 11 files changed, 37 insertions(+), 45 deletions(-) diff --git a/docs/constant_rules.rst b/docs/constant_rules.rst index 41f90b5a..723628c8 100644 --- a/docs/constant_rules.rst +++ b/docs/constant_rules.rst @@ -303,10 +303,9 @@ constant_015 ############ This rule checks for valid prefixes on constant identifiers. +The default constant prefix is *c\_*. -.. NOTE:: The default constant prefix is "c\_". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. **Violation** diff --git a/docs/generic_rules.rst b/docs/generic_rules.rst index d45c09e3..6216adcf 100644 --- a/docs/generic_rules.rst +++ b/docs/generic_rules.rst @@ -336,19 +336,18 @@ generic_020 ########### This rule checks for valid prefixes on generic identifiers. +The default generic prefix is *g\_*. -.. NOTE:: The default generic prefix is "G\_". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. **Violation** .. code-block:: vhdl - generic(MY_GEN : integer); + generic(my_generic : integer); **Fix** .. code-block:: vhdl - generic(G_MY_GEN : integer); + generic(g_my_generic : integer); diff --git a/docs/port_rules.rst b/docs/port_rules.rst index dc7f568e..55fafcbb 100644 --- a/docs/port_rules.rst +++ b/docs/port_rules.rst @@ -247,20 +247,19 @@ port_011 ######## This rule checks for valid prefixes on port identifiers. +The default port prefixes are: *i\_*, *o\_*, *io\_*. -.. NOTE:: The default port prefixes are "I\_", "O\_", "IO\_". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. **Violation** .. code-block:: vhdl port ( - WR_EN : in std_logic; - RD_EN : in std_logic; - OVERFLOW : out std_logic; - DATA : inout std_logic + wr_en : in std_logic; + rd_en : in std_logic; + overflow : out std_logic; + data : inout std_logic ); @@ -269,10 +268,10 @@ This rule checks for valid prefixes on port identifiers. .. code-block:: vhdl port ( - I_WR_EN : in std_logic; - I_RD_EN : in std_logic; - O_OVERFLOW : out std_logic; - IO_DATA : inout std_logic + i_wr_en : in std_logic; + i_rd_en : in std_logic; + o_overflow : out std_logic; + io_data : inout std_logic ); port_012 @@ -620,20 +619,19 @@ port_025 ######## This rule checks for valid suffixes on port identifiers. +The default port suffixes are *_i*, *_o*, *_io*. -.. NOTE:: The default port suffixes are "_I", "_O", "_IO". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed suffixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed suffixes. **Violation** .. code-block:: vhdl port ( - WR_EN : in std_logic; - RD_EN : in std_logic; - OVERFLOW : out std_logic; - DATA : inout std_logic + wr_en : in std_logic; + rd_en : in std_logic; + overflow : out std_logic; + data : inout std_logic ); @@ -642,8 +640,8 @@ This rule checks for valid suffixes on port identifiers. .. code-block:: vhdl port ( - WR_EN_I : in std_logic; - RD_EN_I : in std_logic; - OVERFLOW_O : out std_logic; - DATA_IO : inout std_logic + wr_en_i : in std_logic; + rd_en_i : in std_logic; + overflow_o : out std_logic; + data_io : inout std_logic ); diff --git a/docs/signal_rules.rst b/docs/signal_rules.rst index 14288bad..6f50f7d1 100644 --- a/docs/signal_rules.rst +++ b/docs/signal_rules.rst @@ -151,10 +151,9 @@ signal_008 ########## This rule checks for valid prefixes on signal identifiers. +Default signal prefix is *s\_*. -.. NOTE:: Default signal prefix is "s\_". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. **Violation** diff --git a/docs/subtype_rules.rst b/docs/subtype_rules.rst index 40da7fb4..5bdb75ea 100644 --- a/docs/subtype_rules.rst +++ b/docs/subtype_rules.rst @@ -95,8 +95,7 @@ subtype_004 ########### This rule checks for valid prefixes in user defined subtype identifiers. - -.. NOTE:: The default new subtype prefix is "st\_". +The default new subtype prefix is *st\_*. Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. diff --git a/docs/type_rules.rst b/docs/type_rules.rst index 59fe6476..c803bade 100644 --- a/docs/type_rules.rst +++ b/docs/type_rules.rst @@ -314,10 +314,9 @@ type_015 ########## This rule checks for valid prefixes in user defined type identifiers. +The default new type prefix is *t\_*. -.. NOTE:: The default new type prefix is "t\_". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. **Violation** diff --git a/docs/variable_rules.rst b/docs/variable_rules.rst index 85ced169..8c8a5f57 100644 --- a/docs/variable_rules.rst +++ b/docs/variable_rules.rst @@ -219,10 +219,9 @@ variable_012 ############ This rule checks for valid prefixes on variable identifiers. +The default variable prefix is *v\_*. -.. NOTE:: The default variable prefix is "v\_". - - Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. +Refer to the section `Configuring Prefix and Suffix Rules `_ for information on changing the allowed prefixes. **Violation** diff --git a/vsg/rules/generic/rule_020.py b/vsg/rules/generic/rule_020.py index 8c565c74..18aefd89 100644 --- a/vsg/rules/generic/rule_020.py +++ b/vsg/rules/generic/rule_020.py @@ -10,7 +10,7 @@ class rule_020(prefix_rule): def __init__(self): prefix_rule.__init__(self, 'generic', '020', 'isGenericDeclaration') - self.prefixes = ['G_'] + self.prefixes = ['g_'] self.solution = 'Generic' def _extract(self, oLine): diff --git a/vsg/rules/port/rule_011.py b/vsg/rules/port/rule_011.py index 4af06f71..535fea55 100644 --- a/vsg/rules/port/rule_011.py +++ b/vsg/rules/port/rule_011.py @@ -10,7 +10,7 @@ class rule_011(prefix_rule): def __init__(self): prefix_rule.__init__(self, 'port', '011', 'isPortDeclaration') - self.prefixes = ['I_', 'O_', 'IO_'] + self.prefixes = ['i_', 'o_', 'io_'] self.solution = 'Port' def _extract(self, oLine): diff --git a/vsg/rules/port/rule_025.py b/vsg/rules/port/rule_025.py index 9b2af93e..2a6daf54 100644 --- a/vsg/rules/port/rule_025.py +++ b/vsg/rules/port/rule_025.py @@ -10,7 +10,7 @@ class rule_025(suffix_rule): def __init__(self): suffix_rule.__init__(self, 'port', '025', 'isPortDeclaration') - self.suffixes = ['_I', '_O', '_IO'] + self.suffixes = ['_i', '_o', '_io'] self.solution = 'Port' def _extract(self, oLine): diff --git a/vsg/tests/port/test_rule_port.py b/vsg/tests/port/test_rule_port.py index 12569432..a9e98704 100644 --- a/vsg/tests/port/test_rule_port.py +++ b/vsg/tests/port/test_rule_port.py @@ -379,7 +379,7 @@ class testRulePortMethods(unittest.TestCase): self.assertEqual(oRule.identifier, '025') self.assertTrue(oRule.disable) - lExpected = utils.add_violation_list([9,10,11,12,13,14,26,27,28,29,30,31,40,41,42,43,44,45,57,58,59,60,61,62,71,72,73,74,75,76,87,88,89,119,120,121,129,130,131,141,142,152,161,169,170,171,172,173,181,182,183,184,185]) + lExpected = utils.add_violation_list([9,10,11,12,13,14,26,27,28,29,30,31,40,41,42,43,44,45,57,58,59,60,61,62,71,72,73,74,75,76,87,88,89,99,100,101,119,120,121,129,130,131,141,142,152,161,169,170,171,172,173,181,182,183,184,185]) oRule.analyze(oFile) self.assertEqual(oRule.violations, lExpected)