-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Rule to remove commented out code #607
Comments
Hey @imd1 , This would be a killer feature if it could be implemented. Do you have any thoughts on how we could differentiate between commented out code and comments? |
remove the |
Using this as an example: if a = b then
-- if a = '0' then
-- Do something
c <= 5;
end if; I could remove the second comment. So in this case it would look like: if a = b then
if a = '0' then
-- Do something
c <= 5;
end if; which would fail to parse and could be flagged. However, what about the second comment? If we remove the if a = b then
-- if a = '0' then
Do something
c <= 5;
end if; That would clearly fail to parse, but it is not commented out code. |
Could we make the following assumptions about commented out code?
So in my previous example, which I have expanded: architecture rtl of fifo is
constant b : integer;
signal a : integer;
signal c : integer;
begin
process begin
if a = b then
-- if a = '0' then
-- Do something
c <= 5;
end if;
end process;
end architecture; I could then follow these steps:
So in the example above, the first comment would be flagged because I think this would only get you a certain class of commented out code. |
in your example, the So I would treat each comment line separately and somehow determine if it's valid VHDL or not |
I was just thinking of the possible permutations for commented out code, and it seems endless. I doubt we can make this perfect, but if we could catch a certain percentage of commented out code it would be worth it. Maybe there should be a series of commented out code rules. For example: commented_out_001: checks for commented out library statements: -- library ieee; commented_out_002: check for commented out use statements: library ieee;
-- use ieee.std_logic_1164.all; or it is part of the library rules: library_???: Checks for commented out library statements: -- library ieee; So instead of a single rule to check for commented out code, we have multiple rules. |
Separate rules makes sense... The underlying principle should be whether each commented out line is valid VHDL syntax if the |
Is your feature request related to a problem? Please describe.
Some people comment out code as they are changing it, and do not rely on source control to get back to the original. This leaves the code littered with "old" code as comments which looks very messy
Describe the solution you'd like
A rule that parses the comments to determine if there is valid VHDL code hidden inside, and remove the comments if so
Describe alternatives you've considered
Manual cleanup!
Additional context
Add any other context or screenshots about the feature request here.
The text was updated successfully, but these errors were encountered: