Issue#1285: Added case rules for protected type body declarations.

This commit is contained in:
JHertz5 2024-10-22 22:25:04 +01:00
parent 7807bdf865
commit c91f6eefe4
6 changed files with 162 additions and 0 deletions

View File

@ -0,0 +1,7 @@
# -*- coding: utf-8 -*-
from .rule_500 import rule_500
from .rule_501 import rule_501
from .rule_502 import rule_502
from .rule_503 import rule_503
from .rule_504 import rule_504

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_case
lTokens = []
lTokens.append(token.protected_type_body.protected_keyword)
class rule_500(token_case):
"""
This rule checks the **protected** keyword in **protected body** has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
type sharedcounter is PROTECTED body
**Fix**
.. code-block:: vhdl
type sharedcounter is protected body
"""
def __init__(self):
super().__init__(lTokens)
self.groups.append("case::keyword")

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_case
lTokens = []
lTokens.append(token.protected_type_body.body_keyword)
class rule_501(token_case):
"""
This rule checks the **body** keyword in **protected body** has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
type sharedcounter is protected BODY
**Fix**
.. code-block:: vhdl
type sharedcounter is protected body
"""
def __init__(self):
super().__init__(lTokens)
self.groups.append("case::keyword")

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_case
lTokens = []
lTokens.append(token.protected_type_body.end_keyword)
class rule_502(token_case):
"""
This rule checks the **end** keyword in **end protected body** has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
END protected body sharedcounter;
**Fix**
.. code-block:: vhdl
end protected body sharedcounter;
"""
def __init__(self):
super().__init__(lTokens)
self.groups.append("case::keyword")

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_case
lTokens = []
lTokens.append(token.protected_type_body.end_protected_keyword)
class rule_503(token_case):
"""
This rule checks the **protected** keyword in **end protected body** has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
end PROTECTED body sharedcounter;
**Fix**
.. code-block:: vhdl
end protected body sharedcounter;
"""
def __init__(self):
super().__init__(lTokens)
self.groups.append("case::keyword")

View File

@ -0,0 +1,31 @@
# -*- coding: utf-8 -*-
from vsg import token
from vsg.rules import token_case
lTokens = []
lTokens.append(token.protected_type_body.end_body_keyword)
class rule_504(token_case):
"""
This rule checks the **body** keyword in **end protected body** has proper case.
|configuring_uppercase_and_lowercase_rules_link|
**Violation**
.. code-block:: vhdl
end protected BODY sharedcounter;
**Fix**
.. code-block:: vhdl
end protected body sharedcounter;
"""
def __init__(self):
super().__init__(lTokens)
self.groups.append("case::keyword")