vhdl-style-guide/vsg/rules/if_statement/rule_022.py

31 lines
776 B
Python

from vsg.rules import insert_carriage_return_after_token_if_it_is_not_followed_by_a_comment
from vsg.token import if_statement as token
lTokens = []
lTokens.append(token.else_keyword)
class rule_022(insert_carriage_return_after_token_if_it_is_not_followed_by_a_comment):
'''
This rule checks for code after the **else** keyword.
**Violation**
.. code-block:: vhdl
if (a = '1') then c <= '1'; else c <= '0'; end if;
**Fix**
.. code-block:: vhdl
if (a = '1') then c <= '1'; else
c <= '0'; end if;
'''
def __init__(self):
insert_carriage_return_after_token_if_it_is_not_followed_by_a_comment.__init__(self, 'if', '022', lTokens)
self.solution = 'Move code after *else* keyword to the next line.'