Commit Graph

421 Commits

Author SHA1 Message Date
JHertz5 989c4b9a7f Issue#1488: Added tests for new rules. 2025-08-24 22:33:26 +01:00
JFMarten 7a7ad605b4
issue-1469: warning for no matches of file_rules (#1470)
Co-authored-by: Jakob Marten <github@jfmarten.de>
2025-07-19 14:25:39 -05:00
Lincoln Lorenz c786afbd67
Issue#1471: UTF-8 check should handle output differences from command (#1472)
* Issue#1471: UTF-8 check should handle output differences from  command

* Use native encoding checks to validate fix preserves file encodings

* Mocking stdout to keep stdout from displaying during tests.

* Fixing style issues.

---------

Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
2025-07-19 14:09:53 -05:00
Benjamin Thiemann 587052b276
Fix file_rules globbing (#1453)
* Issue#1446: Fixed comment indentation at end of scope

* config: Refactored glob_filenames

* config: Fixed error message construction in validate_file_exists

* config: Fixed process_file_list_key to use key parameter

* Issue#1425: Fixed missing globbing of "file_rules"

* Adding tests.

* Revert "Issue#1446: Fixed comment indentation at end of scope"

This reverts commit 7106e12fd05049924ea89447922b00de0c83c7fc.

---------

Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
2025-07-13 14:25:44 -05:00
Jukka Hertzog e02087dc8f
Issue#1250: Corrected alignment of multiline variable and signal declarations for align_left = no (#1345)
* Issue#1250: Corrections to multiline_alignment for method _analyze_align_left_no_align_paren_yes.

* Issue#1250: Updated tests after corrections to multiline_alignment for method _analyze_align_left_no_align_paren_yes.

* Issue#1250: Updates after merge of issue-1290.

* Issue#1250: Updated "align_left no, align_paren no" alignment as well.

* Issue#1250: Updated tests for signal_400.

* Issue#1250: Updated tests for variable_400.

* Issue#1250: Formatting.
2025-07-11 06:23:26 -05:00
Benjamin Thiemann bd8541b702
Fix missing carriage return handling for rules moving token to previous line (#1455) 2025-07-10 14:00:56 -05:00
Jeremiah Leary a595084ffa
Issue#1403: VSG crashes in constaint due to not checking for "is" or ">>". (#1405) 2025-07-10 07:47:38 -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
Jukka Hertzog c3b9b537a9
Issue#1459: Added architecture specification enforcement for entity instantiations (#1460)
* Issue#1459: Added rule instantiation_036.

* Issue#1459: Added tests for rule instantiation_036.

* Issue#1459: Added docs for rule instantiation_036.

* Issue#1459: Test change to trigger CI run.

* Revert "Issue#1459: Test change to trigger CI run."

This reverts commit d983807ceadb9c6b942ea60f327dce28fc96b485.

* Issue#1459: Changed default behaviour to "add".
2025-07-06 16:44:10 -05:00
Benjamin Thiemann 78cd5ec485
Fix comment indentation at end of scope (#1452)
* Issue#1446: Fixed comment indentation at end of scope

* Refactored implementation:

  1)  Removed pragma updates
  2)  Added options to configure
      a)  Declarative part can be configured independent of statement part
  3)  Added documentation
  4)  Updated tests for all combinations of configurations

* Fixing configuration merge of indent options.

* Minor updates to error reporting.

* Updating failing tests.

---------

Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
2025-07-06 15:12:10 -05:00
Jeremiah Leary a6e745c809
Issue#1442: Ensuring ISO-8859 encoded files are written as ISO-8859 encoded files (#1463)
* Issue#1442:  Ensuring ISO-8859 encoded files are written as ISO-8859 encoded files.

* Attempting to get builds to pass.

* Attempting to update build tool versions.

* Updating license to current standard.

* Disabling manifest to debug github action errors.

* Switching out pytest for unittest

* Adding __init__.py file so file_encodings test runs

* Attempting to skip failing tests.

* Attempting to skip tests during GITHub actions.

* Adding debug prints.

* Printing out environment variables to help with debug.

* Using HOME environment variable to test for GITHUB.

* Removing debug print statements.

* Enabling pytest.

* Replacing pytest with unittest.

Pytest is failing on some plugin and I do not know how to fix it.
2025-07-04 14:10:49 -05:00
Jeremiah Leary 4c0120a5a4
Issue#1415: Fixing classification of + and - when used with predefined attributes. (#1417) 2025-06-29 11:59:49 -05:00
Jeremiah Leary 78b7cf3bb6
Issue#1433: Fixed mis-classification of signs. (#1434) 2025-04-06 16:52:26 -05:00
Jeremiah Leary bf5057891c
Issue#1420: Delimited comment tokens were not classified correctly. (#1422) 2025-03-18 19:33:09 -05:00
Jeremiah Leary 3d58538005
Issue#1411: Adding parsing for PSL. (#1412)
* Issue#1411:  Adding parsing for PSL.

* Fixing cover_assertion classification.
2025-03-12 07:22:48 -05:00
Jeremiah Leary c5184bf694
Issue#1409: Fixing crash with rules architecture_600 and architecture_601. (#1410) 2025-03-09 10:33:10 -05:00
Jeremiah Leary 399ef06989
Issue#1407: Timestamp preserved for unmodified files. (#1408)
* Issue#1407:  Timestamp preserved for unmodified files.

* Removing debug print statement.
2025-03-08 07:58:30 -06:00
Jeremiah Leary 54405d9e8e
Issue 1402 (#1406)
* Issue#1402: Adding rule interface_incomplete_type_declaration_500

* Adding rule interface_incomplete_type_declaration_501.

* Adding rule interface_incomplete_type_declaration_600.

* Adding rule interface_incomplete_type_declaration_601.

* Fixing style issues.
2025-03-06 06:02:15 -06:00
Jeremiah Leary d6422f774d
Issue#1358: Adding user_error_message option. (#1387) 2025-03-02 12:14:53 -06:00
Jukka Hertzog cc678cb21f
Issue#1383: Added case rules for file declarations (#1396)
* Issue#1383: Added case rules for file declarations.

* Issue#1383: Added tests for case rules for file declarations.

* Issue#1383: Added documentation for case rules for file declarations.

* Issue#1383: Added case rules for file type declarations.

* Issue#1383: Added tests for case rules for file type declarations.

* Issue#1383: Added documentation for case rules for file type declarations.

* Issue#1383: Corrected "file type declaration" to "file type definition".
2025-01-19 17:18:53 -06:00
Jukka Hertzog 12473270ea
Issue#1389: Whitespace rules for case-generate statements (#1390)
* Issue#1389: Expanded on case rules to check that they don't affect case-generates.

* Issue#1389: Added new case generate rules.

* Issue#1389: Added tests for new case generate rules.

* Issue#1389: Added documentation for new case generate rules.

* Issue#1389: Corrected test file reference.

* Issue#1389: Corrected code snippet.

* Issue#1389: Corrected code snippet.

* Issue#1389: Connected code snippets

* Issue#1389: Corrected code snippet.

* Issue#1389: Corrected code snippet

* Issue#1389: Updated rules to use simpler base rules where possible.

* Issue#1389: Updated rules to use simpler base rules where possible.

* Issue#1389: Corrected mistake in case_004.
2025-01-19 16:45:26 -06:00
Jeremiah Leary 431504ecbc Fixing style issues. 2025-01-13 21:38:34 -06:00
Brandon Maier 4b43d5744a
Fix for pytest on Windows (#1338)
* tests: support admin check on Windows

The tests fail on Windows with the following

> ___________ ERROR collecting tests/source_file/test_source_file.py ____________
> tests\source_file\test_source_file.py:24: in <module>
>     class testOSError(unittest.TestCase):
> tests\source_file\test_source_file.py:39: in testOSError
>     @unittest.skipIf("SUDO_UID" in os.environ.keys() or os.geteuid() == 0, "We are root. Root always has permissions so test will fail.")
> E   AttributeError: module 'os' has no attribute 'geteuid'

Catch the AttributeError and attempt to check for admin when on Windows

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>

* tests: support running 'vsg' binary on Windows

A large number of tests fail on Windows with the following error

> ________ test_severity_using_main.test_architecture_with_configuration ________
> [gw0] win32 -- Python 3.8.20 %PREFIX%\python.exe
>
> self = <tests.severity.test_main.test_severity_using_main testMethod=test_architecture_with_configuration>
>
>     def test_architecture_with_configuration(self):
>         try:
> >           subprocess.check_output(["bin/vsg", "-f", self._sArchitectureFileName, "-c", sConfigFile])
>
> tests\severity\test_main.py:86:
> _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
> ..\_test_env\lib\subprocess.py:415: in check_output
>     return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
> ..\_test_env\lib\subprocess.py:493: in run
>     with Popen(*popenargs, **kwargs) as process:
> ..\_test_env\lib\subprocess.py:858: in __init__
>     self._execute_child(args, executable, preexec_fn, close_fds,
...
> E FileNotFoundError: [WinError 2] The system cannot find the file specified
> ..\_test_env\lib\subprocess.py:1327: FileNotFoundError

Tests that call "bin/vsg" are relying on the Unix shebang (e.g.
"#!/usr/bin/python") to launch `vsg` using the Python interpreter, But
this is not supported on Windows. Instead launch `vsg` with Python
directly.

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>

* tests: normalize line endings for Windows tests

Many of the tests that compare `vsg` stdout fail with a warning as
follows.

> First differing element 0:
> 'ERRO[19 chars]1.vhd(7)port_007 -- Change number of spaces after *in* to 4.\r'
> 'ERRO[19 chars]1.vhd(7)port_007 -- Change number of spaces after *in* to 4.'

The tests use `.split('\n')` to split stdout and stderr by the Linux
line terminator '\n'. But on Windows this causes test failures as the
line terminator is '\r\n'.

Instead use Python `.splitlines()`. which will split on both Linux and
Windows style line terminators. `.splitlines()` also removes empty
trailing lines, so we must modify the expected output accordingly.

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>

* Fixing test error by including encoding when reading vhdl files.

* Fixing second error due to glob function using incorrect divider.

* Fixed file compare not working in quality report test.

* Fixed output error message to be independent of platform.

* Skipping permission tests when running on windows.

* Skipping file permission test when running on Windows.

---------

Signed-off-by: Brandon Maier <brandon.maier@gmail.com>
Co-authored-by: Jeremiah Leary <jeremiah.c.leary@gmail.com>
2025-01-13 20:46:16 -06:00
Jeremiah Leary d34592f34b
Merge pull request #1203 from jeremiah-c-leary/issue-1202
Issue#1202:  Adding Pascal_Snake_Case option to case rules.
2025-01-13 06:51:12 -06:00
Jukka Hertzog 17720811ad
Merge branch 'jeremiah-c-leary:master' into issue-1385 2025-01-04 21:12:17 +00:00
JHertz5 1d63871e75 Merge remote-tracking branch 'origin/master' into issue-1366 2025-01-04 18:47:29 +00:00
Jukka Hertzog 756fd22e49
Merge branch 'jeremiah-c-leary:master' into issue-1385 2025-01-04 18:45:46 +00:00
JHertz5 447158529d Issue#1385: Deprecated rules iteration_scheme_502 and for_generate_statement_502. 2025-01-04 17:39:03 +00:00
JHertz5 ca3f0b93bf Issue#1385: Added tests for case rule for in keyword in parameter specifications. 2025-01-04 17:37:42 +00:00
Jukka Hertzog d1f1cce68a
Merge branch 'jeremiah-c-leary:master' into issue-1318 2025-01-04 17:18:17 +00:00
Jukka Hertzog d53cf5ee1e
Merge branch 'jeremiah-c-leary:master' into issue-1366 2025-01-04 17:17:39 +00:00
Jeremiah Leary 75cbdfe002 Adding tests for relaxedCamelCase and RelaxedPascalCase. 2025-01-04 10:09:33 -06:00
JHertz5 ff00562e04 Merge remote-tracking branch 'origin/master' into issue-1318 2025-01-01 19:13:58 +00:00
JHertz5 a7e2c6b791 Merge remote-tracking branch 'origin/master' into issue-1366 2025-01-01 19:13:18 +00:00
Jukka Hertzog 72b262cd58
Merge branch 'jeremiah-c-leary:master' into issue-1376 2025-01-01 19:12:26 +00:00
Jeremiah Leary 68009fac8e
Merge pull request #1233 from JHertz5/issue-1232
Issue#1232: Replaced ieee_500 with type_mark_500
2025-01-01 11:51:40 -06:00
Jeremiah Leary 6b15d115c0 Fixing style issues. 2025-01-01 11:30:38 -06:00
Jeremiah Leary 96b9be47d2 Merge branch 'master' into issue-1202
Updated tests.
2025-01-01 11:24:46 -06:00
JHertz5 55d86de1a4 Issue#1364: Deleted "actual" files for rule_group tests. These files should never have been committed. 2025-01-01 14:02:27 +00:00
JHertz5 407d08dfb2 Issue#1376: Removed redundant new rules. 2024-12-30 19:06:24 +00:00
JHertz5 78380c9067 Issue#1376: Added tests for parameter_specification rule for identifier case. 2024-12-30 18:55:58 +00:00
JHertz5 97bd50c547 Merge remote-tracking branch 'origin/master' into issue-1232 2024-12-30 09:37:47 +00:00
JHertz5 e50db92b5a Merge remote-tracking branch 'origin/master' into issue-1366 2024-12-30 09:31:44 +00:00
JHertz5 b689c20974 Merge remote-tracking branch 'origin/master' into issue-1318 2024-12-30 09:29:59 +00:00
Jukka Hertzog a1fed3b41c
Merge branch 'jeremiah-c-leary:master' into issue-1376 2024-12-30 09:26:51 +00:00
Jeremiah Leary 710f857db1
Merge branch 'master' into issue-1364 2024-12-29 17:32:06 -06:00
JHertz5 51b56009c5 Issue#1376: Updated new tests to check rule groups. 2024-12-29 18:08:02 +00:00
JHertz5 6514e4c680 Issue#1376: Added test for case rule for parameter identifiers in iteration schemes. 2024-12-29 18:03:12 +00:00
JHertz5 c450a00516 Issue#1376: Added test for case rule for parameter identifiers in for-generates. 2024-12-29 17:56:51 +00:00