Giter Site home page Giter Site logo

Comments (5)

jmgrassau avatar jmgrassau commented on May 27, 2024 2

Hi JanisBur,

I think the best way to suppress this would be to add a ##NEEDED pragma at the end of the line of @DATA(ls_dummy). With this, ABAP cleaner will not add such a TODO comment (in fact, it will even automatically remove the existing one). Without ##NEEDED, the Extended Check (transaction SLIN) would also create a Field Attributes warning:

image

Kind regards,
Jörg-Michael

from abap-cleaner.

fabianlupa avatar fabianlupa commented on May 27, 2024 2

@JanisBur For the existence check I usually do this instead:

SELECT COUNT(*)
  FROM pa0000
  WHERE begda <= @sy-datum
    AND endda >= @sy-datum.
IF sy-dbcnt >= 1.
  " further processing
ENDIF.

Or even this:

SELECT SINGLE @abap_true
  FROM pa0000
  WHERE begda <= @sy-datum
    AND endda >= @sy-datum
  INTO @DATA(exists).
IF exists = abap_true.
  " further processing
ENDIF.

Do note using COUNT bypasses the table buffer implicitly compared to the other solutions.

from abap-cleaner.

ConjuringCoffee avatar ConjuringCoffee commented on May 27, 2024 1

This wasn't clear to me. I really like how it even automatically removes its own comment. How about adding examples to the rule to demonstrate the use of ##NEEDED?

from abap-cleaner.

jmgrassau avatar jmgrassau commented on May 27, 2024 1

Hi @ConjuringCoffee,

How about adding examples to the rule to demonstrate the use of ##NEEDED?

Actually there is already a tiny, inconspicuous line in the "Delete unused variables" examples …

image

… but happy to add some more comment there to explain it! Anyway you could often continue the "no defect" label with "… but apparently not intuitive and documented well enough" :-)

So reopening this to make sure I don't forget it.

Kind regards,
Jörg-Michael

from abap-cleaner.

jmgrassau avatar jmgrassau commented on May 27, 2024

Hi JanisBur and @ConjuringCoffee,

in version 1.3.0, the example of the "Delete unused variables" rule is now enhanced to make the effect of the ##NEEDED pragma a bit more visible:

image

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.