Skip to content
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

Feature Request ASSERT ... FIELDS #287

Open
vonglan opened this issue Apr 5, 2024 · 2 comments
Open

Feature Request ASSERT ... FIELDS #287

vonglan opened this issue Apr 5, 2024 · 2 comments

Comments

@vonglan
Copy link

vonglan commented Apr 5, 2024

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

@jmgrassau
Copy link
Member

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":

image

Kind regards,
Jörg-Michael

@vonglan
Copy link
Author

vonglan commented Jun 3, 2024

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants