Commit Graph

77 Commits

Author SHA1 Message Date
Benjamin Thiemann 068f9102ef
Issue#1451: Fixed array detection and parenthesis handling in multiline_alignment_between_tokens (#1468)
* Issue#1451: Fixed array detection in multiline_alignment_between_tokens

* Move function toi_is_array from multiline_simple_structure to the 
  utils module and use this function in 
  multiline_alignment_between_tokens, because it correctly classifies
  parenthesis of aggregates. The previous function there falsely 
  triggered array detection on parenthesis around logical operators.

* Rename "check_for_array" to "skip_array", because that is what the 
  variable is used to do.

* Extend tests for concurrent_003 with logical expressions that start 
  with a parenthesis.

* Issue#1451: Fixed parenthesis handling in multiline_alignment_between_tokens

Do not add parenthesis pairs to the list of occurring parenthesis if
they are on the same line.
2025-09-02 21:18:33 -05:00
malsheimer 4cb3be55f5
add new rule_015 for variables (#1440)
This rule checks for multiple (shared) variable names defined in a single (shared) variable declaration.
By default, this rule will only flag more than two (shared) variable declarations.
2025-07-10 07:07:58 -05:00
malsheimer 6a68806d9e
Add new rule variable_500 to check case of keyword "shared" (#1464) 2025-07-08 19:43:04 -05:00
JHertz5 97bd50c547 Merge remote-tracking branch 'origin/master' into issue-1232 2024-12-30 09:37:47 +00:00
JHertz5 a2519e4b1a Issue#1377: Improved consistency of formatting of keywords in documentation. 2024-12-28 17:06:35 +00:00
Jukka Hertzog aa1fac5054
Merge branch 'jeremiah-c-leary:master' into issue-1232 2024-12-13 22:22:34 +00:00
Jukka Hertzog 139ec20a15
Issue#1335: Update variable_011 to act on association element actual parts. 2024-11-20 11:28:31 +00:00
JHertz5 4066052ad5 Issue#1232: Documentation and docstring updates. 2024-09-28 17:39:11 +01:00
JHertz5 49a4924be3
Issue#1220: Documentation typo and link fixes. (#1221) 2024-09-08 19:41:38 -05:00
Jeremiah Leary 631d39c246
Issue#1186: Additional whitespace rules added. (#1192)
* Issue#1186:  Additional whitespace rules added.

* Fixing style issues.
2024-07-12 03:19:06 -05:00
Alon Bar-Lev c22a86025f style: apply black
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev 5b4bae04aa style: apply isort
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev b8c49b5946 style: python encoding
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02:00
Alon Bar-Lev f9c2653e54 style: apply codespell
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:34 +02:00
Alon Bar-Lev b4d5c4e5d6 cleanup: use super() to call parent
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-23 18:48:35 +02:00
Alon Bar-Lev 599b2443ef docstring: remove unsupported escape sequences
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-23 18:48:25 +02:00
Jeremiah Leary 888b4e9ec4
Issue#1137: Fixing rules variable_011 and variable_assignment_008. (#1138) 2024-03-09 18:26:41 -06:00
JHertz5 431cdb92c5
Issue#1117 Modifed initialisation of the `Rule` class's `name` and `identifier` attributes to reduce duplication. (#1118)
* Issue#1117 Modifed initialisation of the `Rule` class's `identifier` property to reduce duplication.

* Issue#1117 Modifed initialisation of the `Rule` class's `unique_id` property to make the `identifier` input redundant.

* Issue#1117: Updated Rule.name attribute to be initialised from the class's `__module__` variable.
Modified `deprecated_rule` to not initialise `name` and `identifier` attributes.
Modified rule_localized_001 to force the local rule's `name` since this can't be extracted from the module.
Modified test_rule to force Rule's `name`, `identifier` and `unique_id` in some tests.

* Issue#1117: Removed now-redundant name and identifier input arguments on rule `__init__` methods.
Updated rule_localized_001 to force the rule's name.
Update the local rules documentation.

* Issue#1117: Removed unused exception in get_rule_name.

* Issue#1117: Updates after merging master.

* Converting match case to if statement to support python pre version 3.10Converting match case to if statement to support python pre version 3.10.

---------

Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
2024-02-04 15:23:23 -06:00
Jeremiah Leary dd644d442d
Issue#551: Fixing scoping of consistent token case rules. (#1052)
* Issue#551:  Fixing scoping of consistent token case rules.

Issue#755:
Issue#998:
Issue#1023

* Updating additional consistent case rules:

  1)  architecture_600
  2)  entity_600
