Open ArnePret opened 5 days ago
Hi @ArnePret. I believe that the problem here is the configuration in your Style.yaml file, not a bug in VSG. Your configuration sets the regex to "= '[A-Za-z]*'"
, i.e. the regex will not be satisfied unless there is an equals sign and a space at the start of your architecture name (which is obviously not valid VHDL). If you remove the =
, I think that your problem will be solved.
Corrected yaml file, test.yml:
rule:
architecture_013:
case: 'regex'
regex: '[A-Za-z]*'
Test input file, test.vhd
architecture RTL of test is
begin
end architecture rtl;
VSG output:
$ ./bin/vsg -f test.vhd -c test.yml
================================================================================
File: test.vhd
================================================================================
Phase 7 of 7... Reporting
Total Rules Checked: 769
Total Violations: 0
Error : 0
Warning : 0
Test input file, test.vhd
architecture rtl of test is
begin
end architecture rtl;
VSG output:
$ ./bin/vsg -f test.vhd -c test.yml
================================================================================
File: test.vhd
================================================================================
Phase 7 of 7... Reporting
Total Rules Checked: 769
Total Violations: 0
Error : 0
Warning : 0
Test input file, test.vhd
architecture RtL of test is
begin
end architecture rtl;
VSG output:
$ ./bin/vsg -f test.vhd -c test.yml
================================================================================
File: test.vhd
================================================================================
Phase 7 of 7... Reporting
Total Rules Checked: 769
Total Violations: 0
Error : 0
Warning : 0
I hope this helps, let me know if the problem persists on your end.
Morning @ArnePret and @JHertz5 ,
@JHertz5 is correct that the =
should be removed. However, it looks like the documentation is incorrect:
It shows the equal sign in the example. I will update the documentation.
Regards,
--Jeremy
Hi @jeremiah-c-leary. Thanks for pointing that out, I had no idea!
The pull request that you've raised corrects the regex field, but there are other mistakes in the snippet. Perhaps we should correct all of them in this PR? The code in the PR is
prefix_exceptions: - 'G_'
suffix_exceptions: - '_G'
case_exceptions: - 'IEEE'
regex: ''"
I don't have access to my computer at the moment, but if I'm not mistaken, the -
after each of the :
s is erroneous and should be removed.
Evening @JHertz5 ,
The dash after the colon in YAML indicates a list. The prefix_expections
, suffix_exceptions
, and case_exceptions
allow for multiple entries, while regex
does not. You can double check this by looking at the definitions in the token_case
class:
9 class token_case(case.Rule):
10 """
11 Checks the case for words.
12
13 Parameters
14 ----------
15
16 name : string
17 The group the rule belongs to.
18
19 identifier : string
20 unique identifier. Usually in the form of 00N.
21
22 lTokens : list of token types
23 The token types to check the case on.
24 """
25
26 def __init__(self, lTokens):
27 super().__init__()
28 self.solution = None
29 self.phase = 6
30 self.case = "lower"
31 self.configuration.append("case")
32 self.lTokens = lTokens
33 self.prefix_exceptions = []
34 self.suffix_exceptions = []
35 self.case_exceptions = []
36 self.regex = ""
37 self.oRegex = None
Regards,
--Jeremy
Hi @jeremiah-c-leary. Ah my mistake, thanks for the correction!
Environment VSG 3.26.0 Windows 11 TerosHDL v6.0.10 (with VSG selected as VHDL formatter)
Describe the bug When trying to Configuring Uppercase and Lowercase Rules the regex option appears to be doing nothing. Currently a lot of prefix_exceptions are defined in my Style.yaml, which all work fine. It would be a lot less work though, to write one line of regex and be done with it. But regex never matches anything for me.
To Reproduce Install VSCode Install TerosHDL (follow instructions on their website) Configure VSG as selected VHDL formatter Link yaml stylesheet
In Style.yaml: architecture_013: case: 'regex' regex: = '[A-Za-z]*'
In vhdl file: library ieee; use ieee.std_logic_1164.all; use ieee.numeric_std.all; use ieee.math_real.all;
entity Test is end entity Test;
architecture arch of Test is
begin
end architecture arch;
Expected behavior Accept arch as correct, since it matches the regex.
Screenshots