Commit Graph

82 Commits

Author SHA1 Message Date
Jeremiah Leary bc85de813c
Updates for issue #791 (#799)
* Updates for issue #791

Adding rule procedure_call_401

  1)  Added documentation
  2)  Added test
  3)  Added rule

* Adding documentation for rule procedure_call_003.

* Fixing element name in configuration.

* Initial tests for rule procedure_call_003.

* Changing options.

* Fixing option table.

* Adding rule procedure_call_003

  1)  Added base rule multiline_procedure_call_structure
  2)  Added tests
  3)  Added rule

Fixed bug in vhdlFile.utils.find_previous_non_whitespace_token

* Removing unused functions.

* Moving identical code to common module.

* Minor formatting updates.

* Moving identical functions to fix.py

* Moving indentical functions to other modules.

* Moving indentical functions to a single module.

* Removing unused functions.

* Removing unused variables.

* Refactoring whitecase adjustment.

* Adjusting rule procedure_call_400 to include the open parenthesis.

* Removing unused imports and variables.
2022-07-29 06:48:07 -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 82d30998a3
Updates for issue #777 (#779)
* Updates for issue #777

Adding rule to enforce case of predefined attributes.

  1)  Added documentation
  2)  Added test
  3)  Added rule attribute_500

* Fixing comments.

* Removing extra blank lines.
2022-05-08 08:56:47 -05:00
Jeremiah Leary 267b17e72a
Updates for issue #730 (#741)
* Updates for issue #730

Adding rules to handle case for use_clause selected names.

  1)  Added new tokens to use_clause
  2)  selected names now parsed with new tokens
  3)  Added rules:
      a)  use_clause_500
      b)  use_clause_501
      c)  use_clause_502
      d)  use_clause_503
  4)  Added tests

Resolves #730

* Refactoring to reduce duplication.
Removing trailing whitespace.

* Changing exceptions to case_exceptions.

1)  case::name rules allow case_exceptions by default
2)  Updated instantiated_unit to split entity_name with a library name
3)  Rule instantiation_028 simplified
4)  Removed unused test file

* Refactoring to reduce complexity.

* Refactoring to improve readability.

* Fixed isue with procedure_506 crashing VSG due to missing variable.

* Fixing missing call to lowercase list.

* Adding the following rules:

  context_ref_500
  context_ref_501

Deprecated the following rules:

  context_ref_004

* Placing common code into a single file.

* Removing trailing whitespace.

* Refactoring to reduce the number of parameters.
2022-04-19 19:21:20 -05:00
Jeremiah Leary 940fa31e15
Updates for issue #679 (#753)
* Updates for issue #679

Fixing encoding issues when reading and writing files.

  1)  Added utf-8 encoding and decoding
  2)  Fixed issue with token map which was causing vsg to crash.

* Removing trailing whitespace.
2022-04-13 19:51:59 -05:00
Jeremiah Leary ab566beed2
Updates for issue #750 (#752)
* Updates for issue #750

Fixed code tags to allow for comments within the tag.

  1)  Updated tests
  2)  Updated documentation
  3)  Updated code tag logic to ignore anything after the : within the code tag

* Additional code tag updates
Added parsing of exponents.

* Minor formatting fixes.

* Refactored split_natural_numbers to improve readability.

* Refactoring code tag logic to improve readability.

* Minor formatting updates.

* Removing trailing whitespace.

* Refactoring to improve readability.

* Refactoring to reduce line length.

* Fixing indent.

* Adding rule exponent_500.
2022-04-10 20:10:49 -05:00
Jeremiah Leary a0709483e0
Updates for issue #542: (#734)
* Updates for issue #542:

Rule comment_010 was firing after block_comment rules were ran:

  1)  Updated indent logic to take block comments into consideration
  2)  Added attributes to comment class to indicate if it is a block comment
  3)  Updated tests
  4)  Simplified extractor
  5)  Added method to token_map

* Refactoring functions to reduce duplication and complexity.

* Removing trailing whitespace.

* Removing excess blank lines.

* Refactoring to remove identical code.

* Refactoring to reduce complexity.

* Refactoring to reduction complexity.

* Refactoring to improve readability.

* Reverting to previous utils.py due to inadvertant commit.

* Refactoring block_comment_002 to reduce complexity and improve readability.

* Refactored block_comment_002 to reduce complexity.

* Refactoring block_comment_002 to reduce complexity.

* Refactoring block_comment_002 to improve readability.

* Refactoring to improve readability.

* Moving _analyze from block_comment_002 and block_comment_003 into base block_rule.

* Minor formatting updates.

* Updated base rule to ignore leading and trailing vsg code tags.

* Forcing tags of vsg_on to be applied on the next token.

* Refactoring methods to make them more readable.
2022-02-20 08:29:41 -06:00
Jeremiah Leary 0d0cf6a311
Updates for issue #626 (#736)
* Updates for issue #626

Adding rule to enforce whitespace between others and =>.

  1)  Added rule element_association_100
  2)  Added documentation
  3)  Added classification of others and =>

* Adding rule element_association_101.

* Adding element_association rules to documentation.
2022-02-20 07:46:29 -06: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 2f152e1f1c Fixing error message output. 2022-02-09 08:33:22 -06:00
Jeremiah Leary b562817216
Updates for Issue 682 (#716)
* Updates for issues #655 and #707:

VSG would lockup if an error was encountered during classification.

  1)  Exception added to print_error_message to report classification errors.
  2)  Exception is caught in apply_rules.py and handled so it does not lock up the multiprocessing pool.

* Updates for issue #682

Trailing whitespace after phase 1 were being introduced by some rules.

  1)  Added function to remove trailing whitespace after phase 1
  2)  Added test

* Fixing case on variable name.

* Removing unused import.
2022-02-05 06:31:12 -06:00
Jeremiah Leary 41b0a3704f
Updates for Issue 705 (#717)
* Updates for issues #655 and #707:

VSG would lockup if an error was encountered during classification.

  1)  Exception added to print_error_message to report classification errors.
  2)  Exception is caught in apply_rules.py and handled so it does not lock up the multiprocessing pool.

* Updates for issue #705:

Changing rule constant_014 to include align_left and align_parent options.

* Refactoring to reduce duplication.

* Changing options for constant_012 from boolean to strings to align with similar rules.
2022-02-03 18:55:58 -06:00
Jeremiah Leary 69efd19087 Updates for issues #655 and #707:
VSG would lockup if an error was encountered during classification.

  1)  Exception added to print_error_message to report classification errors.
  2)  Exception is caught in apply_rules.py and handled so it does not lock up the multiprocessing pool.
2022-01-31 06:43:40 -06:00
Jeremiah Leary a18fe76779
Issue 575 (#703)
* Update for issue #575:

Fixing alignment rules as they were introducing syntax errors:
  align_tokens_in_region_between_tokens
  align_tokens_in_region_between_tokens_skiping_lines_starting_with_tokens

* Refactoring to improve readability.

* Addressing issues from Codacy and Codeclimate

* Refactoring number_of_tokens_in_token_list to improve readability.

* Refactoring utils functions to improve readability.

* Removing unused variable.

* An exit statement with a <= was being classified as a signal assignment.

* Fixed issue with improper classification of character literals.

* Extracting class from tokens.py

* Refactoring tokens.py to improve readability.

* Fixing issue when attempting to detect trailing whitespace.

* Updating tests to reflect changes in tokens.py

* Refactoring combine_characters_into_words to improve readability.

* Refactoring combine_string_literals to improve readability.

* Refactoring find_indexes_of_double_quote_pairs to improve readability.

* Refactoring combine_character_literals to improve readability.

* Refactoring to improve readability.

* Removing unused functions.

* Adding additional tests for tokenizer.

* Moving rule variable_assignment_004 to phase 5 and subphase 2 to ensure it runs correctly.

* Updating documentation for variable_assignment_004 change in phase.

* Rule constant_012 was operating on constant which were not arrays.

* Removing unused function.

* Removing unused function.

* Moving rule generic_001 to entity_200 to properly handle generic_clause in a package declaration.

* Refactoring extract routines to improve readability.

* Refactoring base rule to improve readability.

* Fixing Minor formatting issues.

* Removing unused function.

* Removing unused functions.

* Improving code coverage.

* Improving code coverage:

  1)  Removed unused functions
  2)  Removed unreachable code

