.. _configuring-uppercase-and-lowercase-rules: Configuring Uppercase and Lowercase Rules ----------------------------------------- There are several rules that enforce upper_or_lower, uppercase or lowercase. There are several options to these rules: .. |case_option| replace:: :code:`case` .. |upper_value| replace:: :code:`upper` .. |lower_value| replace:: :code:`lower` .. |upper_or_lower_value| replace:: :code:`upper_or_lower` .. |camelCase_value| replace:: :code:`camelCase` .. |PascalCase_value| replace:: :code:`PascalCase` .. |regex_value| replace:: :code:`regex` .. |case_option__upper| replace:: |upper_value| = Enforce upper case .. |case_option__lower| replace:: |lower_value| = Enforce lower case .. |case_option__upper_or_lower| replace:: |upper_or_lower_value| = Allow upper or lower case .. |case_option__camelCase| replace:: |camelCase_value| = Enforce camelCase .. |case_option__PascalCase| replace:: |PascalCase_value| = Enforce PascalCase .. |case_option__regex| replace:: |regex_value| = Enforce user defined regex .. |case_values| replace:: |upper_value|, |lower_value|, |upper_or_lower_value|, |camelCase_value|, |PascalCase_value|, |regex_value| .. |case_default_value| replace:: |lower_value| .. |prefix_exceptions_option| replace:: :code:`prefix_exceptions` .. |pe_values| replace:: List of strings .. |pe_default_value| replace:: Empty list .. |pe_description| replace:: Enforce exception case on prefix if encountered. .. |suffix_exceptions_option| replace:: :code:`suffix_exceptions` .. |se_values| replace:: List of strings .. |se_default_value| replace:: Empty list .. |se_description| replace:: Enforce exception case on suffix if encountered. .. |case_exceptions_option| replace:: :code:`case_exceptions` .. |ce_values| replace:: List of strings .. |regex_values| replace:: String .. |ce_default_value| replace:: Empty list .. |regex_default_value| replace:: Empty String .. |ce_description| replace:: Enforce case for items in the list. .. |regex_option| replace:: :code:`regex` .. |regex_description| replace:: Enforce case based on regex string +----------------------------+------------------------+-----------------------+-----------------------------------+ | Option | Values | Default Value | Description | +============================+========================+=======================+===================================+ | |case_option| | |case_values| | |case_default_value| | * |case_option__upper| | | | | | * |case_option__lower| | | | | | * |case_option__upper_or_lower| | | | | | * |case_option__camelCase| | | | | | * |case_option__PascalCase| | | | | | * |case_option__regex| | +----------------------------+------------------------+-----------------------+-----------------------------------+ | |prefix_exceptions_option| | |pe_values| | |pe_default_value| | |pe_description| | +----------------------------+------------------------+-----------------------+-----------------------------------+ | |suffix_exceptions_option| | |se_values| | |se_default_value| | |se_description| | +----------------------------+------------------------+-----------------------+-----------------------------------+ | |case_exceptions_option| | |ce_values| | |ce_default_value| | |ce_description| | +----------------------------+------------------------+-----------------------+-----------------------------------+ | |regex_option| | |regex_values| | |regex_default_value| | |regex_description| | +----------------------------+------------------------+-----------------------+-----------------------------------+ This is an example of how to configure these options. .. code-block:: yaml rule : architecture_004: case: 'lower' prefix_exceptions: - 'G_' suffix_exceptions: - '_G' case_exceptions: - 'IEEE' regex: '' The following code snippet is used in the following examples: .. code-block:: vhdl constant c_DATA_width : positive := 32; constant addr_WIDTH_c : positive := 8; .. NOTE:: The following examples use rule `constant_004`. Example: |case_option| set to |lower_value| ########################################### .. code-block:: vhdl constant c_data_width : positive := 32; constant addr_width_c : positive := 8; Example: |case_option| set to |upper_value| ########################################### .. code-block:: vhdl constant C_DATA_WIDTH : positive := 32; constant ADDR_WIDTH_C : positive := 8; Example: |case_option| set to |upper_or_lower_value| #################################################### This option will not perform any updates to the code as the case could be either upper or lower. .. code-block:: vhdl constant c_DATA_width : positive := 32; constant addr_WIDTH_c : positive := 8; Example: |case_option| set to |upper_value| and |prefix_exceptions_option| set to :code:`c_` ############################################################################################ .. code-block:: vhdl constant c_DATA_WIDTH : positive := 32; constant ADDR_WIDTH_C : positive := 8; Example: |case_option| set to |upper_value| and |suffix_exceptions_option| set to :code:`_c` ############################################################################################ .. code-block:: vhdl constant C_DATA_WIDTH : positive := 32; constant ADDR_WIDTH_c : positive := 8; Example: |case_option| set to |upper_value| and |case_exceptions_option| set to :code:`addr_WIDTH_c` #################################################################################################### .. code-block:: vhdl constant C_DATA_WIDTH : positive := 32; constant addr_WIDTH_c : positive := 8; Example: |case_option| set to |regex_value| and |regex_option| set to :code:`[A-Z][A-Za-z\d]*` ############################################################################################## The following constant identifiers would pass with the defined regular expression. .. code-block:: vhdl constant SPIAccess : std_logic; constant ADCRegisters : std_logic; Example: Changing Multiple Case Rules ##################################### If there are a lot of case rules you want to change, you can use the global option to reduce the size of the configuration. For example, if you want to uppercase everything except the entity name, you could write the following configuration: .. code-block:: yaml rule : global : case : 'upper' entity_008 : case : 'lower' Rules Enforcing Case #################### * `aggregate_500 `_ * `alias_declaration_500 `_ * `alias_declaration_501 `_ * `alias_declaration_502 `_ * `architecture_004 `_ * `architecture_009 `_ * `architecture_011 `_ * `architecture_013 `_ * `architecture_014 `_ * `architecture_019 `_ * `architecture_020 `_ * `architecture_021 `_ * `architecture_028 `_ * `assert_500 `_ * `assert_501 `_ * `assert_502 `_ * `attribute_500 `_ * `attribute_declaration_500 `_ * `attribute_declaration_501 `_ * `attribute_declaration_502 `_ * `attribute_specification_500 `_ * `attribute_specification_501 `_ * `attribute_specification_502 `_ * `attribute_specification_503 `_ * `bit_string_literal_500 `_ * `bit_string_literal_501 `_ * `block_500 `_ * `block_501 `_ * `block_502 `_ * `block_503 `_ * `block_504 `_ * `block_505 `_ * `block_506 `_ * `case_014 `_ * `case_015 `_ * `case_016 `_ * `case_017 `_ * `case_018 `_ * `case_500 `_ * `case_generate_alternative_500 `_ * `case_generate_alternative_501 `_ * `case_generate_statement_500 `_ * `case_generate_statement_501 `_ * `component_004 `_ * `component_006 `_ * `component_008 `_ * `component_010 `_ * `component_012 `_ * `component_014 `_ * `conditional_expressions_500 `_ * `conditional_expressions_501 `_ * `conditional_waveforms_500 `_ * `conditional_waveforms_501 `_ * `constant_002 `_ * `constant_004 `_ * `context_004 `_ * `context_012 `_ * `context_013 `_ * `context_014 `_ * `context_015 `_ * `context_016 `_ * `context_ref_003 `_ * `context_ref_500 `_ * `context_ref_501 `_ * `entity_004 `_ * `entity_006 `_ * `entity_008 `_ * `entity_010 `_ * `entity_012 `_ * `entity_014 `_ * `entity_500 `_ * `entity_specification_500 `_ * `entity_specification_501 `_ * `entity_specification_503 `_ * `exit_statement_500 `_ * `exit_statement_501 `_ * `exponent_500 `_ * `external_constant_name_500 <../external_constant_name_rules.html#external-constant-name-500>`_ * `external_signal_name_500 <../external_signal_name_rules.html#external-signal-name-500>`_ * `external_variable_name_500 <../external_variable_name_rules.html#external-variable-name-500>`_ * `file_002 `_ * `for_generate_statement_500 `_ * `for_generate_statement_501 `_ * `for_generate_statement_502 `_ * `function_004 `_ * `function_005 `_ * `function_013 `_ * `function_014 `_ * `function_017 `_ * `function_501 `_ * `function_502 `_ * `function_506 `_ * `function_507 `_ * `function_509 `_ * `function_510 `_ * `function_511 `_ * `function_512 `_ * `generate_005 `_ * `generate_009 `_ * `generate_010 `_ * `generate_012 `_ * `generate_500 `_ * `generate_501 `_ * `generic_007 `_ * `generic_009 `_ * `generic_017 `_ * `generic_map_001 `_ * `generic_map_002 `_ * `ieee_500 `_ * `if_generate_statement_500 `_ * `if_generate_statement_501 `_ * `if_generate_statement_502 `_ * `if_generate_statement_503 `_ * `if_025 `_ * `if_026 `_ * `if_027 `_ * `if_028 `_ * `if_029 `_ * `if_034 `_ * `instantiation_008 `_ * `instantiation_009 `_ * `instantiation_027 `_ * `instantiation_028 `_ * `instantiation_031 `_ * `instantiation_500 `_ * `iteration_scheme_500 `_ * `iteration_scheme_501 `_ * `iteration_scheme_502 `_ * `library_004 `_ * `library_005 `_ * `library_500 `_ * `logical_operator_500 `_ * `loop_statement_500 `_ * `loop_statement_501 `_ * `loop_statement_502 `_ * `loop_statement_503 `_ * `loop_statement_504 `_ * `next_statement_500 `_ * `next_statement_501 `_ * `null_statement_500 `_ * `package_004 `_ * `package_006 `_ * `package_008 `_ * `package_010 `_ * `package_013 `_ * `package_018 `_ * `package_body_500 `_ * `package_body_501 `_ * `package_body_502 `_ * `package_body_503 `_ * `package_body_504 `_ * `package_body_505 `_ * `package_body_506 `_ * `package_body_507 `_ * `port_010 `_ * `port_017 `_ * `port_018 `_ * `port_019 `_ * `port_map_001 `_ * `port_map_002 `_ * `procedure_008 `_ * `procedure_009 `_ * `procedure_500 `_ * `procedure_501 `_ * `procedure_502 `_ * `procedure_503 `_ * `procedure_504 `_ * `procedure_505 `_ * `procedure_506 `_ * `procedure_508 `_ * `procedure_510 `_ * `procedure_511 `_ * `procedure_call_500 `_ * `procedure_call_501 `_ * `procedure_call_502 `_ * `process_004 `_ * `process_005 `_ * `process_008 `_ * `process_009 `_ * `process_013 `_ * `process_017 `_ * `process_019 `_ * `protected_type_500 `_ * `protected_type_501 `_ * `protected_type_502 `_ * `protected_type_body_500 `_ * `protected_type_body_501 `_ * `protected_type_body_502 `_ * `protected_type_body_503 `_ * `protected_type_body_504 `_ * `range_001 `_ * `range_002 `_ * `record_type_definition_500 `_ * `record_type_definition_501 `_ * `record_type_definition_502 `_ * `report_statement_500 `_ * `report_statement_501 `_ * `return_statement_500 `_ * `selected_assignment_500 `_ * `selected_assignment_501 `_ * `selected_assignment_502 `_ * `selected_assignment_503 `_ * `signal_002 `_ * `signal_004 `_ * `subtype_500 <../subtype_rules.html#subtype-500>`_ * `subtype_501 <../subtype_rules.html#subtype-501>`_ * `subtype_502 <../subtype_rules.html#subtype-502>`_ * `type_002 `_ * `type_004 `_ * `type_013 `_ * `type_500 `_ * `use_clause_500 `_ * `use_clause_501 `_ * `use_clause_502 `_ * `use_clause_503 `_ * `variable_002 `_ * `variable_004 `_ * `wait_500 `_ * `wait_501 `_ * `wait_502 `_ * `wait_503 `_