Skip to content

Standardize escaping of ! parameters: "Never" option? #31

Closed

Description

@jelliottp

I noticed there is no Never option available for this rule.
image

Is it truly required to escape parameters that match ABAP keywords? I have been removing these for some time without issue. Perhaps we could add a Never option?

Activity

  1. jmgrassau commented on May 25, 2023

    @jmgrassau
    Member

    Hi Josh,

    you're right, you can hardly find an example where this goes wrong. However, try this case (which is complete nonsense, of course) :

        METHODS any_method
          IMPORTING
            exporting TYPE i OPTIONAL
          EXPORTING
            changing  TYPE string
          CHANGING
            raising   TYPE i.

    Kind regards,
    Jörg-Michael

  2. jelliottp commented on May 25, 2023

    @jelliottp
    Author

    Thanks for the example. So it seems importing/exporting/changing/returning/raising are the only cases where it's truly a syntax error.

    Perhaps this could be one of the configuration options? Or become the behavior for only if parameter name is ABAP word setting?

  3. jmgrassau commented on May 26, 2023

    @jmgrassau
    Member

    Hi Josh,

    I think adding "never" as a fourth option would be a good solution – or maybe it could be called "only to avoid syntax errors" or "almost never" :-)

    Please let me know if you find more examples of parameter names that trigger syntax errors. Apart from "exporting", "changing" and "raising", ! is apparently also needed for "default", "optional" and "preferred" (and "default" would be a parameter name that I could even imagine to be used in real life). By contrast, "importing", "value" and "reference" work fine.

    Kind regards,
    Jörg-Michael

  4. jelliottp commented on May 26, 2023

    @jelliottp
    Author

    Hi Josh,

    I think adding "never" as a fourth option would be a good solution – or maybe it could be called "only to avoid syntax errors" or "almost never" :-)

    Please let me know if you find more examples of parameter names that trigger syntax errors. Apart from "exporting", "changing" and "raising", ! is apparently also needed for "default", "optional" and "preferred" (and "default" would be a parameter name that I could even imagine to be used in real life). By contrast, "importing", "value" and "reference" work fine.

    Kind regards, Jörg-Michael

    I would support either solution. "Never" should be sufficient; engineers would be already alerted to an issue with the parameter name due to the syntax error, so cleanup really shouldn't be necessary.

  5. self-assigned this
    on May 30, 2023
  6. jmgrassau commented on May 30, 2023

    @jmgrassau
    Member

    Hi Josh,

    okay, in the next release, this option will look as follows:

    image

    The example now shows all critical keywords that I am aware of:

    image

    Kind regards,
    Jörg-Michael

  7. jmgrassau commented on Jun 6, 2023

    @jmgrassau
    Member

    Hi Josh,

    this new option is now released with version 1.3.0!

    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

enhancementNew feature or request

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions