-
Notifications
You must be signed in to change notification settings - Fork 53
Bug: DATA declarations not aligned if HASHED|SORTED TABLE with compound key #129
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Hi Ludwig, yes, well observed – this is a bit of a functional gap: ABAP cleaner leaves the declaration block unchanged if it contains a table type with multiple specified key components, because this declaration would end up in one line, and in case you have many key components, that line might be too long. As you can see from the code, though, short cases such as Kind regards, |
Hi Jörg-Michael, I guess that is a matter of taste. Sometimes I declare an extra table type even if I only use it just once, and sometimes I don't. types ty_tag_map_table type HASHED TABLE OF ty_tag_map WITH UNIQUE KEY tag_name owner.
DATA action_name TYPE string.
DATA tags_dac TYPE REF TO zcl_abaptags_tags_dac.
DATA new_tag_map TYPE TY_TAG_MAP_TABLe.
DATA tagged_objects TYPE zabaptags_tagged_object_t.
DATA tagged_objects_db TYPE zif_abaptags_ty_global=>ty_db_tagged_objects. now the TYPES ty_tag_map_table TYPE HASHED TABLE OF ty_tag_map WITH UNIQUE KEY tag_name owner.
DATA action_name TYPE string.
DATA tags_dac TYPE REF TO zcl_abaptags_tags_dac.
DATA new_tag_map TYPE ty_tag_map_table.
DATA tagged_objects TYPE zabaptags_tagged_object_t.
DATA tagged_objects_db TYPE zif_abaptags_ty_global=>ty_db_tagged_objects. A few tests showed that the table type is now preventing the complete Kind regards, |
Hi Ludwig, I think I found a better solution now. The "Align declarations" rule still does not actively align WITH clauses (which could of course get rather complex with many components, secondary keys etc.), but at least this does not prevent aligning the rest anymore: The approach is now that when a WITH clause is found,
This means that you might have to manually move the WITH clauses left or right a bit, but at least manual alignment is not destroyed in these cases. Kind regards, |
Hi Jörg-Michael, that works for me 😅👍🏻. Kind regards, |
Hi Ludwig, great, and thanks for bringing this up – this should now be fixed with version 1.7.0! Kind regards, |
Nice work! |
Hi,
I have an issue that
DATA
declarations that containTABLE
declarations with compound keys are not aligned correctly.Unformatted Code
Rule Config for Align Declarations
Expectation
Actual Result
Conclusion
So, its not that nothing is done by ABAP cleaner, but the result is not satisfactory. However if I remove one key component from the table declaration line, or if I comment/remove the table declaration line, then I would get the expected result as seen above.
I traced the problem to the following code block:
abap-cleaner/com.sap.adt.abapcleaner/src/com/sap/adt/abapcleaner/rules/alignment/AlignDeclarationsRule.java
Lines 564 to 574 in ca09c06
Kind regards,
Ludwig
The text was updated successfully, but these errors were encountered: