-
Notifications
You must be signed in to change notification settings - Fork 53
Feature Request: Missing spaces #20
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
Hi Josh, oh, that's an excellent idea, will do! I never understood why ABAP syntax even allows this… Kind regards, |
P.S.: Hm, it doesn't really fit into any of the existing rules, so I think a dedicated rule would make sense. |
I agree, it should be a syntax error. Also, I edited above, the same issue applies to |
Please note that it also applies to the backtick |
Hi Josh and @ConjuringCoffee, well, in the end I thought that there was always some lack of complexity to the cleanup rule "Remove multiple spaces in empty parentheses" :-), so in the next release, that rule will be renamed to "Standardize spaces next to parentheses" and enhanced as follows: Activating the third option will additionally change lines 8, 22-24, and 32: Hope that works. As lines 27-29 show, some care was needed to not mess up cases with dynamic (method, component, attribute, …) names. Kind regards, |
This looks great! Thanks for working on this. |
I have a couple other cases we've run into with standardization of spaces. I'm not sure if these still fit in this rule or not.
Before
After
Before
After
|
Hi Josh, the new options "Separate parentheses from character literals" and "Separate condensed cases …" are now available in version 1.3.0! Regarding your last comment, the extra space in example 1. seems to be handled by the "Align logical expressions" rule already: Regarding point 2, however, I think this would be worth opening a new issue, and I guess it would be for a new cleanup rule "Align components in tabular layout" (or similar). Actually this has been on my wish list for a long time already (this being a frequent case in our unit tests). Consider the following example: DATA(var) = VALUE some_type( ( amount = '1.23' name = 'short' )
( amount = 1234 name = 'longer' )
( amount = '12.34' name = 'very long' ) ). I think this was carefully aligned, and the author probably wouldn't want ABAP cleaner to mess with such an alignment by removing the spaces after "amount =" or before the closing ")". Rather, they may want ABAP cleaner to create this tabular layout where possible (with lots of configuration options, of course :-), maybe even from multi-line scenarios, if the components fit into the allowed line width. This could get a little complex, however, if not all rows have the same selection of components, if there are comments in between etc.. So – good point, but probably a larger endeavor to find a good solution! Kind regards, |
Hi @jmgrassau, I created #67 for my point 2 above. Regarding point 1, we am not using the "Align logical expressions" rule currently, so this doesn't get handled. This is because it comes with a lot of extra alignment that isn't desired (purposely adding spaces in front of IF/WHILE/CHECK statements feels like an anti-pattern to me, but I understand if others want it). I feel that rule is meant to handle IF statements with multiple conditions, but here I'm just trying to condense a statement with one condition. Is there some way to accommodate this situation? |
Similar to existing space rules, there should be rule (or perhaps include in "Close brackets at line end"?), where a space is expected between a
'
and(
or)
for method calls and inside VALUE statements.Before:
After:
VALUE Before:
VALUE After:
The text was updated successfully, but these errors were encountered: