robotframework-tidy icon indicating copy to clipboard operation
robotframework-tidy copied to clipboard

Errorneous documentation regarding InlineIf transformer

Open MoreFamed opened this issue 2 years ago • 5 comments

Hi, as regards https://robotidy.readthedocs.io/en/latest/transformers/InlineIf.html:

It reads:

With following configuration Robotidy will transform all IFs to inline IFs if they are under 140 characters long: robotidy --line-length 140 src.robot

This does not function for me this way: there remains block-IF even when the resulting line would be about 100 chars long. I think there is 80-chars limit (see discussion on Slack on April 4), which is applied and is not documented.

However, I would like Robotidy work as written in docs: when only global line_length is set, it would affect everything; but for particular transformers it could be overridden. :)

There is a typo in the last example: robotidy --line-length 140 --configure InlineIf:line_length:80 src.robot The last ":" should be changed to "=".

MoreFamed avatar Apr 27 '22 12:04 MoreFamed

Thanks for the report - most likely the issue is withing..building the documentation: image

Currently 1.6.2 is live while it should be 2.3. Most recent version described the line-length option bit better.

Hovewer there is typo in the example - I will fix it, thanks!

bhirsz avatar May 22 '22 15:05 bhirsz

However, I would like Robotidy work as written in docs: when only global line_length is set, it would affect everything; but for particular transformers it could be overridden. :)

That's how InlineIf worked at the beginning but then some people opposed saying that global limit is bit too lenient for InlineIf case (120 line length) and that's why it use separate value of 80. I need to think about this - most likely it should be discussed and decided on during style guide discussions that (I hope) will soon kick off.

bhirsz avatar May 22 '22 15:05 bhirsz

Linked PR with typo fixes and rebuilded the online documentation and added warning if the doc version is not up to date: image

bhirsz avatar May 22 '22 16:05 bhirsz

Linked PR with typo fixes and rebuilded the online documentation and added warning if the doc version is not up to date: image

That's great! Can we have it in Robocop as well? :)

mnojek avatar May 23 '22 10:05 mnojek

Linked PR with typo fixes and rebuilded the online documentation and added warning if the doc version is not up to date: image

That's great! Can we have it in Robocop as well? :)

Yes of course, it's actually fairly easy flag to set in the readthedocs so I just did it. For robocop due to the different theme the warning looks bit nicer: image

bhirsz avatar May 28 '22 12:05 bhirsz