Subject: | Extend Perl::Critic::Policy to support refactoring |
Most perlcritic violations have one or more possible resolutions, which
can usually be reached by rewriting the code. Or - that's the new idea -
using the refactoring possibilities in the PPI-Tree.
By making it possible for Policy creators to write a resolution directly
where the problems were found, we could make Perl IDEs almost as
powerful as Java IDEs.
For example, EPIC has a good perlcritic integration. If a perlcritic
violation is found, I'd like to be able to fix this problem by applying
the suggested refactoring, whenever the perlcritic policy supports this.
In a nutshell we need to extend the perlcritic policy interface to
return a list of possible resolutions e.g.
RequireTrailingCommas has one resolution ( "addCommas" ) which produces
a refactored PPI tree internally, containing the additional commas, if
called with the appropriate switch ("-refactor
RequireTrailingCommas=addCommas"). And finally the refactored tree is
dumped to STDOUT