* Refactoring constant_012 to improve readability.

* Refactoring analyze to _analyze:

  1)  Updated _get_tokens_of_interest to add more info into the token object

* Refactoring to improve readability.

* Refactoring generate_paren_dicts function to improve readability.

* Refactoring check_indents to improve readability.

* Refactoring to improve readability.

* Updates for rule constant_012:

  1)  Arguments align_left False and align_paren True working

* Refactored analyze_align_left_true_align_paren_false function in rule constant_012

* Refactored _analyze_align_paren_true_align_left_true function for rule constant_012.

* Removed unused functions and methods for rule constant_012.

* Updated rule constant_012 to use the indent step

* Refactoring to functions into methods.

* Removing unused file.

* Refactoring rule constant_012 to improve readability.

* Additional refactoring to improve readability.

* Refactoring check_left_aligned_line function to use less parameters.

* Removing unused variables.

* Attempting to get JSON extract test to pass on CI server.

* Removing unused functions.

* Updates for rule comment_100:

  Rule was error out if a comment was only 3 characters and the third was not a letter or number.

    1) Updated test
    2) Added check for length of comment

* Updates for parsing procedure_calls_statements:

Procedure call with <= was being classified as a simple waveform.

  1)  Updated test to expose issue
  2)  Updated classification code

* Refactoring to reduce cyclomatic complexity.

* Refactoring to reduce cyclomatic complexity.

* Minor formatting updates.

* Adding parsing of physical_type_definitions:

  1)  Added tokens
      a)  physical_type_definition
      b)  primary_unit_declaration
      c)  secondary_unit_declaration
  2)  Added classifiers
      a)  physical_type_definition
      b)  primary_unit_declaration
      c)  secondary_unit_declaration
  3)  Added test
      a)  full_type_declaration

* Minor formatting fix.

* Fixed bug with concurrent_simple_signal_assignment.

  A <= in a generic map was causing the generic map to be classified as a concurrent_simple_signal_assignment.

  1)  Updated test
  2)  Updated concurrent_simple_signal_assignment classifier

* Refactoring to reduce cyclomatic complexity.

* Adding classification of configuration_specification:

  1)  Added tests
  2)  Added classifiers for configuration_specification.

* Minor formatting updates.

* Fixing issue with previous_line rule if there were no lines above.

* Assert_statement was being classified before exiting block_statement.

* A backslash in a string literal was not be classified as a string literal.
2022-01-22 19:01:08 -06:00
Jeremiah Leary eabfaedd2a Updates for issue #592
Adding rule to move then keyword in if statements.

  1)  Added documentation
  2)  Added tests
  3)  Added rule if_036
2021-05-29 10:11:38 -05:00
Jeremiah Leary c237e1c60c Updates for Codacy.
Minor updates.
2021-03-13 08:19:44 -06:00
Jeremiah Leary c60fc5676d Updates for Codacy:
Removed unneeded else on loops.
2021-03-13 08:02:44 -06:00
Jeremiah Leary a97d9f092f Updates for Codacy issues:
1)  Removing trailing whitespace
  2)  Removing unused code
2021-03-10 08:23:50 -06:00
Jeremiah Leary a70523bda4 Updates for issue #450:
Adding option assign_on_single_line.

  1)  Updated documentation
  2)  Added tests
  3)  Added option to rule constant_016
2021-02-22 17:22:47 -06:00
Jeremiah Leary 0d228d00a8 Updates for issue #450:
Adding support for open_paren_new_line option.

  1)  Added tests
  2)  Added code
2021-02-22 17:22:47 -06:00
Jeremiah Leary 0434eca997 Updates for issue #450:
Adding support for last_paren_new_line.

  1)  Added test
  2)  Added code to detect
2021-02-22 17:22:47 -06:00
Emil Vanherp a158fd2ac9
Distinguish between file errors
* Don't exit on file not found or other OSErrors, but continue (revert
from fc34afd4d0339e0b17d8f46e3bf527461beccf1a)
* Empty file, file not found, no permission and other
OSErrors are now reported differently.
2021-01-22 15:21:41 +01:00
Emil Vanherp 0971ca194c
Move read_vhdlfile to vhdlFile/utils
And exit with exit code 1 on file not found or any other OSError
2021-01-22 15:21:41 +01:00
Jeremiah Leary 0bec7656a2 Updates for issue #512:
Added filename to output of parsing error message.
2021-01-13 19:13:53 -06:00
Jeremiah Leary 585208ad61 Updates for issue #503:
Adding ability to parse preprocessor commands embedded in VHDL code.

  1)  Added preprocessor token
  2)  Added preprocessor classifier
2020-12-21 14:15:48 -06:00
Jeremiah Leary e80c16da15 Updates for issue #429
Improving error message reporting while parsing generate statements.
2020-12-17 10:51:57 -06:00
Jeremiah Leary 4721ae0322 Updates for Codacy flagged issues. 2020-12-04 13:27:19 -06:00
Jeremiah Leary 7d9dd63031 Refactoring method get_tokens_starting_with_token_and_ending_with_one_of_possible+_tokens.
1)  Moved method from vsg.vhdlFile to vsg.vhdlFile.extract
  2)  Refactored to use token map
  3)  Removed Tokens from vsg.vhdlFile
  4)  Refactored constant_011 to use _get_token_of_interest
2020-12-03 19:27:19 -06:00
Jeremiah Leary f7fe1122b1 More updates for Codacy checks. 2020-11-25 09:33:32 -06:00
Jeremiah Leary 2ed37e75c9 Updates for CodeClimate. 2020-11-25 08:17:51 -06:00
Jeremiah Leary 9c0fc9fb2a Removing unused code. 2020-11-24 19:34:05 -06:00
Jeremiah Leary 39dce36ec8 Additional Codacy Updates. 2020-11-24 18:19:42 -06:00
Jeremiah Leary a0a9813d89 Codacy fixes. 2020-11-24 17:14:00 -06:00
Jeremiah Leary 0ae78b9e03 Updates for context rules to handle blank lines correctly. 2020-11-19 20:23:48 -06:00
Jeremiah Leary 2d672df79d Major refactor to remove the use of line.py to improve performance. 2020-11-09 20:49:45 -06:00
Jeremiah Leary bfb2be88e6 Performance updates:
1)  Simplified find_next_token
  2)  Removed unnecessary call to find_next_token in utils.are_next_consecutive_token_types
2020-11-08 20:18:41 -06:00
Jeremiah Leary a051190284 Updating parser to handle signs. 2020-11-08 10:53:14 -06:00
Jeremiah Leary f112d37218 Refactoring rule process_028 for new parser. 2020-11-03 07:21:14 -06:00
Jeremiah Leary 0a378d17b9 Refactoring rule process_012 for new parser. 2020-10-31 16:47:12 -05:00
Jeremiah Leary ffe6b3271e Refactoring rule signal_012 for new parser. 2020-10-31 12:52:16 -05:00
Jeremiah Leary 823c0e69e8 Refactoring rule concurrent_007 for new parser. 2020-10-29 19:04:20 -05:00
Jeremiah Leary 63c8ed3778 Refactoring rule context_011 for new parser. 2020-10-27 18:25:25 -05:00
Jeremiah Leary dbe74ff551 Refactoring rule process_021 for new parser. 2020-10-26 21:07:33 -05:00
Jeremiah Leary 10459a862f Refactoring rule if_002 for new parser. 2020-10-25 18:35:55 -05:00
Jeremiah Leary e0ca2f59ae Refactoring rule process_029 for new parser. 2020-10-25 11:20:08 -05: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 0e2b3c5ce4 Refactoring additional component and instantiation rules for new parser. 2020-10-24 08:37:34 -05:00
Jeremiah Leary cf872e654a Refactoring additional if and process rules for new parser. 2020-10-22 19:16:53 -05:00
Jeremiah Leary dc5e0c2f78 Refactoring signal rules for new parser. 2020-10-17 19:29:24 -05:00
Jeremiah Leary 4a17c554e6 Refactoring length rules for new parser. 2020-10-10 21:16:17 -05:00