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: Option to replace =,<,>,<=,>=,<> by EQ, LT, GT, LE, GE, NE #273

Closed
mraht opened this issue Mar 13, 2024 · 5 comments
Closed
Assignees

Comments

@mraht
Copy link

mraht commented Mar 13, 2024

Currently there’s a rule replacing EQ, LT, GT, LE, GE, NE with =,<,>,<=,>=,<>. I'd like to have the reversed option, as I prefer the character-based comparison.

I know, a widely discussed topic, but SAP docu and clean abap just enforce the consistent use not the usage of either version.

@jmgrassau
Copy link
Member

Hi Marius,

hm, yes, personally, I don't find EQ, LT, GT to be better readable at all (except maybe for the distinction between = as an assignment operator and EQ as a comparison operator, for which other programming languages have ==); but as far as I know, there is indeed only the recommendation by the ABAP Keyword Documentation to be consistent by using either one or the other set of operators.

So it shouldn't be too difficult to add an option to enable either direction (and rename the rule "Prefer =, <>, <= etc. to EQ, NE, LE etc." accordingly). I guess you'd just want to align this setting with your team to avoid edit wars…

Kind regards,
Jörg-Michael

@mraht
Copy link
Author

mraht commented Mar 15, 2024

Hi @jmgrassau,

I don't find EQ, LT, GT to be better readable at all (except maybe for the distinction between = as an assignment operator and EQ as a comparison operator, for which other programming languages have ==)

Yes, the '=' instead of '==' leads IMHO to some disadvantages (s. SAP/styleguides#282 (comment)) and that's why I prefer the character-based comparison - it's more consistent from my point of view.

So it shouldn't be too difficult to add an option to enable either direction

Great to hear that. :)

I guess you'd just want to align this setting with your team to avoid edit wars…

Yes, but I think that's the case with some other settings, too. Also we use the folders option to align the settings with eachother - very great feature! :)

I love the work you've already done so far with abap cleaner - keep it up! :)

@jmgrassau
Copy link
Member

Hi Marius,

with the next release, the cleanup rule "Prefer =, <>, <= etc. to EQ, NE, LE etc." will be renamed to "Use consistent set of comparison operators" and allow to specify the preferred set of operators:

image

With the "textual" setting, you get:

image

Kind regards,
Jörg-Michael

@mraht
Copy link
Author

mraht commented Apr 12, 2024

Many thanks! :)

@jmgrassau
Copy link
Member

Hi Marius,

thanks again for this idea – the new option is now included in version 1.16.0, which was just released!

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

2 participants