Skip to Content

Over the last 6 months I’ve been working on a set of custom checks for code inspector, the project is available on github.

Currently it contains the following general purpose checks, some complex and some simple.

CHECK_01 – IF in IF

CHECK_02 – EXIT outside of loop

CHECK_03 – TRY without CATCH

CHECK_04 – Line length

CHECK_05 – 7 bit ASCII

CHECK_06 – Check for use of pretty printer

CHECK_07 – Functional writing style for CALL METHOD

CHECK_08 – Obsolete statement

CHECK_09 – Tab instead of spaces

CHECK_10 – Use icon_ constants

CHECK_11 – Max one statement per line

CHECK_12 – Specify SORT order

CHECK_13 – Sequential blank lines

CHECK_14 – Commented code

CHECK_17 – Definitions in top of routine

CHECK_18 – Empty branch

CHECK_19 – Use LINE OF

CHECK_20 – Bad indentation

CHECK_21 – Unused FORM parameter

CHECK_22 – Conditions contain identical code

CHECK_23 – CHECK outside of loop

CHECK_24 – Identical code blocks

CHECK_25 – Selection screen data not referenced statically

CHECK_26 – No direct changes to standard tables

You can configure code inspector or ATC to use these checks in your default variant.

/wp-content/uploads/2015/03/checks_660066.png

The checks are provided “AS IS”, some might not fit your development requirement, and some might be slow or not even work.

This is a box of chocolates; take the ones you like 🙂 . Some of the checks contains settings so it is possible to change to fit your requirements.

Feel free to submit pull requests or open issues. More checks will be added over time.

https://github.com/larshp/abapOpenChecks

To report this post you need to login first.

22 Comments

You must be Logged on to comment or reply to a post.

  1. Peter Inotai

    Hi Lars,

    Thanks a lot for sharing these checks.

    I believe in SAP BASIS 7.02 CHECK_02 (EXIT outside of loop) and CHECK_23 (CHECK outside of loop) are part of the standard checks:

    Anyway in lower releases it might not be there, so it makes sense to implement there.

    Peter

    (0) 
    1. Lars Hvam Post author

      These 2 checks are part of “Extended Program Check” -> “Programming Guidelines”.

      There are some of the checks in “Programming Guidelines” that I personally don’t like, whereas I like the CHECK / EXIT checks. Having these checks in abapOpenChecks allows for enabling and changing the message priority, as changes of message priorities for “Extended Program Check” is not supported(see note 1887255). I’ll keep the note on the wiki page for the 2 checks so people can choose the approach they like.

      (0) 
      1. Peter Inotai

        You’re right. Changing priorities is not supported for “Extended Program Check” (not even in 7.40 system). I didn’t notice it before. 🙁

        Peter

        (0) 
        1. Lars Hvam Post author

          One note on message priorities for abapOpenChecks, the “Management of” -> “Message Priorities” is not supported. Instead its possible to define the message priority in the check variant, this allows users to have different variants with different message priorities for the same check.

          (0) 
  2. Praveer Sen

    nice post Lars, really help full and contains lots of information to reduce extra works after code writing.

    🙂 Happy Learning.

    Praveer.

    (0) 
    1. Lars Hvam Post author

      oh, regarding clones, CHECK 24 can help finding identical code blocks within the same object(class/program), it does not compare across objects.

      (0) 
  3. Lars Hvam Post author
    (0) 
  4. Florian Henninger

    It seems that there are some checks included, which need an additional product called CVA (SAP NetWeaver Application Server addon for code vulnerability analysis).

    Can you confirm it and if so, can I find a overview, what checks need this?

    Thank you

    ~Florian

    (0) 
    1. Lars Hvam Post author

      It is intended to work as a standalone package without dependencies. Though it might use a few standard SAP function modules that are not available on all versions, I will try to rewrite logic if this is the case, minimum ABAP version requirement is 702.

      I don’t have access to any systems with CVA, so I’m pretty sure it will work without. Do you get an error when installing/activating it? Please create an issue on github, then I’ll try to help you out.

      (0) 

Leave a Reply