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": TODO comment not removed for exception #58

Closed
ConjuringCoffee opened this issue Jun 12, 2023 · 3 comments
Closed
Assignees
Labels
bug Something isn't working

Comments

@ConjuringCoffee
Copy link
Contributor

Hi Jörg-Michael,

I found an example in which the generated TODO comment is not removed after a use for the variable is added.

Before the variable is used:

  METHOD example.
    TRY.
        RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
      CATCH cx_sy_itab_line_not_found INTO DATA(exception).
*        MESSAGE exception TYPE 'E'.
    ENDTRY.
  ENDMETHOD.

The ABAP Cleaner correctly adds the comment:

  METHOD example.
    TRY.
        RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
      CATCH cx_sy_itab_line_not_found INTO DATA(exception). " TODO: variable is assigned but only used in commented-out code (ABAP cleaner)
*        MESSAGE exception TYPE 'E'.
    ENDTRY.
  ENDMETHOD.

However, actually using the variable afterwards doesn't remove the TODO comment again:

  METHOD example.
    TRY.
        RAISE EXCEPTION TYPE cx_sy_itab_line_not_found.
      CATCH cx_sy_itab_line_not_found INTO DATA(exception). " TODO: variable is assigned but only used in commented-out code (ABAP cleaner)
        MESSAGE exception TYPE 'E'.
    ENDTRY.
  ENDMETHOD.
@ConjuringCoffee ConjuringCoffee changed the title "Delete unused variables": TODO Comment not removed for exception "Delete unused variables": TODO comment not removed for exception Jun 12, 2023
@jmgrassau jmgrassau added the bug Something isn't working label Jun 12, 2023
@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

very good finding, thanks for reporting this! Hm, maybe the check only works for stand-alone TODO comment lines, not for the special case here? Definitely worth fixing this!

Kind regards,
Jörg-Michael

@jmgrassau jmgrassau self-assigned this Jun 14, 2023
@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

this will be fixed in the next release.

Kind regards,
Jörg-Michael

@jmgrassau
Copy link
Member

Hi ConjuringCoffee,

version 1.4.1 was just released and should clean up these line-end comments as well!

Kind regards,
Jörg-Michael

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

No branches or pull requests

2 participants