Skip to content

Syntax Error caused by rule "Simplify a chain with one element" inside Includes #372

Closed

Description

@openPhiL

Hello Jörg-Michael,
The following scenario is leading to a wrong cleaning:
Rule: "Simplify a chain with one element" with the default options

When we apply the cleaner to this code:

DATA:
  "! Only used for declaring select-option
  gv_serial_number TYPE gernr.

it will produce this code:

"! Only used for declaring select-option DATA gv_serial_number TYPE gernr.

Important: This seems to only happen because the object that we found is an include where the DATA:-line is literally the first line of the object. Any other command or even comment above the DATA will prevent this error.

Thank you for looking into it!
PhiL

Activity

  1. self-assigned this
    on Nov 9, 2024
  2. jmgrassau commented on Nov 9, 2024

    @jmgrassau
    Member

    Hi PhiL,

    ooops … Nice finding! Internally, ABAP cleaner always stores the number of line breaks above (and spaces left of) each token. At document start this can be 0, and this special case case was obviously not considered here. Will be fixed with the next release!

    image

    Kind regards,
    Jörg-Michael

  3. jmgrassau commented on Nov 11, 2024

    @jmgrassau
    Member

    Hi openPhiL,

    thanks for this bug reporting – this shouldn't come up again with version 1.20.1!

    Kind regards,
    Jörg-Michael

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

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions