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
Check indentation completely #504
Comments
I am sorry I create many issues today, but I am carefully going through our code standard and thinking how Robocop could help us to observe it. 😄 |
I've spent quite a lot of time with indents in Robocop and the reason why it isn't so strict is because how flexible Robot Framework is. Some people prefer different ways of aligning (ie align to columns, or extra align for particular statements). It makes it harder to catch actual issues. That's why current uneven indent rule does not check if we're matching fixed indent but only if all indents are the same in given block (test, keyword, for or if). But I have an idea: we could add parametr |
Don't be sorry, we really apprecieate all new ideas or issues how so we can improve Robocop further ;) |
@bhirsz I totally support this idea.
@MoreFamed At least one thing is missing here... What would be the indentation for the first token after continuation line? It can be either next 4 spaces or... something else. |
Hi, thanks for you attitude and ideas! To be clear: by word "indentation", I mean just amount of whitespace at the beginning of a line, not whitespace between tokens. (The latter could hardly be checked because of the reason @bhirsz mentions, if I caught the mention about "aligning to columns" well.) @mnojek, I am not sure I understand your question. If you ask about space between "
and this too:
I would rather check just the whitespaces before " |
@MoreFamed You're right, these are 2 different things and I mixed them up. |
I have starting working on this. There is one issue to be resolved - we have two rules for indentation, However I'm thinking about leaving only one rule. Just by the description of the rules it may not be clear why there are two rules:
It made sense to create two rules before because sometimes the indentation is just uneven (hence rule with the warning) and sometimes it is wrong and causes syntax issues (hence rule with the error). But now we have feature of allowing dynamic severity of the rule - so we can use one rule and change severity depending on our needs. For example use Such change will require deprecation warning - but it will not be breaking change (thanks to deprecation warnings) so the next version will be still minor. @mnojek WDYT? |
Now I see that the issue is from 17.09.2021 so I have exactly two days before anniversay :D |
Actually, the anniversary is today (from the first release)! 😄 So you mean that this one new rule will trigger warning when it will be something like old |
🥳 Yes. It it still not perfect (the idea that severity can change) but it will be easier to understand by users rather than two existing rules. |
I agree, let's do it. These 2 rules were confusing anyway. |
I suggest to implement all-catching check of indentation. The current rules regarding indentation ([W1007] uneven-indent and [E1008] bad-indent) allow me to indent very sloppily. 😄 It could work roughly like this:
I do not know whether Robocop is ready for such a rule, but it is able to work with indentation even now, so I hope so...
The text was updated successfully, but these errors were encountered: