From 1ad29342c3eaaefbabd52aca1b91f4f162cde3ce Mon Sep 17 00:00:00 2001 From: JHertz5 Date: Sat, 21 Dec 2024 17:45:28 +0000 Subject: [PATCH] Issue#1364: Added rules subprogram_kind_500 and subprogram_kind_501. --- vsg/rules/__init__.py | 1 + vsg/rules/subprogram_kind/__init__.py | 4 +++ vsg/rules/subprogram_kind/rule_500.py | 35 +++++++++++++++++++++++++++ vsg/rules/subprogram_kind/rule_501.py | 35 +++++++++++++++++++++++++++ 4 files changed, 75 insertions(+) create mode 100644 vsg/rules/subprogram_kind/__init__.py create mode 100644 vsg/rules/subprogram_kind/rule_500.py create mode 100644 vsg/rules/subprogram_kind/rule_501.py diff --git a/vsg/rules/__init__.py b/vsg/rules/__init__.py index c4fe7c32..8f99aed3 100644 --- a/vsg/rules/__init__.py +++ b/vsg/rules/__init__.py @@ -180,6 +180,7 @@ from vsg.rules import signal from vsg.rules import shift_operator from vsg.rules import source_file from vsg.rules import subprogram_body +from vsg.rules import subprogram_kind from vsg.rules import subtype from vsg.rules import type_definition from vsg.rules import use_clause diff --git a/vsg/rules/subprogram_kind/__init__.py b/vsg/rules/subprogram_kind/__init__.py new file mode 100644 index 00000000..3c6ea275 --- /dev/null +++ b/vsg/rules/subprogram_kind/__init__.py @@ -0,0 +1,4 @@ +# -*- coding: utf-8 -*- + +from .rule_500 import rule_500 +from .rule_501 import rule_501 diff --git a/vsg/rules/subprogram_kind/rule_500.py b/vsg/rules/subprogram_kind/rule_500.py new file mode 100644 index 00000000..3e739263 --- /dev/null +++ b/vsg/rules/subprogram_kind/rule_500.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +from vsg import token +from vsg.rules import token_case + +lTokens = [] +lTokens.append(token.subprogram_kind.procedure_keyword) + + +class rule_500(token_case): + """ + This rule checks that the **procedure** keyword in subprogram kinds has the proper case. + + |configuring_uppercase_and_lowercase_rules_link| + + **Violation** + + .. code-block:: vhdl + + end PROCEDURE parity; + + PROCEDURE my_proc is new my_generic_proc + + **Fix** + + .. code-block:: vhdl + + end PROCEDURE parity; + + PROCEDURE my_proc is new my_generic_proc + """ + + def __init__(self): + super().__init__(lTokens) + self.groups.append("case::keyword") diff --git a/vsg/rules/subprogram_kind/rule_501.py b/vsg/rules/subprogram_kind/rule_501.py new file mode 100644 index 00000000..4cc1e3a1 --- /dev/null +++ b/vsg/rules/subprogram_kind/rule_501.py @@ -0,0 +1,35 @@ +# -*- coding: utf-8 -*- + +from vsg import token +from vsg.rules import token_case + +lTokens = [] +lTokens.append(token.subprogram_kind.function_keyword) + + +class rule_501(token_case): + """ + This rule checks that the **function** keyword in subprogram kinds has the proper case. + + |configuring_uppercase_and_lowercase_rules_link| + + **Violation** + + .. code-block:: vhdl + + end FUNCTION parity; + + FUNCTION my_func is new my_generic_func + + **Fix** + + .. code-block:: vhdl + + end FUNCTION parity; + + FUNCTION my_func is new my_generic_func + """ + + def __init__(self): + super().__init__(lTokens) + self.groups.append("case::keyword")