& abapOpenChecks
@LarsHvam
larshp
nnit

Disclaimer

Test in sandbox
Open source
  • old versions
  • contribute

  • Git client for ABAP
    started 2 years ago
    489 commits
    7 contributors
    ~24000 lines
    7.02 and up

    Design Goals

  • Easy installation
  • Easy upgrade
  • Small system footprint
  • Code readable in git repository
  • Connectivity

    cl_http_client=>create_by_url(
      EXPORTING
        url    = 'https://github.com'
        ssl_id = 'ANONYM'
      IMPORTING
        client = li_client ).
    li_client->request->set_cdata( '' ).
    li_client->request->set_header_field(
      name  = '~request_method'
      value = 'GET' ).
    li_client->request->set_header_field(
      name  = 'user-agent'
      value = 'git/abapGitv1.9.7' ).
    li_client->request->set_header_field(
      name  = '~request_uri'
      value = '/larshp/abapOpenChecks.git/info/refs?service=git-upload-pack' ).
    li_client->send( ).
    
    001e# service=git-upload-pack
    000000fb868c5c06d2b51f6b83668f80922260f42a7ff4ca HEAD multi_ack thin-pack ...
    003f868c5c06d2b51f6b83668f80922260f42a7ff4ca refs/heads/master
    0040c1398119983b0ae48ec4091d9519194768a71bae refs/pull/268/head
    0000
    

    Serialization

    zhello.prog.abap
    REPORT zhello.
    
    WRITE 'hello'.
    
    zhello.prog.xml
    <?xml version="1.0" encoding="utf-8"?>
    <abapGit version="v1.0.0" serializer="LCL_OBJECT_PROG" serializer_version="v1.0.0">
     <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
      <asx:values>
       <PROGDIR>
        <NAME>ZHELLO</NAME>
        <STATE>A</STATE>
        <SQLX/>
        <EDTX/>
        <VARCL>X</VARCL>
        <DBAPL/>
        <DBNA/>
        <CLAS/>
        <TYPE/>
        <OCCURS/>
        <SUBC>1</SUBC>
        <APPL/>
        <SECU/>
        <CNAM/>
        <CDAT>0000-00-00</CDAT>
        <UNAM/>
        <UDAT>0000-00-00</UDAT>
        <VERN/>
        <LEVL/>
        <RSTAT/>
        <RMAND/>
        <RLOAD>E</RLOAD>
        <FIXPT>X</FIXPT>
        <SSET/>
        <SDATE>0000-00-00</SDATE>
        <STIME/>
        <IDATE>0000-00-00</IDATE>
        <ITIME/>
        <LDBNAME/>
        <UCCHECK>X</UCCHECK>
       </PROGDIR>
       <DYNPROS/>
       <CUA>
        <ADM>
         <ACTCODE/>
         <MENCODE/>
         <PFKCODE/>
         <DEFAULTACT/>
         <DEFAULTPFK/>
         <MOD_LANGU/>
        </ADM>
        <STA/>
        <FUN/>
        <MEN/>
        <MTX/>
        <ACT/>
        <BUT/>
        <PFK/>
        <SET/>
        <DOC/>
        <TIT/>
        <BIV/>
       </CUA>
       <TPOOL>
        <item>
         <ID>R</ID>
         <KEY/>
         <ENTRY>test</ENTRY>
         <LENGTH>4</LENGTH>
         <SPLIT/>
        </item>
       </TPOOL>
      </asx:values>
     </asx:abap>
    </abapGit>
    
    and deserialization
    comparing code in repository vs system

    Supported object types

    ACIDMSAGSPLOTYPE
    AUTHNROBSSFOVCLS
    CLASPARASSSTVIEW
    DOMAPROGSUSCW3HT
    DTELSFBFSUSOW3MI
    ENQUSFBSTABLWDYA
    IARPSFSWTOBJWDYN
    IASPSHLPTRANXSLT
    IATUSICFTTYP
    Updated list:
    Supported-object-types

    and
    https://github.com/larshp/abapGit-Plugins
    by Oliver Jägle(@OJaegle)

    Protocol


    Git-Internals-Git-Objects, pack-format.txt, rfc1951.txt

    Github Support

    The SHA1 mismatch
    Git protocol: "Server and client MUST use lowercase for obj-id, both MUST treat obj-id as case-insensitive."
    The HTTP header incident
    rfc2616-sec4.html#sec4.2
    "Field names are case-insensitive"

    Features: .abapgit.xml

    <?xml version="1.0" encoding="utf-8"?>
    <asx:abap xmlns:asx="http://www.sap.com/abapxml" version="1.0">
     <asx:values>
      <DATA>
       <MASTER_LANGUAGE>E</MASTER_LANGUAGE>
       <STARTING_FOLDER>/abap/</STARTING_FOLDER>
       <IGNORE>
        <item>/.gitignore</item>
        <item>/.travis.yml</item>
        <item>/LICENSE</item>
        <item>/README.md</item>
       </IGNORE>
      </DATA>
     </asx:values>
    </asx:abap>
    

    Features: Online/Offline

    Features: Folder support

    Features: Explore

    Background mode

    Use case: Share code

    What if: The Ethan Setup


    Ethan's Article

    What if: Extra visibility


    abapGitServer (WIP)

    Labs preview: abapmerge


    24000 lines
    110+ classes
    single REPORT/file
    REPORT zabapgit.
    
    INCLUDE zabapgit_protocol.
    INCLUDE zabapgit_gui.
    INCLUDE zabapgit_prog.
    
    abap_include_assembler
    abapmerge
    #210
    abapOpenChecks
    Extra checks for SCI/ATC
    started 2 years ago
    428 commits
    1 contributor
    ~21000 lines
    7.02 and up

    Disclaimer

    Checks

  • CHECK_01 - IF in IF
  • CHECK_02 - EXIT or CHECK outside of loop
  • CHECK_03 - Wrong use of TRY-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_15 - Kernel CALL
  • CHECK_16 - Line contains only . or ).
  • 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 - Chained Statements
  • CHECK_24 - Identical code blocks
  • CHECK_25 - Selection screen data not referenced statically
  • CHECK_26 - No direct changes to standard tables
  • CHECK_27 - Last statement is RETURN
  • CHECK_28 - Space before . or ,
  • CHECK_29 - Naming, Local test classes
  • CHECK_30 - EXPORTING can be omitted
  • CHECK_31 - Extended Program Check, Filterable
  • CHECK_32 - Database access
  • CHECK_33 - Append structure field names
  • CHECK_34 - Large WHEN construct
  • CHECK_35 - Message not in use
  • CHECK_36 - Exception text not in use
  • CHECK_37 - Define message texts in SE91
  • CHECK_38 - Avoid use of SELECT-ENDSELECT
  • CHECK_39 - Smartforms global definitions naming conventions
  • CHECK_40 - Check SY-SUBRC
  • CHECK_41 - Empty line in statement
  • CHECK_42 - Identical WHEN code
  • CHECK_43 - Parameter name can be omitted
  • CHECK_44 - EXPORTING can be changed to RETURNING
  • CHECK_45 - Use expressions
  • CHECK_46 - Shadowed variable
  • CHECK_47 - RFC call error handling
  • CHECK_48 - Table DEFAULT KEY
  • CHECK_49 - Double space
  • CHECK_50 - ASSERT and unit test ASSERT
  • Background

  • Based on real life examples
  • All checks configurable

  • upDOWNci
  • CHECK_06 - Pretty printer

    abenlower_upper_case_guidl.htm
    abenuse_pretty_printer_guidl.htm

    link

    CHECK_08 - Obsolete statement

    MOVE foo TO bar.
    
    COMPUTE foo = 2 + 5.
    
    link

    CHECK_07 - Functional style

    CALL METHOD lo_columns->set_count_column
      EXPORTING
        value = 'FOOBAR'.
    lo_columns->set_count_column( EXPORTING value = 'FOOBAR' ).
    link

    CHECK_30 - EXPORTING

    lo_columns->set_count_column( EXPORTING value = 'FOOBAR' ).
    lo_columns->set_count_column( value = 'FOOBAR' ).
    link

    CHECK_43 - Parameter name

    lo_columns->set_count_column( value = 'FOOBAR' ).
    lo_columns->set_count_column( 'FOOBAR' ).
    link

    Labs Preview: abaplint

    DEMO

    How to contribute

    https://github.com/larshp/abapGit
    https://github.com/larshp/abapOpenChecks