2024-01-21 12:36:29 -06:00
Jeremiah Leary e1282048bf
Issue 815 (#840)
* Updates for issue #815

Adding disabled rule constant_101

* Adding disabled rule variable_100

* Adding disabled rule signal_100

* Adding disabled rule alias_declaration_103.

* Adding disabled rule file_100.

* Adding disabled rule subtype_100.

* Adding disabled rule type_100.

* Adding rule signal_101.

* Adding rule signal_102.

* Adding more rules to enable correct aligment:

  1)  architecture_401
  2)  constant_200
  3)  signal_200
  4)  type_200

* Updated a couple of rules:

  1)  Added option to architecture_026 to optionally align type is keywords
  2)  Removed duplicate rule architecture_401
2023-12-09 08:03:07 -06:00
Jeremiah Leary d66da9a6a8
Issue 549a (#839)
* Updates for issue #549

Refactoring concurrent_011 into base rule multiline_simple_structure.

* Refactoring concurrent_009 into base rule multiline_conditional_alignment.

* Fixing name and identifier.

* Refactoring rule constant_012 into base rule multiline_array_alignment.

* Adding rule variable_assignment_007.

* Adding rule variable_assignment_008

  1)  Refactored multiline_structure to be configurable
  2)  Added documentation
  3)  Added tests

* Adding rule variable_assignment_400.

* Adding rule variable_assignment_400.

* Updating Documentation

  1)  Adding files which were not being built
  2)  Fixed links

* Adding rule concurrent_012.

* Adding rule concurrent_401

* Adding rule sequential_008.

* Adding rule sequential_009.

* Adding rule sequential_401

* Adding rule sequential_402

* Fixing documentation

* Fixing table rendering.

* Changing multiline_alignment_between_tokens to not work on arrays.

* Updating rule concurrent_011 to not operate on arrays.

* Fixing documentation issues:

  1)  Renamed several rules to improve readability
  2)  Fixed warnings from sphynx
  3)  Fixing links

* Adding links to rules.

* Updating docstring with correct links to configuration documentation.

* Updating formatting to match current standards.

* Updating formatting to current standard.

* Changing depricated to deprecated.

* Removing unused documentation.

* Updating table to current standards.

* Updating to latest standard.

* Updating to current formatting standards.

* Updating multiline indent rule:

  1)  Updated documentation
  2)  Added align left no align paren on tests
  3)  Updated the following options:
      a)  align_left_yes_align_paren_yes
  4)  Updated docstrings to have correct links.

* Adding example for align_left_no_align_paren_yes.

* Updating documentation per comments.

* Updating documentation per comments.

* Removing option move_last_comment from multiline_structure base rule.
2022-10-20 18:24:42 -05:00
Jeremiah Leary 7225df8b9d
Updates for issue #539 (#751)
* Updates for issue #539

Adding multiline structural rule for rule signal_016.

  1)  Added test cases
  2)  Update rule signal_016
  3)  Updated documentation

* Adding test for arrays.

* Adding functions to combine slices into a single object

* Adding array_first_paren_new_line option.

* Removing unused code.

* Adding tests for the following parameter options:

  1)  array_first_paren_new_line (yes/no)
  2)  first_paren_new_line (yes/no)

* Adding documentation for configuring multiline constraint rules.

