abap-cleaner
abap-cleaner copied to clipboard
Enhancement: skip unsupported statements instead of cancelling whole cleanup
Applying ABAP Cleaner version 1.18.1 on the program at the end of the issue, due to unsupported syntax, prevents the whole cleanup:
line 8: Parse error in line 8: Chain colons inside parentheses or brackets are currently not supported by ABAP cleaner. Please rewrite this ABAP statement manually before running ABAP cleaner on this code.
1 entry was added to the error log 'C:...\AppData\Roaming\SAP\ABAP cleaner\user\error.log': the cleanup of a code file was cancelled
The real case is the 3 below lines of the class zcl_excel_writer_2007, just running a selective ABAP Cleanup on 1 line in another method of the class fails:
lo_element_root->set_attribute_ns( : name = 'xmlns:v' value = lc_xml_node_ns_v ),
name = 'xmlns:o' value = lc_xml_node_ns_o ),
name = 'xmlns:x' value = lc_xml_node_ns_x ).
Of course, I agree to rewrite these ABAP statements, but I think they should not prevent the whole cleanup.
I know that @jmgrassau is against these ABAP statements, as I said, I agree ;-) (https://github.com/SAP/abap-cleaner/issues/134#issuecomment-1754850107).
Minimal reproducible example:
REPORT.
CLASS lcl_dummy DEFINITION.
PUBLIC SECTION.
CLASS-METHODS dummy IMPORTING dummy TYPE any.
ENDCLASS.
CLASS lcl_dummy IMPLEMENTATION.
METHOD dummy.
dummy( : 'call1' ), 'call 2' ).
ENDMETHOD.
ENDCLASS.
NB: this syntax also prevents from going to the configuration, same error pops up, but I guess it should be another issue.