Commit Graph

21 Commits

Author SHA1 Message Date
Alon Bar-Lev cd881588e5
vsg: print file name when ClassifyError (#1210)
In current implementation the user see something like the following when
ClassifyError is raised:

    Error: Unexpected token detected while parsing procedure_call_statement @ Line 49, Column 22 in file None
           Expecting : ;
           Found     : )

In a project that contains multiple files, the user is clueless as he does not
know which of the files caused the error.

This change adds the name of the file to the message.

    Error while processing xxx:
    Error: Unexpected token detected while parsing procedure_call_statement @ Line 49, Column 22 in file None
           Expecting : ;
           Found     : )

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-09-22 20:45:46 -05:00
Alon Bar-Lev baf22da660 style: apply end-of-file-fixer
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2024-03-24 21:16:35 +02: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
Jeremiah Leary de5a316b51
Issue#1097: Fixing failure count and removing classname from JUnit output. (#1114) 2024-02-07 07:38:47 -06:00
Jeremiah Leary 5c85734a07
Issue#1054: Adding classification of pragmas. (#1056)
* Issue#1054:  Adding classification of pragmas.

* fix 'keyError: regexp' by dStyle having parse regexp and dConfig not (#1058)

* Adding pragma configuration tests.

* Stopping pragma search if a match is found.

* Refactoring classifications of pragmas to improve performance.

---------

Co-authored-by: Gerard Sharp <43923557+SittingDuc@users.noreply.github.com>
2023-12-03 21:09:52 -06:00
Jeremiah Leary 0550a5fe0b
Issue#1000: Adding --force_fix option to apply fixes to files with syntax errors. (#1021) 2023-11-06 16:37:27 -06:00
Alon Bar-Lev aeeeed6c27
alonbl patch series (#1017)
* Add linesep configuration option

Platform independent line ends are important to avoid conflicts.

Resolves: #1010
Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

* Perform atomic write to files

Do not overwrite file as we may corrupt the file if something fails, instead
write into temporary location and move the result into the final destination.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

* Synchronize README command-line usage

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

* Support files as positional argument

Tools such as pre-commit and other tools expects the tools to accept the
input files as positional argument and not as options.

Let's support the two variants.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

* Support shallow git clone without tags

pre-commit uses shallow clone without tags, as this is not used to publish the
artifact, let's assume version '0' in this case.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

* Add pre-commit hooks support

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

---------

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2023-11-05 07:24:50 -06:00
Alon Bar-Lev a35ff9691e
PR#1016: Support file configuration without scanning the file (#1016)
* Support file configuration without scanning the file

Currently per file configuration is specified under `file_list`, the
`file_list` has side effect of scanning the file regardless of what files
provided in command-line.

Configuration should be able to specify per file configuration without adding
the file to the scan.

New implementation will look for the file under `file_rules` and merge it to
the existing `file_list` configuration to keep backward compatibility.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>

* Adding tests for the new file_rules configuration option.

* Updating documentation for file_rules

* Removing trailing lines.

* Refactored configure_rules to improve readability.

---------

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
2023-10-08 13:37:39 -05:00
Alon Bar-Lev 0dc4c35768
Use platform independent file name in configuration (#1015)
Current implementation searches the file as provided by user or glob, this
name may be platform specific.

New implementation will always use '/' as separator, enabling the same
configuration to be used in any platform.

Signed-off-by: Alon Bar-Lev <alon.barlev@gmail.com>
2023-10-08 10:26:56 -05:00
Seth Gower 3b6fc9eefb
Adds ability to read from standard input (#897)
* adds basic functionality to send file to stdin

* updates usage docs to reflect stdin and adds new vim editor configs

* Adds better handling with stdin. Safer checks

* removes output over stdout for vhdl file since that's out of scope

* shortens cmd line args line to pass that check on codeclimate

* removes trailing white space

* changes is to == to prevent warning

* updates vim rst to have the null ls config ignore stderr

When editing a file sometimes things can cause VSG to fail and print to
stderr. If this happens, without ignoring stderr it will create an error
message in nvim, which was obnoxious
2023-09-08 14:55:15 -05:00
Jeremiah Leary 85c260be42
#863 (#865): Invalid configurations will now stop processing of all file. 2022-11-12 07:42:34 -06:00
Jeremiah Leary 4ec07b476e
Updates for issue #831 (#836)
Files which fail to parse will will be included in JUnit output.

  1)  Added test
  2)  Output parse failures to JUnit files
2022-10-05 08:18:26 -05:00
Jeremiah Leary 625ae4a93b
Updates for issue #596 (#787)
* Updates for issue #596

Adding feature to output quality report.

  1)  Added tests
  2)  Added quality_report command line argument
  3)  Output quality report

* Removing extra blank line.

* Removing unused import

* Adding documentation for integration with CI servers.

* Refocusing CI documentation to the output which is generated.

* Improving documentation:

  1)  Made JUnit example smaller
  2)  Minor grammar updates

* Adding link from table to heading.

* Adding link from table to content in page.
2022-08-01 21:04:35 -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 a66b65632a
Updates for issue #746 (#748)
* Updates for issue #746

Moved library_600 to library_500.
Added exceptions for invalid configurations.

* Removing whitespace.
2022-04-10 20:09:20 -05: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 25b21cc995 Updates for issue #619
Adding validation for --backup command line argument.

  1)  Updated documentation to say --backup is only valid with --fix
  2)  Added tests
      a)  Testing --backup works with --fix
      b)  Testing --backup without --fix returns an error
  3)  Updated checking of --backup after parsing command line arguments
2021-10-08 07:06:25 -05:00
Jeremiah Leary 62a8650231 Updates for issue #550
Fixing error where apply_rules was calling write_vhdl_file but it was not in the same file.
This was causing VSG to fail tests.

  1)  Moved function write_vhdl_file from __main__ to apply_rules
2021-09-25 21:42:51 -05:00
Emil Vanherp 16b3802d69
Better fix for issue #550 2021-07-10 10:42:30 +02:00