Merge pull request #1380 from JHertz5/issue-1366
Issue#1366: Added structure rules for subprogram instantiation declarations
This commit is contained in:
commit
d3f6e80124
|
|
@ -173,6 +173,11 @@ Rules Enforcing Structure Rule Group
|
|||
* `signal_015 <../signal_rules.html#signal-015>`_
|
||||
* `signal_017 <../signal_rules.html#signal-017>`_
|
||||
* `source_file_001 <../source_file_rules.html#source-file-001>`_
|
||||
* `subprogram_instantiation_001 <../subprogram_instantiation_rules.html#subprogram-instantiation-001>`_
|
||||
* `subprogram_instantiation_002 <../subprogram_instantiation_rules.html#subprogram-instantiation-002>`_
|
||||
* `subprogram_instantiation_003 <../subprogram_instantiation_rules.html#subprogram-instantiation-003>`_
|
||||
* `subprogram_instantiation_004 <../subprogram_instantiation_rules.html#subprogram-instantiation-004>`_
|
||||
* `subprogram_instantiation_005 <../subprogram_instantiation_rules.html#subprogram-instantiation-005>`_
|
||||
* `subtype_005 <../subtype_rules.html#subtype-005>`_
|
||||
* `subtype_006 <../subtype_rules.html#subtype-006>`_
|
||||
* `type_008 <../type_rules.html#type-008>`_
|
||||
|
|
|
|||
|
|
@ -3,6 +3,106 @@
|
|||
Subprogram Instantiation Rules
|
||||
------------------------------
|
||||
|
||||
subprogram_instantiation_001
|
||||
############################
|
||||
|
||||
|phase_1| |error| |structure|
|
||||
|
||||
This rule checks the new subprogram identifier is on the same line as the **procedure** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure
|
||||
my_proc is new my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
|
||||
subprogram_instantiation_002
|
||||
############################
|
||||
|
||||
|phase_1| |error| |structure|
|
||||
|
||||
This rule checks the new subprogram identifier is on the same line as the **function** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
function
|
||||
my_func is new my_generic_func
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
function my_func is new my_generic_func
|
||||
|
||||
subprogram_instantiation_003
|
||||
############################
|
||||
|
||||
|phase_1| |error| |structure|
|
||||
|
||||
This rule checks the **is** keyword is on the same line as the new subprogram identifier.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc
|
||||
is new my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
|
||||
subprogram_instantiation_004
|
||||
############################
|
||||
|
||||
|phase_1| |error| |structure|
|
||||
|
||||
This rule checks the **new** keyword is on the same line as the **is** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is
|
||||
new my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
|
||||
subprogram_instantiation_005
|
||||
############################
|
||||
|
||||
|phase_1| |error| |structure|
|
||||
|
||||
This rule checks the uninstantiated subprogram name is on the same line as the **new** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new
|
||||
my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
|
||||
subprogram_instantiation_100
|
||||
############################
|
||||
|
||||
|
|
|
|||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function
|
||||
my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc
|
||||
is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function
|
||||
my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure
|
||||
my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func
|
||||
is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure
|
||||
my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function
|
||||
my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure
|
||||
my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func is
|
||||
new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is
|
||||
new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func
|
||||
is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc
|
||||
is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func is new
|
||||
my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new
|
||||
my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func is
|
||||
new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is
|
||||
new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func is new my_generic_func
|
||||
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,26 @@
|
|||
|
||||
package test is
|
||||
|
||||
function my_func is new my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
function my_func is new
|
||||
my_generic_func
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
procedure my_proc is new
|
||||
my_generic_proc
|
||||
generic map (
|
||||
test => 2
|
||||
);
|
||||
|
||||
end package test;
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from tests import utils
|
||||
from vsg import vhdlFile
|
||||
from vsg.rules import subprogram_instantiation
|
||||
|
||||
sTestDir = os.path.dirname(__file__)
|
||||
|
||||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_001_test_input.vhd"))
|
||||
|
||||
dIndentMap = utils.read_indent_file()
|
||||
|
||||
lExpected = []
|
||||
lExpected.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_001_test_input.fixed.vhd"), lExpected)
|
||||
|
||||
|
||||
class test_rule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oFile = vhdlFile.vhdlFile(lFile)
|
||||
self.assertIsNone(eError)
|
||||
self.oFile.set_indent_map(dIndentMap)
|
||||
|
||||
def test_rule_001(self):
|
||||
oRule = subprogram_instantiation.rule_001()
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "subprogram_instantiation")
|
||||
self.assertEqual(oRule.identifier, "001")
|
||||
|
||||
lExpected = [20]
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|
||||
|
||||
def test_fix_rule_001(self):
|
||||
oRule = subprogram_instantiation.rule_001()
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from tests import utils
|
||||
from vsg import vhdlFile
|
||||
from vsg.rules import subprogram_instantiation
|
||||
|
||||
sTestDir = os.path.dirname(__file__)
|
||||
|
||||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_002_test_input.vhd"))
|
||||
|
||||
dIndentMap = utils.read_indent_file()
|
||||
|
||||
lExpected = []
|
||||
lExpected.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_002_test_input.fixed.vhd"), lExpected)
|
||||
|
||||
|
||||
class test_rule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oFile = vhdlFile.vhdlFile(lFile)
|
||||
self.assertIsNone(eError)
|
||||
self.oFile.set_indent_map(dIndentMap)
|
||||
|
||||
def test_rule_002(self):
|
||||
oRule = subprogram_instantiation.rule_002()
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "subprogram_instantiation")
|
||||
self.assertEqual(oRule.identifier, "002")
|
||||
|
||||
lExpected = [14]
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|
||||
|
||||
def test_fix_rule_002(self):
|
||||
oRule = subprogram_instantiation.rule_002()
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from tests import utils
|
||||
from vsg import vhdlFile
|
||||
from vsg.rules import subprogram_instantiation
|
||||
|
||||
sTestDir = os.path.dirname(__file__)
|
||||
|
||||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_003_test_input.vhd"))
|
||||
|
||||
dIndentMap = utils.read_indent_file()
|
||||
|
||||
lExpected = []
|
||||
lExpected.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_003_test_input.fixed.vhd"), lExpected)
|
||||
|
||||
|
||||
class test_rule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oFile = vhdlFile.vhdlFile(lFile)
|
||||
self.assertIsNone(eError)
|
||||
self.oFile.set_indent_map(dIndentMap)
|
||||
|
||||
def test_rule_003(self):
|
||||
oRule = subprogram_instantiation.rule_003()
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "subprogram_instantiation")
|
||||
self.assertEqual(oRule.identifier, "003")
|
||||
|
||||
lExpected = [14, 20]
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|
||||
|
||||
def test_fix_rule_003(self):
|
||||
oRule = subprogram_instantiation.rule_003()
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from tests import utils
|
||||
from vsg import vhdlFile
|
||||
from vsg.rules import subprogram_instantiation
|
||||
|
||||
sTestDir = os.path.dirname(__file__)
|
||||
|
||||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_004_test_input.vhd"))
|
||||
|
||||
dIndentMap = utils.read_indent_file()
|
||||
|
||||
lExpected = []
|
||||
lExpected.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_004_test_input.fixed.vhd"), lExpected)
|
||||
|
||||
|
||||
class test_rule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oFile = vhdlFile.vhdlFile(lFile)
|
||||
self.assertIsNone(eError)
|
||||
self.oFile.set_indent_map(dIndentMap)
|
||||
|
||||
def test_rule_004(self):
|
||||
oRule = subprogram_instantiation.rule_004()
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "subprogram_instantiation")
|
||||
self.assertEqual(oRule.identifier, "004")
|
||||
|
||||
lExpected = [14, 20]
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|
||||
|
||||
def test_fix_rule_004(self):
|
||||
oRule = subprogram_instantiation.rule_004()
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
|
|
@ -0,0 +1,48 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
import os
|
||||
import unittest
|
||||
|
||||
from tests import utils
|
||||
from vsg import vhdlFile
|
||||
from vsg.rules import subprogram_instantiation
|
||||
|
||||
sTestDir = os.path.dirname(__file__)
|
||||
|
||||
lFile, eError = vhdlFile.utils.read_vhdlfile(os.path.join(sTestDir, "rule_005_test_input.vhd"))
|
||||
|
||||
dIndentMap = utils.read_indent_file()
|
||||
|
||||
lExpected = []
|
||||
lExpected.append("")
|
||||
utils.read_file(os.path.join(sTestDir, "rule_005_test_input.fixed.vhd"), lExpected)
|
||||
|
||||
|
||||
class test_rule(unittest.TestCase):
|
||||
def setUp(self):
|
||||
self.oFile = vhdlFile.vhdlFile(lFile)
|
||||
self.assertIsNone(eError)
|
||||
self.oFile.set_indent_map(dIndentMap)
|
||||
|
||||
def test_rule_005(self):
|
||||
oRule = subprogram_instantiation.rule_005()
|
||||
self.assertTrue(oRule)
|
||||
self.assertEqual(oRule.name, "subprogram_instantiation")
|
||||
self.assertEqual(oRule.identifier, "005")
|
||||
|
||||
lExpected = [14, 20]
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(lExpected, utils.extract_violation_lines_from_violation_object(oRule.violations))
|
||||
|
||||
def test_fix_rule_005(self):
|
||||
oRule = subprogram_instantiation.rule_005()
|
||||
|
||||
oRule.fix(self.oFile)
|
||||
|
||||
lActual = self.oFile.get_lines()
|
||||
|
||||
self.assertEqual(lExpected, lActual)
|
||||
|
||||
oRule.analyze(self.oFile)
|
||||
self.assertEqual(oRule.violations, [])
|
||||
|
|
@ -1,5 +1,10 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from .rule_001 import rule_001
|
||||
from .rule_002 import rule_002
|
||||
from .rule_003 import rule_003
|
||||
from .rule_004 import rule_004
|
||||
from .rule_005 import rule_005
|
||||
from .rule_100 import rule_100
|
||||
from .rule_101 import rule_101
|
||||
from .rule_102 import rule_102
|
||||
|
|
|
|||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from vsg import token
|
||||
from vsg.rules import move_token_next_to_another_token
|
||||
|
||||
|
||||
class rule_001(move_token_next_to_another_token):
|
||||
"""
|
||||
This rule checks the new subprogram identifier is on the same line as the **procedure** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure
|
||||
my_proc is new my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(token.subprogram_kind.procedure_keyword, token.subprogram_instantiation_declaration.identifier)
|
||||
self.solution = "Ensure the *procedure* keyword is on the same line as the new package identifier."
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from vsg import token
|
||||
from vsg.rules import move_token_next_to_another_token
|
||||
|
||||
|
||||
class rule_002(move_token_next_to_another_token):
|
||||
"""
|
||||
This rule checks the new subprogram identifier is on the same line as the **function** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
function
|
||||
my_func is new my_generic_func
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
function my_func is new my_generic_func
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(token.subprogram_kind.function_keyword, token.subprogram_instantiation_declaration.identifier)
|
||||
self.solution = "Ensure the *function* keyword is on the same line as the new package identifier."
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from vsg import token
|
||||
from vsg.rules import move_token_next_to_another_token
|
||||
|
||||
|
||||
class rule_003(move_token_next_to_another_token):
|
||||
"""
|
||||
This rule checks the **is** keyword is on the same line as the new subprogram identifier.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc
|
||||
is new my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(token.subprogram_instantiation_declaration.identifier, token.subprogram_instantiation_declaration.is_keyword)
|
||||
self.solution = "Ensure the *is* keyword is on the same line as the new subprogram identifier."
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from vsg.rules import move_token_next_to_another_token
|
||||
from vsg.token import subprogram_instantiation_declaration as token
|
||||
|
||||
|
||||
class rule_004(move_token_next_to_another_token):
|
||||
"""
|
||||
This rule checks the **new** keyword is on the same line as the **is** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is
|
||||
new my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(token.is_keyword, token.new_keyword)
|
||||
self.solution = "Ensure the *new* keyword is on the same line as the *is* keyword."
|
||||
|
|
@ -0,0 +1,27 @@
|
|||
# -*- coding: utf-8 -*-
|
||||
|
||||
from vsg.rules import move_token_next_to_another_token
|
||||
from vsg.token import subprogram_instantiation_declaration as token
|
||||
|
||||
|
||||
class rule_005(move_token_next_to_another_token):
|
||||
"""
|
||||
This rule checks the uninstantiated subprogram name is on the same line as the **new** keyword.
|
||||
|
||||
**Violation**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new
|
||||
my_generic_proc
|
||||
|
||||
**Fix**
|
||||
|
||||
.. code-block:: vhdl
|
||||
|
||||
procedure my_proc is new my_generic_proc
|
||||
"""
|
||||
|
||||
def __init__(self):
|
||||
super().__init__(token.new_keyword, token.uninstantiated_subprogram_name)
|
||||
self.solution = "Ensure the uninstantiated subprogram name is on the same line as the *new* keyword."
|
||||
Loading…
Reference in New Issue