* Minor grammar updates.

* Updating per feedback:

  1)  Made symbols in table with a transparent background
  2)  Minor grammar updates
  3)  Fixed indenting in code examples

* Adding correct red penta star png file.

* Upated third example to correctly show behavior.

* Updated figure with correct indenting.
Fixed indenting in example 2.

* Adjusting indent on example 3 and example 4.

* Initial rewrite to classify constraints.

* Converting variable_declaration to call subtype_indication.classify.

* Changing constant_declaration to use subtype_indication.classify

* Changing unbounded_array_definition to use subtype_indication.classify

* Changing subtype_declaration to use subtype_indication.classify

* Changed interface_variable_declaration to call subtype_indication.classify

* Changing the following to use subtype_indication.classify:

  interface_constant_declaration
  interface_file_declaration
  interface_signal_declaration
  interface_unkown_declaration

* Changing the following to use subtype_indication.classify:

  constrained_array_definition

* Changing the following to use subtype_indication.classify

  element_subtype_definition

* Changing the following to use subtype_indication.classify:

  alias_declaration

* removing commented out line.

* Changing the following to use subtype_indication.classify:

  file_declaration

* Changing the following to use subtype_indication.classify

  access_type_definition

* Removing subtype_indication.classify_until

* Initial commit of rule signal_017

  * Implemented record_constraint_open_paren = add_new_line

* Minor refactoring.

* Extracted the following functions:

  _check_add_new_line
  _token_at_beginning_of_line

* Adding the following options to rule signal_017

  *  record_constraint_open_paren :: remove_new_line

* Adding the following options:

  record_constraint_close_paren :: add_new_line
  record_constraint_close_paren :: remove_new_line

* Adding the following options:

  record_constraint_comma :: remove_new_line

* Adding the following option:

  record_constraint_element :: add_new_line
  record_constraint_element :: remove_new_line

* Adding the following option:

  * array_constraint :: all_in_one_line

* Fixing issue with array_constraint::all_in_one_line not detecting multiline array_constraints.

* Adding the following options:

  array_constraint :: one_line_per_dimension

* Adding rule signal_400 to handle indenting of multiline signal constraints.

* Fixing issues for Codacy.

* Refactoring to reduce complexity and improve readability.

* Adding links to new rules.

* Refactoring to improve readability.

* Refactoring to improve readability.

* Fixing style issues.

* Updating for style issues.

* Updating formatting issues.

* Removing unused file.

* Removing commented out debug statements.

* Minor formatting updates.

* Adding metadata attribute and methods.

* Refactoring _check_array_contraint_one_line_per_dimension function to improve readability.

* Refactoring _check_array_constraint_all_in_one_line function to improve readability.

* Refactoring _create_violation to just take oToi as a parameter.

* Adding exception logic.

* Refactoring to improve readability.

* Refactored analyze_exception_one to improve readability.

* Refactoring the following functions:

  * _check_array_constraint_all_in_one_line
  * _check_array_constraint_one_line_per_dimension

* Refactoring the following functions:

  *  add_index_constraint_open_parenthesis
  *  add_index_constraint_close_parenthesis
  *  add_record_constraint_open_parenthesis
  *  add_record_constraint_close_parenthesis

* Refactoring to improve readability.

* Minor formatting updates.

* Adjusting signal_400 to remove extra level of indent.

* Updates for rule signal_400:

  1)  Modified base rule multiline_alignment_between_tokens to support signal_400
  2)  Added tests for the four variants of options.

* Fixing style issues.

* Simplifying _check_new_line_after_comma function.

* Deprecating rule signal_016.

* Removing unused base rule multiline_declaration_structure.

* Style and minor refactorings.

* Moving filtering of toi's from _analyze to _get_tokens_of_interest.

* Extracted update_open_paren_counter from _classify_assignment

* Extracted update_close_paren_counter form _classify_assignment

* Refactoring _fix_violation to reduce complexity

