Comments (10)
I have been pondering this for a bit. It looks like indentStyle
and indentSize
are the only options that are camelCase.
I believe the way forward on this is to change the options to snake case, but also accept the camelCase and throw a warning that it will eventually be deprecated.
I will work on a solution.
--Jeremy
from vhdl-style-guide.
@jeremiah-c-leary, I'm happy to raise a PR for this if you're ok with the change.
from vhdl-style-guide.
Afternoon @JHertz5 ,
I finally pushed my update for this to the issue-1096
branch.
I added a warning if indentSize
or indentType
is found in any configuration, while also converting them to indent_size
and indent_type
under the hood.
Let me know what you think.
Regards,
--Jeremy
from vhdl-style-guide.
Hi @jeremiah-c-leary. Thanks very much for this! I've given your branch a try and I'm able to trigger the warning that you mentioned, but I'm not sure that the under the hood conversion is working.
With this config:
rule:
global:
indent_style: 'smart_tabs'
indent_size: 3
# indentStyle: 'smart_tabs'
# indentSize: 3
I get the following -rc
output
$ ./bin/vsg -c ./test.yml -rc constant_001
{
"rule": {
"constant_001": {
"indent_style": "smart_tabs",
"indent_size": 3,
"phase": 4,
"disable": false,
"fixable": true,
"severity": "Error"
}
}
}
(note that the values of indent_style
and indent_size
differ from the default) and I see --fix
changing files to tab indentation.
However, with this config:
rule:
global:
# indent_style: 'smart_tabs'
# indent_size: 3
indentStyle: 'smart_tabs'
indentSize: 3
I get
$ ./bin/vsg -c ./test.yml -rc constant_001
Warning in configuration file ./test.yml: option indentSize will be deprecated in a future release, change to indent_size.
{
"rule": {
"constant_001": {
"indent_style": "spaces",
"indent_size": 2,
"phase": 4,
"disable": false,
"fixable": true,
"severity": "Error"
}
}
}
(note that the wrning is triggered, but indent_style
and indent_size
are set to their defaults) and I see --fix
changing the previously tabbed file back to space indentation.
Perhaps the deprecated keys are detected and removed from the config in config.py
before they get to rule.py
where they would be converted?
I also noticed that in the function lBlah
in config.py
, there is a typo "lDeprectedKeyson line 127 (should be
lDeprecatedKeys`) which might cause problems.
from vhdl-style-guide.
Morning @JHertz5 ,
Part of me is thinking changing indentSize
and indentStyle
to their new values under the hood is the wrong approach. When a rule is deprecated, the user is notified so they can update their configuration. In this case an option has been deprecated, so why do I feel the code must handle this under the hood? I think I should just throw an error and force the user to update. This would keep the code cleaner as the code attempting to convert indentSize
and indentStyle
would be removed.
Would you have a preference?
--Jeremy
from vhdl-style-guide.
Hi @jeremiah-c-leary! I agree, it would definitely be preferable to make a clean transition IMO. The only benefit to the under-the-hood conversion would be that it gives people time to switch over before their configs are broken, but even then, you're just breaking that config later instead of now. If I'm not mistaken, trying to use a deprecated rule throws an error, so it makes sense that using a deprecated config option would do the same.
from vhdl-style-guide.
Evening @JHertz5 ,
I changed the code to raise an exception if indentSize
or indentType
is found. The message states to change them to indent_size
and indent_type
respectively. Could you check it out and let me know what you think of the implementation?
Thanks,
--Jeremy
from vhdl-style-guide.
Hi @jeremiah-c-leary. That looks mostly good to me, but I've found a mistake. indentStyle
has been renamed to indent_style
, but in config.py and in some tests, the code is using indentType
as the deprecated name and indent_type
as the new name. As a result, using indentStyle
doesn't raise the aforementioned error and is silently ignored instead.
from vhdl-style-guide.
Morning @JHertz5 ,
Good catch. Not sure how I changed indent_style
to indent_type
.
BTW, it turns out the smart_tab
tests were not being executed because the directory was missing __init__.py
. I made some changes to include those tests. I discovered this when trying to grep for indentStyle
and wondering why the test was not failing.
I pushed an update. Let me know if there are any other issues.
Thanks,
--Jeremy
from vhdl-style-guide.
Hi @jeremiah-c-leary. Excellent, thanks very much! I've tested the branch again and it is looking good to me!
from vhdl-style-guide.
Related Issues (20)
- Junit Report says Failure when successfull HOT 5
- VSG crashes when the `package` keyword is the first word in the file HOT 1
- The solution message for `type_008` is misleading HOT 2
- Add rules for function and parameter to have the closing parenthesis on its own line HOT 9
- Typo - "superceeced" HOT 2
- Default configuration of rule `procedure_call_003` does not match that described in the documentation. HOT 3
- Support placement of block closing statement relative to openeing statement vertical alignment HOT 3
- Add rules to enforce prefixes and suffixes on for generate/loop parameters HOT 3
- The list of disabled rules in "Configuring Disabled Rules" is incomplete HOT 2
- Reducing duplication of rule identifiers in the codebase HOT 5
- Add documentation for contributers
- Running the unit tests leaves behind a file in the root of the repository HOT 2
- Exception on valid VHDL " 'close_parenthesis' object has no attribute 'iId' " when using --all_phases HOT 2
- Hang on malformed array range followed by unclosed port HOT 5
- port_026 missing closing parenthesis in split ports HOT 3
- Code block is not showing on Configuring Multiline Indent Rules page HOT 2
- procedure_call_003 alignment glitch with positional parameters HOT 3
- interface_list reprocesses the same interface_element multiple times HOT 2
- Add documentation: Rule is (auto)fixable HOT 7
- Rules variable_011 and variable_assignment_008 are failing after late merge.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vhdl-style-guide.