Giter VIP home page Giter VIP logo

Comments (6)

fabianlupa avatar fabianlupa commented on August 22, 2024

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.

jelliottp avatar jelliottp commented on August 22, 2024

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.

jmgrassau avatar jmgrassau commented on August 22, 2024

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.

jelliottp avatar jelliottp commented on August 22, 2024

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 like TYPES.

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 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

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.

jelliottp avatar jelliottp commented on August 22, 2024

Closing this since there's a workaround and it's system version-dependent.

from abap-cleaner.

jmgrassau avatar jmgrassau commented on August 22, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.