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: Use newer expressions #36

Open
6 of 11 tasks
jelliottp opened this issue May 26, 2023 · 13 comments
Open
6 of 11 tasks

Feature request: Use newer expressions #36

jelliottp opened this issue May 26, 2023 · 13 comments
Assignees

Comments

@jelliottp
Copy link

jelliottp commented May 26, 2023

There are a number of newer expressions that seem like a good fit for a rule to replace the old syntax, such as:

@jelliottp jelliottp changed the title Feature request: Use Expressions Feature request: Use newer expressions May 26, 2023
@jmgrassau
Copy link
Member

Hi Josh,

great, that sounds very promising for multiple new cleanup rules! We'd have to check about limitations for automation in the individual cases, of course, but looking forward to this!

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau self-assigned this Jul 10, 2023
@jmgrassau
Copy link
Member

Hi Josh,

just to keep you updated, I now implemented an important prerequisite to some of these ideas, namely

  • some helper functions to determine which ABAP commands change relevant system fields (sy-subrc, sy-tabix, sy-index, sy-tfill, sy-tleng), and
  • a "ProgramFlowAnalyzer" (extended by "SyFieldAnalyzer") to find out which subsequent commands read them, before another command changes them again.

This is needed, obviously, because these newer expressions don't change the system fields, and we must excluded unexpected cases from cleanup (e.g. when the system field is first stored in a variable and evaluated at a different point).

To be continued!

Kind regards,
Jörg-Michael

P.S.: Points 6 and 7 are already implemented with the "Replace TRANSLATE with string functions" rule, but line_index( ) could be added to the list.

@jmgrassau
Copy link
Member

Hi Josh,

FYI, for point 10 "String templates", a dedicated issue #116 was opened, so discussion for this particular point could be continued there.

Kind regards,
Jörg-Michael

@jelliottp
Copy link
Author

Hi @jmgrassau, just circling back to this one. The tool has become very stable and useful! Do you think any of these would make it as a priority soon?

@jmgrassau
Copy link
Member

Hi Josh,

thanks for the reminder, and really sorry that (due to limited capacity) there was no progress here for such a long time!

Hm, if you could choose, which of those 10 open ideas would you find most useful to start with?

Kind regards,
Jörg-Michael

@jelliottp
Copy link
Author

jelliottp commented Feb 20, 2024

I think CORRESPONDING #( ) is probably the most common one I see right now so I’d start there. I believe it would need to include the BASE addition to be a safe conversion from MOVE-CORRESPONDING. String templates in #116 is also important.

I’ll also try to re-order the rest based on priority, and others can give their input here as well.

@jmgrassau
Copy link
Member

Hi Josh,

okay, starting small with an upcoming cleanup rule that changes DESCRIBE TABLE itab LINES lin into lin = lines( itab ):

image

However, the examples show that this is not entirely trivial:

image

Kind regards,
Jörg-Michael

@jelliottp
Copy link
Author

Great! Looks good, and you are right there are some outliers to be aware of.

@jmgrassau
Copy link
Member

Hi Josh,

release 1.14.0 will also offer the new rule "Replace READ TABLE with table expression" (for 3. line_exists( ) and 10. line_index( ), and additionally for ASSIGN):

image

Examples:

image

However, unfortunately, the rule can't automate everything, which is also explained in the examples:

image

Kind regards,
Jörg-Michael

P.S.: Is 6. translate( ) fulfilled with the rule "Replace TRANSLATE with string functions" or is anything missing there?

@jelliottp
Copy link
Author

These are great additions, thank you!

Also, yes translate() is already covered so I've checked that one off as well.

@jmgrassau
Copy link
Member

Hi Josh,

perfect, thanks once again for this inspiring list! (And nicely done with the ticks, references and version numbers!) Already doing some research on some of the other points …

Kind regards,
Jörg-Michael

@ConjuringCoffee
Copy link
Contributor

There's a dedicated issue for CORRESPONDING now: #266

@jmgrassau
Copy link
Member

Hi Josh,

version 1.15.0, which was just released, now includes the new cleanup rules "Use string templates to assemble text" (for 2.) and "Replace CONDENSE with string function" (for 5.)!

Kind regards,
Jörg-Michael

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

3 participants