Closed maltaisn closed 4 months ago
Evening @maltaisn ,
We should be able to allow the user to define a regex. Are you thinking we would add another option like regex_exceptions
which would be a list of regexs?
I am curious what your regexp would be to cover PipelineSR
, SPIAccess
, and ADCRegisters
.
Regards,
--Jeremy
In my case the regex wouldn't check for known acronyms, I would go for something simple such as [A-Z][A-Za-z\d]*
.
Morning @maltaisn ,
I am trying to figure out how the configuration would work to support a user regex. I think I will add add another option to case
and then add an option for regex
.
So in your regex example you would use the following configuration:
{
"rule": {
"signal_002": {
"case": "regex",
"regex": [
"[A-Z][A-Za-z\d]*"
]
}
}
}
The prefix, suffix, and case exceptions would still apply.
Would that work for you?
--Jeremy
That would be perfect, thanks!
Evening @maltaisn ,
I pushed an update to the issue-1182
branch. I am only allowing a single regex instead of a list of regexs. When you get a chance could you check it out and let me know if it works for you?
Thanks,
--Jeremy
It works great thanks!
Awesome, I will get this merged to master.
--Jeremy
The regex option fails for port_map_002
it seems:
Traceback (most recent call last):
File "C:\dev\vhdl-style-guide\bin\vsg", line 16, in <module>
main()
File "C:\dev\vhdl-style-guide\vsg\__main__.py", line 154, in main
for tResult in pool.imap(f, enumerate(commandLineArguments.filename)):
File "C:\Program Files\Python311\Lib\multiprocessing\pool.py", line 873, in next
raise value
AttributeError: 'rule_002' object has no attribute 'oRegex'
Morning @maltaisn ,
Could you open another issue for this problem? I have already deleted the branch it will make my process easier.
Thanks,
--Jeremy
I often use component names with acronyms, such
PipelineSR
,SPIAccess
,ADCRegisters
, etc., or single upper letter names for ports, which are indicated as errors/warnings. It makes sense from seeing the regex used for these cases.I know in some conventions these names should be
PipelineSr
,SpiAccess
, etc., so clearly the solution here is not to change the existing regex. Would it be possible for example to define a custom regex for case checking, which would allow much more flexibility?