Comments (6)
The ABAP formatter actually does format those examples of yours like that, on a very recent release... Unfortunately the results of the ABAP formatter are backend release dependant.
from abap-cleaner.
The ABAP formatter actually does format those examples of yours like that, on a very recent release... Unfortunately the results of the ABAP formatter are backend release dependant.
I'd be fine with that for examples 1 & 2. But does it format like abap-cleaner does even for 3? That behavior seems very odd.
from abap-cleaner.
Hi Josh,
in my ADT, ABAP Formatter indeed puts this to upper case TEXT-01
– and shows an error saying '"TEXT-01" is not a numbered text (for example: TEXT-001).' Doesn't it expect three digits on your system?
Example 2 is formatted by ABAP Formatter exactly as shown in your code, so it is indented, which I think makes sense and is consistent with formatting of BEGIN OF ... END OF
blocks in other cases like TYPES
.
Regarding example 3 – yes, it is really unfortunate that we have to break a TYPES
chain for an INCLUDE
! In my ADT, ABAP Formatter does this:
TYPES:
BEGIN OF some_type.
INCLUDE TYPE nested_type.
TYPES: field TYPE farr_contract_id,
END OF some_type.
… which looks really messy to me. Your example …
TYPES:
BEGIN OF some_type.
INCLUDE TYPE nested_type.
TYPES: field TYPE some_field,
END OF some_type.
… actually looks better for my taste, but then, isn't it a bit inconsistent to have the TYPES
keyword in two completely different positions? The second one is even indented further than END OF
!
That's why ABAP cleaner tries to have the TYPES
keywords at the same horizontal position (because they are at the same level of indentation), while moving the whole BEGIN OF ... END OF
block a bit to the right, so it can be formatted as if it all were a single chain:
TYPES: BEGIN OF some_type.
INCLUDE TYPE nested_type.
TYPES: field TYPE some_field,
END OF some_type.
So, you could say it was a conscious decision against what ABAP Formatter does…
Kind regards,
Jörg-Michael
from abap-cleaner.
Hi Josh,
in my ADT, ABAP Formatter indeed puts this to upper case
TEXT-01
– and shows an error saying '"TEXT-01" is not a numbered text (for example: TEXT-001).' Doesn't it expect three digits on your system?
Yes, this is just a typo.
Example 2 is formatted by ABAP Formatter exactly as shown in your code, so it is indented, which I think makes sense and is consistent with formatting of
BEGIN OF ... END OF
blocks in other cases likeTYPES
.
I would prefer the indentation also, so this is just a difference of versions apparently.
Regarding example 3 – yes, it is really unfortunate that we have to break a
TYPES
chain for anINCLUDE
! In my ADT, ABAP Formatter does this:TYPES: BEGIN OF some_type. INCLUDE TYPE nested_type. TYPES: field TYPE farr_contract_id, END OF some_type.… which looks really messy to me. Your example …
TYPES: BEGIN OF some_type. INCLUDE TYPE nested_type. TYPES: field TYPE some_field, END OF some_type.… actually looks better for my taste, but then, isn't it a bit inconsistent to have the
TYPES
keyword in two completely different positions? The second one is even indented further thanEND OF
!That's why ABAP cleaner tries to have the
TYPES
keywords at the same horizontal position (because they are at the same level of indentation), while moving the wholeBEGIN OF ... END OF
block a bit to the right, so it can be formatted as if it all were a single chain:TYPES: BEGIN OF some_type. INCLUDE TYPE nested_type. TYPES: field TYPE some_field, END OF some_type.So, you could say it was a conscious decision against what ABAP Formatter does…
Kind regards, Jörg-Michael
Point 3 is certainly a unique situation. On one hand, yes, I would like all TYPES
keywords in the same position, but I feel like the nested type is an exception, since it belongs inside the BEGIN
/END
block. I'm not sure I like it, but I have found that there is a "solution" which satisfies both abap-cleaner and the ATC checks we have for indentation in abapOpenChecks:
TYPES BEGIN OF some_type.
INCLUDE TYPE nested_type.
TYPES field TYPE some_field.
TYPES END OF some_type.
Not sure if others use this type of syntax, but I suppose it's a (not very obvious) compromise.
from abap-cleaner.
Closing this since there's a workaround and it's system version-dependent.
from abap-cleaner.
Hi Josh,
alright, thanks! Just to have some label assigned, I think this is somewhere in between "won't fix" and "no defect" …
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
- "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
- "Align parameters and components": Options do not behave as expected HOT 5
- 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.