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
[Bug] Rule #1005 ignores comment lines #611
Comments
It could be parametrized - ie "ignore_comments" parameter. Or we could ignore comments with specific patterns (such as starting with triple |
Parameterizing the option to ignore comments could make sense to me, as this syntax could be a yellow flag for some other projects. Introducing a specific pattern (e.g. |
I've started working on this (I started from adding the parameter etc) but I quickly got stuck. I need we need to rethink how the rule is checking the empty lines by default. In your example: The comments are ignored, so it yields 2 empty lines - I think it's totally unexpected behaviour. Also it does not differentiate between comments that stay have the same indentation as keywords and "standalone" comments: (3/1 empty lines detected). As bare minimum it should:
Then we can add extra parameter that would check if empty lines between/after standalone comments are okay too (check_standalone_comments or smth). Example: Yellow ones should be checked by default, blue ones when using extra parameter/flag. Thoughs @mnojek ? |
I would say that the rule should not be too complicated and it should not allow more than 1 line between comments. If we ignore comments, users shouldn't be forced to understand what special conditions they need to follow. It should be intuitive. Ignoring comments should ignore all comments and lines around them, but the rule should be violated when there are 2 or more consecutive empty lines. Example: This should fail (note 2 consecutive empty lines between comment 3 and comment 4):
but this should be fine:
|
Yes, fully agreed that this would be an ideal definition! |
@mnojek I agree, this will be intuitive for the users |
@antonpaa Issue was fixed and released in Robocop 2.5.0 yesterday - please check and provide the feedback if necessary :) |
What happened?
An example code
won't pass the rule 1005 (empty-lines-between-keywords). The received output will be as follows:
It's down to preferences, but as a RF user I see use cases for having e.g. keyword library section separators (and multiple other use cases) that could be done with single-line comments between keywords.
Operating System
Windows
Robocop version
2.0.2
The text was updated successfully, but these errors were encountered: