Comments (5)
Yes, I think this makes it much clearer. Thanks!
from abap-cleaner.
Hi ConjuringCoffee,
type B ("for single-line parentheses") refers to table rows that contain multiple components, but still fit into one single code line, e.g.:
mts_long_table_name = VALUE #( ( item_key = '20220030000101' event_date = '20220301' total_quantity = '30' quantity_unit = 'TAG' )
( item_key = '20220040000101' event_date = '20220401' total_quantity = '30' quantity_unit = 'TAG' )
( item_key = '20220050000101' event_date = '20220501' total_quantity = '30' quantity_unit = 'TAG' ) ) .
You could as well call this "tabular style". This could occur quite frequently in test code, and I think this tabular style is very nice to read. Therefore, by default, ABAP cleaner "grants" some extra line width for such cases (160 chars, as opposed to 120 chars for "normal" cases), thus trying to preserve tabular style, unless it significantly exceeds line length.
The alternative would be much harder to read:
mts_long_table_name = VALUE #( ( item_key = '20220030000101'
event_date = '20220301'
total_quantity = '30'
quantity_unit = 'TAG' )
( item_key = '20220040000101'
event_date = '20220401'
total_quantity = '30'
quantity_unit = 'TAG' )
( item_key = '20220050000101'
event_date = '20220501'
total_quantity = '30'
quantity_unit = 'TAG' ) ) .
Regarding your second question: The indentation is considered, but the closing parentheses and the period are not. That's why the "tipping point" is 3 chars later than you would have expected it. The reason for this is that in a case like …
lo_any_instance->any_method( iv_any_parameter = VALUE #( ( total_quantity = '30'
quantity_unit = 'TAG' )
( total_quantity = '30'
quantity_unit = 'TAG' )
( total_quantity = '30'
quantity_unit = 'TAG' ) ) ).
… the last row would otherwise have a severe "disadvantage", because it is followed by three closing parentheses. If this led to different alignment for the last row, it wouldn't look good.
That's why the line length setting isn't "exact science" here.
Kind regards,
Jörg-Michael
P.S.: At some point, I would also like to add an option (or even a cleanup rule) that creates tabular style in cases that are short enough. Currently, it is just preserved if it already exists in the code.
from abap-cleaner.
Thank you for the quick and thorough explanations! Do you think some of this could be better explained on the UI or somehwere in the documentation?
from abap-cleaner.
Hi ConjuringCoffee,
yes, that makes sense… do you think "tabular style" would be better than "single-line parentheses"? I guess so …
Usually, I also try to set up the default example in a way that shows the effect of each option, so changing an option should usually also have an effect on the default examples (and that probably explains things better than a text would).
Kind regards,
Jörg-Michael
from abap-cleaner.
Hi ConjuringCoffee,
I now renamed the option for "max. line length B" a bit …
… and added a comment in the examples, referring to the option:
Hope that helps to make "A" and "B" more understandable – along with the possibility to change the value and observe what happens to the example!
Kind regards,
Jörg-Michael
from abap-cleaner.
Related Issues (20)
- Bug for S/4 readiness check psuedo comments HOT 3
- Aligning single parameters for functional calls HOT 4
- Remove extra spaces inside parentheses HOT 1
- Eclipse ADT - Update Site not reachable? HOT 3
- "Align parameters and components": Direct usage of structure looks weird in VALUE HOT 4
- BUG: Rules "Convert CHECK inside/outside loop..." HOT 5
- Differences with ABAP Formatter HOT 6
- "Align parameters and components" when using multiple indices in nested table expression HOT 4
- "Align conditional expressions": `THROW` not aligned nicely in `SWITCH` HOT 3
- "Align declarations": Line break if the line gets too long HOT 4
- Allow customization of `TODO` keyword HOT 2
- 'Align logical expression' does not recognize WHERE statement HOT 2
- RND parser categorizes as a CAT_LITERAL in ULINE length statement HOT 4
- Feature request: Align FORM calls HOT 1
- Feature request: Align FORM definitions HOT 1
- Feature request: Standardize order of parameters when using `CL_ABAP_UNIT_ASSERT` HOT 1
- Feature Request: remove empty line-break(s) between ENDxxxxs. HOT 3
- "Delete unused variables": Incorrect result across multiple `TEST-INJECTION` blocks HOT 2
- Bug: "prefer_is_not..." in combination with "move and/or..." breaks when comments are present HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from abap-cleaner.