* Refactored _create_violation:

  1)  Placed violation information into oToi object

* Refactoring to reduce complexity.

* Adding rule constant_017

* Adding rule variable_017

* Updating links to rules.

* Adding rule variable_400.

* Minor cleanup of documentation.

* Adding default values for options.

* Minor updates for formatting:
2022-07-08 08:26:29 -05:00
Jeremiah Leary c203f3bc64
Updates for Issue 775 (#782)
* Updates for issue #775

Adding configurable whitespace rule:

  1)  Added preliminary documentaton
  2)  Added test
  3)  Updated whitespace rule to allow for configurations of more than one space

* Extracting functions from _analyze method.

* Adding feature to handle min and max not equal.

* Extracting function from analyze methods.

* Combined min and max values into a single option.

* Adding greater than and greater than or equal to options.

* Migrating rule entoty_007 to use whitespace_between_tokens.

* Migrating rule entity_002 to use whitespace_between_tokens.

* Migrating rule entity_011 to whitespace_between_tokens.

* Migrating rule entity_013 to whitespace_between_tokens.

* Adding link to configuring whitespace rules.

* Converting single_space_between_tokens rules to whitespace_between_tokens rules.

* Removing unused base rule single_space_between_tokens

* Refactoring single_space_between_token_pairs to extend whitespace_between_tokens.

* Adding link to individual rules.

* Renaming single_space_between_token_pairs to whitespace_between_token_pairs.

* Updating documentation.

* Refactoring single_space_after_token to extend white_space_between_tokens.

* Renaming single_space_after_token to whitespace_after_token.

* Updating documentation.

* Migrating single_space_before_token_if_on_same_line_as_token to extend whitespace_between_tokens.

* Changing name of single_space_before_token_if_on_same_line_as_token to whitespace_before_token_if_on_same_line_as_token.

* Removing unused rule.

* Removing n_spaces_after_tokens and replacing it with whitespace_after_tokens.

* Removing rule single_space_before_token.

  1)  Replaced with whitespace_before_token
  2)  whitespace_before_token now extends whitespace_between_tokens

* Refactoring whitespace_before_token rule.
Updating documentation.

* Making single_space_between_token_pairs_bounded_by_tokens extend whitespace_between_tokens.

* Refactoring to improve usability.

* Refactoring whitespace_before_tokens_in_between_tokens to improve usability.

* Formatting updates.

* Refactoring to improve readability.

* Adding [0-9][0-9]*+ as a configuration option for number_of_spaces.
2022-06-03 08:03:11 -05:00
Jeremiah Leary c2014549a7
Updates for issue #729 (#731)
* Updates for issue #729

Added rule ieee_500 to handle case of ieee keywords.

* Minor formatting updates.
Moved similar token classifications from name, subtype_indication and expression to utils.

* Fixing doc string.

* Deprecating rule signal_010.

* Deprecating rule signal_011.

* Deprecated rule constant_011.

* Deprecating rule variable_010.

* Removing trailing whitespace.

* Moving method to utils.

* Refactored method into function and placed it in utils.

* Refactoring to remove duplication.

* Fixing indenting.
2022-02-09 20:16:02 -06:00
Jeremiah Leary ad87ea65ee Changing links to configuration documentation into ReST substitations.
Re-ordered configuration documentation entries so they are alphabetical.
2022-02-05 15:13:48 -06:00
Jeremiah Leary a820c8a30f Updates for issue #704 and #720:
Fixing broken links from rules back to configuration documentation.
2022-02-05 10:04:55 -06:00
Jeremiah Leary f8f5f77c58
Updates for issue #651 (#662)
* Updates for issue #651

Initial attempt at adding rule groups.

  1)  Updated documentation
  2)  Added indent group
  3)  Added tests

* Addressing CodeClimate issues.

* Additional code climate updates.

* Renaming depricated to deprecated.

Adding tests to improve code coverage.

* Adding length group and updating documentation.

* Adding indent labels to rule documentation.

* Adding blank_line group.

* Minor documentation update.

* Adding more rules to the blank_line group.

* Adding blank_line label to blank line rules in documentation.

* Adding whitespace rule group

* Adding case group.

* Adding structure rule group:

  1)  Addings structure rule group object
  2)  Updated base rules which should utilize the rule group

* Adding more base rules to the whitespace rule group.

* Adding more base rules to the case rule group.

* Adding naming rule group:

  1)  Added naming rule group
  2)  Assigned base rules to the naming rule group

* Adding alignment rule group:

  1)  Added alignment rule group
  2)  Added base rules to alignment rule group

* Assigning more rules to rule groups.

* Adding last rule to a rule group.
Fixing error introduced into whitespace_001

* Assigning sub groups to architecture rules.

* Updating after rules documentation to add rule group.

* Adding rule group to assert rule documentation

* Updating attribute_declaration rules rule group.

* Adding program to generate rule documentation:

  1)  Added bin/vsg_rule_doc_gen
  2)  Added tests
  3)  Copied existing documentation into rule doc strings for the following rule classes:
      a)  after
      b)  architecture
      c)  assert_statement
      d)  attribute
      e)  attribute_declaration
      f)  attribute_specification
      g)  block
  4)  Partially update deprecated rules to they could be processed

* Converting block_comment documentation.

* Converting case_rule documentation.

* Converting comment rule documentation.

* Converting component documentation to doc strings.

* Converting concurrent rule documentation to doc strings.

* Convert constant docs to doc strings.

* Converting context rule doc to doc strings.

* Fixing failing tests.

* Converting context reference doc to doc strings.

* Converting entity doc rules to doc strings.

* Converting entity_specification rule doc to doc strings.

* Converting exit_statement rule doc to doc strings.

* Converting file_statement rule docs into doc strings.

* Converting for_loop rule doc to doc strings.

* Converting function rule doc to doc strings.

* Converting generate rules doc to doc strings.

* Converting generic rule doc to doc strings.

* Converting generic_map rule doc to doc strings.

* Converting if rule docs to doc strings.

* Converting instantiation rule doc to doc strings.

* Converting length rule doc to doc strings.

* Converting library rule doc to doc strings.

* Convert loop_statement rule doc to doc strings.

* Converting package rule docs to doc strings.

* Converting package_body rule doc to doc strings.

* Converting port rule doc to doc strings.

* Converting port_map rules doc to doc strings.

* Converting procedure rule doc to doc strings.

* Converting procedure_call rule doc to doc strings.

* Converting process rule doc to doc strings.

* Converting range rule doc to doc strings.

* Converting report_statement rule doc to doc strings.

* Converting sequential rule doc to doc strings.

* Converting signal rule doc to doc strings.

* Converting source_file rule doc to doc strings.

* Converting subprogram_body rule doc to doc strings.

* Converting subtype rule doc to doc strings.

* Converting type rule doc to doc strings.

* Converting variable rule doc to doc strings.

* Converting variable_assignment rule doc to doc strings.

* Converting wait rule doc to doc strings.

* Converting when rule doc to doc strings.

* Converting while_loop rule doc to doc strings.

* Converting whitespace rule doc to doc strings.

* Converting with rule doc to doc strings.

* Fixing tests due to further refinements of rule groups.

* Removing generated doc files after tests.

* Updating documentation to include rule group information.

* Removing trailing whitespace.

* Minor formatting fixes for documentation.

* Fixing issues for codacy.

* Skipping currently failing tests so I can address coding issues.

* Removing unused libraries.

* Minor formatting issues resolved.

* WIP:  Setting desired test input.

NOTE:  tests fail as I need to implement fixes.

* Improving testing of rule groups.

* Enhancing test so it will pass.

