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

"Delete unused variables" rule deletes variable which used in macros. #43

Closed
thebestabapdeveloper opened this issue Jun 5, 2023 · 4 comments
Assignees
Labels
bug Something isn't working documentation Improvements or additions to documentation

Comments

@thebestabapdeveloper
Copy link

thebestabapdeveloper commented Jun 5, 2023

"Delete unused variables" rule deletes variable which used in macros.

For example:

In include f01
DATA: lv_tuna TYPE developer.

In include m01
DEFINE xxx.
&1 = lv_tuna + 'xxx'.
END-OF-DEFINITION.

when formatting include f01, it deletes the definition in include f01, so it cannot be activated.

@thebestabapdeveloper
Copy link
Author

thebestabapdeveloper commented Jun 5, 2023

I temporarily chose the option to 'comment out with "' for local variables that are never used.

@jmgrassau jmgrassau added documentation Improvements or additions to documentation bug Something isn't working labels Jun 5, 2023
@jmgrassau
Copy link
Member

Hi thebestabapdeveloper :-),

thank you very much for reporting this. Actually, this is a limitation of ABAP cleaner: the tool only works on the code document provided to it, without doing further backend calls. This usually works fine for local variables, but macros are indeed an exception that can't be considered here, especially if the macro definition is 'out of sight'.

I shall therefore restrict the "Delete unused variables" rule to only work on methods that do NOT make use of macros (hopefully you won't find too much usage of macros in the code anyway…)

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi,

this issue should now be fixed in the freshly released version 1.3.0, meaning that the rule "Delete unused variables" (as well as "Use FINAL form immutable variables") will now simply skip methods in which macros are used hopefully adding another motivation to replace macros with other constructs :-) Thanks again for pointing this out!

Kind regards,
Jörg-Michael

@thebestabapdeveloper
Copy link
Author

Cheers.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants