Feature Request ASSERT ... FIELDS
Hi, in SAP customer coding (maybe not in SAP coding) the ASSERT ID statement seems like a good way to detect "strange occurrences" during runtime, with minimal coding effort. (Of course, like with UnitTests, you still have the effort of distinguishing real problems from false positives.) It seems ABAP Cleaner is not yet fully operational for this statement. Example:
ASSERT ID zlog FIELDS po_item_group->zDocumentCategory po_item_group->zdocument po_item
line->deliveryStorageLocation line->supplyingstoragelocation
CONDITION ( line->deliveryStorageLocation IS INITIAL OR
line->deliveryStorageLocation = line->supplyingstoragelocation ). " inconsistent storage location, maybe normal
I would like the FIELDS aligned in subsequent lines (maybe as few lines as possible - as this is "irrelevant" coding), and the CONDITION formatted like other conditions (e.g. LOOP AT WHERE) Best regards, Edo
Hi Edo,
that's a good point! The alignment of the CONDITION section should indeed already work with the "Align logical expressions" rule (or the "Move AND/OR etc. from line end to next line start", which calls the former). In your example, I get:
ASSERT ID zlog FIELDS po_item_group->zDocumentCategory po_item_group->zdocument po_item
line->deliveryStorageLocation line->supplyingstoragelocation
CONDITION line->deliveryStorageLocation IS INITIAL
OR line->deliveryStorageLocation = line->supplyingstoragelocation. " inconsistent storage location, maybe normal
But aligning the FIELDS list is definitely missing yet! Maybe this could be done with similar options as in "Align SELECT lists":
Kind regards, Jörg-Michael
Hi Jörg-Michael,
The alignment of the CONDITION section should indeed already work with the "Align logical expressions" rule
I have to admit that I have not looked deeply into the rule configurations. Our development team is in the phase of trying out whether the default works "99% perfectly" - then we will just stick to the default. But in the "Align logical expressions" configuration, it seems that an option for "CONDITION" is missing. Or maybe better, combine it with one of the existing options (maybe combine WHILE+WHERE+UNTIL+CONDITION - but that would not be downward compatible). Ah! "Do not align" means: Do not align with the statement (e.g. CHECK), but with the subclause. --> Maybe rename this?
Maybe this could be done with similar options as in "Align SELECT lists":
Sounds good! Again, I notice something about the wording: "Single line" means "Same line but with line breaks if line becomes too long", doesn't it? It could be phrased as "Separate lines" vs. "Try same line". I like the function "derive from majority"!
Best regards, Edo