* Updates for codacy.
2022-01-01 17:46:43 -06:00
Jeremiah Leary 9d48d94a99 Updates for issue #644
Updating remaining case rules to allow for prefix/suffix exceptions.
2021-10-26 07:38:43 -05:00
Jeremiah Leary 91db3f001f Updates for issue #644
Additional changes:

  1)  Added new base rule token_case_with_prefix_suffix
  2)  Changed required rules to use new base rule
  3)  Refactored shared logic into package
2021-10-25 06:25:00 -05:00
Jeremiah Leary 389a731ae0 Updates for issue #560
Adding depricated rules.

  1)  Updated documentation to provide links to new rules
  2)  Added tests for depricated rules
  3)  Added rules that were depricated back to rule set using the depricated rule class
2021-05-08 07:56:51 -05:00
imd 14a0dbe633 variable suffix rule 2021-05-01 21:46:11 +01:00
imd 046cf644fa comment error 2021-05-01 21:44:58 +01:00
Jeremiah Leary 4721ae0322 Updates for Codacy flagged issues. 2020-12-04 13:27:19 -06:00
Jeremiah Leary f9982dac4d Refactoring rules to improve consistent case performance.
1)  Adding more exclusions to each rule
2020-12-04 09:20:22 -06:00
Jeremiah Leary 9bf3d71b60 Refactoring signal_005 and variable_005 to use the single_space_after base rule. 2020-11-26 20:55:22 -06:00
Jeremiah Leary e4cdef673a Making consistent case rules ignore entity names. 2020-11-25 14:15:39 -06:00
Jeremiah Leary a0a9813d89 Codacy fixes. 2020-11-24 17:14:00 -06:00
Jeremiah Leary 0a06afbe1e Refactoring additional generic, variable, port and signal rules for new parser. 2020-10-24 13:37:03 -05:00
Jeremiah Leary dca6ed4dbb Refactoring additional variable and signal rules for new parser. 2020-10-24 09:48:58 -05:00
Jeremiah Leary f95fa99028 Refactoring additional variable rules for new parser. 2020-10-24 09:21:23 -05:00
Jeremiah Leary 6e04be1bc9 Refactoring variable rules for new parser. 2020-10-18 14:06:57 -05:00
Jeremiah Leary 7a3fcf9883 Updates for issue #434:
Adding rules to align declaration identifiers:

  1)  Updated documentation
  2)  Removed the following rules
      file_003, constant_003, attribute_003, signal_003, subtype_003, type_003 and variable_003
  3)  Added new rules:
      architecture_029, function_015, package_019, procedure_010 and process_037
  4)  Added tests for new rules
  5)  Updated classifiers to support new rules
2020-06-30 11:36:01 -05:00
Martin Dörfelt 99ce2000cf fixed review remarks
- Used a more appropriate method for extracting labels.
- Improved the error message of "prefix_rule".
2020-06-27 08:31:05 +02:00
Jeremiah C Leary 6b4a45791d Updates for issue #362
Changing utils.get_violation_linenumber to utils.get_violation_line_number.
2020-04-01 21:11:38 -05:00
Jeremiah C Leary 7d85a98db4 Updates for issue #362:
Interim commit to move all rules to new violation dictionary format.
2020-03-29 13:09:38 -05:00
Michał Kruszewski 2f08a64bda Refactor keyword alignment rules. 2020-02-24 21:14:44 +01:00
Jeremiah C Leary cd43aabb42 Updates for issue #335
Updated variable rules to use violation dictionary for violation list.

  1)  Updated code
  2)  Updated tests
2020-02-16 21:58:58 -06:00
Michał Kruszewski ca1eeae7e4 Fix case rules for variable rules. 2019-12-06 10:44:30 +01:00
Jeremiah C Leary a374867c40 Refactoring fix.upper_case and fix.lower_case to remove unneccessary input. 2019-10-16 21:36:30 -05:00
Michał Kruszewski 996febb7a0 Add prefix and suffix rules. 2019-10-16 11:53:58 +02:00