abap-cleaner icon indicating copy to clipboard operation
abap-cleaner copied to clipboard

Would it be possible to create custom rules?

Open jabulaniruiz opened this issue 2 years ago • 7 comments

This is not an error but an enhancement.

I am in the middle of a project where we have to change many reports to adapt them to new personnel structures, and I was thinking that I could at the same time clean the code.

So, also add for example the rule to replace "bukrs = '1000'" with "bukrs = '1100'"

This rule could be setup very quickly and I wouldn't need to perform everything in two steps.

Thanks for the feedback and for the GREAT TOOL!

Kind regards,

jabulaniruiz avatar May 24 '23 10:05 jabulaniruiz

Hi,

just to be sure that I understand you correctly: So the idea would be to have a generic text replacement rule in which you can enter any search text and any replace text, and this replacement would then be executed as part of the cleanup?

Kind regards, Jörg-Michael

jmgrassau avatar May 24 '23 11:05 jmgrassau

Hi Jörg-Michael, That sounds perfect and if possible, so that in the options more than one placeholder could be included that would be awesome, as it could be that more than one text string should be replaced. If I could help with anything, please let me know. Thanks and kind regards, Javier Ruiz

jabulaniruiz avatar May 24 '23 12:05 jabulaniruiz

Hi,

I must admit I am a bit hesitant: While I see the advantage of having everything done with one keystroke and the flexibility of the idea, this might also be rather risky – replacements happening in unexpected places, or someone activating this for some special case, then forgetting about it, and later creating unintended changes with it etc.

Also, such a rule would directly lead to a whole range of required options on "Case sensitive", "Wrap search", "Whole word", "Regular expressions" etc. – and actually all that is already implemented in Eclipse's Find/Replace function…

Maybe a good case for the label "discussion wanted", let's see what others think about it!

Kind regards, Jörg-Michael

jmgrassau avatar May 25 '23 10:05 jmgrassau

Hi Jörg-Michael, I understand. It's clear that it won't fit all cases but maybe others see also here a very good extension. Thanks and kind regards, Javier Ruiz

jabulaniruiz avatar May 26 '23 15:05 jabulaniruiz

This plug-in dedicated to applying clean Code rules to ABAP. IMHO, it should stay that way.

I would prefer not to "bloat" it with unwanted rules e.g., text replacement.

~ Suhas

suynwa avatar Jun 27 '23 15:06 suynwa

currently it contains multiple rules which are not part of the clean ABAP style guide. If talking about the idea about writing clean ABAP, it can be anything

larshp avatar Jun 27 '23 15:06 larshp

I've been using the ABAP Cleaner for a couple of months now and I didn't come across any use case where I wanted to have custom clean clean-up rules yet - only rules that are generally applicable to everyone.

ConjuringCoffee avatar Nov 20 '23 13:11 ConjuringCoffee