MarketSquare / robotframework-tidy

Robot Framework code formatter
https://robotidy.readthedocs.io/
Apache License 2.0
103 stars 16 forks source link

[Enhancement] Add transformer to address Robocop's builtin-imports-not-sorted rule #706

Closed ChristopherJHart closed 1 month ago

ChristopherJHart commented 1 month ago

We have a large Robot Framework codebase that has a lot of violations against Robocop's builtin-imports-not-sorted rule that was added early last June. It would be really nice if there was a transformer that automatically sorted built-in imports to enforce compliance with this rule.

bhirsz commented 1 month ago

Agreed. Potentially we should enhance OrderSettingsSecrion with this functionality.

bhirsz commented 1 month ago

I've checked the code and I see the feature I have forgotten about in https://robotidy.readthedocs.io/en/stable/transformers/OrderSettingsSection.html . Theoretically if you configure OrderSettingsSection with imports_order it should also order built-ins (place them on top and sort alphabetically). Can you confirm it works for you? @ChristopherJHart

ChristopherJHart commented 1 month ago

@bhirsz Oh very nice, I didn't know there was a transformer that did this already! I tested it and can confirm it worked (and just saved us a ton of work). Thank you so much!