MarketSquare / robotframework-sherlock

Robot Framework code inspector
Apache License 2.0
13 stars 1 forks source link

[Feature] Deprecate Unused User Defined keywords #48

Open leeuwe opened 2 years ago

leeuwe commented 2 years ago

Feature idea It would be very useful if you could net jet remove, but deprecate unused User Defined keywords with [documentation] *DEPRECATED on ${date}*

Like: https://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#deprecating-keywords

That would also allow for a report printing a table on when what keyword was removed and even automatic removal when a keyword has been deprecated for x time. Or even setting up a auto clean policy

| Keyword name | deprecation date | auto-remove date |  

This would've saved me so much work in maintaining my user defined keywords

Send me a message if you like more input!

bhirsz commented 2 years ago

It actually span over mulitple tools. I could add deprecation status to sherlock (if run with some flag, like --show-deprecated). Then it would be displayed in reports (and maybe it could throw warnings/set report to warn status if there are deprecated keywords).

But removal should be done through tidy. It's certainly possible to create transformer for tidy that would read documentation for deprecation info and remove the whole keyword if the it matches given condition (current date / version given by parameter etc). It needs some extra brainstorming though - for example why if the defined keyword is deprecated but is used somewhere? Usage can be be only safely tracked through tools like Sherlock so it would require running the analysis first and then tidy to perform removal.

mnojek commented 2 years ago

This feature is great but I would say it should not be done automatically. Deprecation and removal of anything from the code should be done consciously by a developer, not an automated process. The automated process can indicate the place and notify the developer, but should not remove anything on behalf of the developer. It can cause some serious issues and produce new bugs.