Skip to content

Commit

Permalink
1.16.3 (#529)
Browse files Browse the repository at this point in the history
* updating changelog

* new version

* Removing Service (#530)

* solves #524

* changelog

* removing it from the documentation

Co-authored-by: Lucas Borin <5233413+lucasborin@users.noreply.github.co>

* Refactoring Function Check (#531)

* fixes #526

* changelog

* Start statement at tab position

Co-authored-by: Lucas Borin <5233413+lucasborin@users.noreply.github.co>

* SUT Dependency (#533)

* forcing cspell to track sut dependencies

* changelog

* fixing #527

Co-authored-by: Lucas Borin <5233413+lucasborin@users.noreply.github.co>

* changelog

Co-authored-by: Lucas Borin <5233413+lucasborin@users.noreply.github.co>
  • Loading branch information
lucasborin and Lucas Borin authored Nov 11, 2021
1 parent c782c26 commit 4f6936f
Show file tree
Hide file tree
Showing 10 changed files with 49 additions and 356 deletions.
4 changes: 3 additions & 1 deletion .cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@
// This is useful for offensive words and common spelling errors.
// For example "hte" should be "the"
"flagWords": [
"hte"
"hte",
"SUT",
"sut"
]
}
8 changes: 8 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,14 @@ Legend
+ : added
- : removed

2021-11-11 v.1.16.3
------------------
* Incompatibility with abapGit after commit dc4b3705216757c7533f5802d51 (#528)
* Unit test WITHOUT_ISSUE in Y_CHECK_COMMENT_USAGE fails (#527)
* Refactoring Function Check (#531)
* Unit test RFC_ENABLED in Y_CHECK_FUNCTION fails (#526)
- Remove static dependency to developer version of abapGit (#524)

2021-11-05 v.1.16.2
------------------
* Comment Position when Line Contains Pseudo Comment (#516)
Expand Down
12 changes: 0 additions & 12 deletions pages/how-to-configure.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,18 +82,6 @@ You can import and export a Profile with its Delegates and Checks using a `JSON`

![import and export feature](imgs/import-export-feature.png)

### Import via API

Once you export a profile to a `JSON` file, you can import it using the service created in the [How To Install](how-to-install.md) guide.

To consume the API, you have to `POST` the `JSON` file to the service with the respective authentication you configured to the service (usually basic, user/pass) and with the headers `Content-Type` as `application/json` and `action` as `import_profile`.

Possible returns:

- `HTTP 400 - Bad Request` if the file format is not valid, or if the request has a wrong `Content-Type`;
- `HTTP 403 - Forbidden` if the profile already exists in the system and the authentication user is not listed as a delegate;
- `HTTP 500 - Internal Server Error` if the functionality is not working as expected.

### Add / Remove All Checks

You can add all and remove all the Checks from a Profile, here:
Expand Down
10 changes: 1 addition & 9 deletions pages/how-to-install.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,4 @@ It requires you to set the ABAP Test Cockpit (ATC) to run in Code Inspector mode

Start the transaction `SU3`, and add/set the user parameter `SATC_CI_MODE` to `X`:

![user parameter](imgs/user-parameter.png)

### 5. Service

> :warning: Optional Feature!
Start the transaction `SICF`, and create a service using the `Y_CODE_PAL_SERVICE` handler. Use procedure `Standard`, set the security session to `Completely Restricted` and check the `Use all logon procedures`.

The client, user, and password will be empty as to will provide the authentication when you consume the API.
![user parameter](imgs/user-parameter.png)
2 changes: 1 addition & 1 deletion src/checks/y_check_comment_usage.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,7 @@ CLASS ltc_pragma IMPLEMENTATION.
( 'REPORT y_example. ' )
( ' START-OF-SELECTION.' )
( ' FORM example.' )
( | CONSTANTS mc_last_counter_values_synch TYPE sut_settings-name VALUE 'LAST_VALUES_SYNCH' ##NO_TEXT. | )
( | CONSTANTS mc_last_counter_values_synch TYPE string VALUE 'LAST_VALUES_SYNCH' ##NO_TEXT. | )
( | CONSTANTS pragma_identifier VALUE '##'. | )
( ' ENDFORM.' )
).
Expand Down
29 changes: 8 additions & 21 deletions src/checks/y_check_function.clas.abap
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,13 @@ CLASS y_check_function DEFINITION PUBLIC INHERITING FROM y_check_base CREATE PUB
METHODS inspect_tokens REDEFINITION.

PRIVATE SECTION.
METHODS is_rfc_enabled IMPORTING name TYPE rs38l_fnam
RETURNING VALUE(result) TYPE abap_bool.
METHODS is_normal_mode RETURNING VALUE(result) TYPE abap_bool.

ENDCLASS.



CLASS Y_CHECK_FUNCTION IMPLEMENTATION.

CLASS y_check_function IMPLEMENTATION.

METHOD constructor.
super->constructor( ).
Expand All @@ -32,17 +30,8 @@ CLASS Y_CHECK_FUNCTION IMPLEMENTATION.


METHOD inspect_tokens.
CHECK statement-type <> scan_stmnt_type-comment.
CHECK statement-type <> scan_stmnt_type-comment_in_stmnt.
CHECK statement-type <> scan_stmnt_type-pragma.

CHECK get_token_abs( statement-from ) = 'FUNCTION'.

DATA(fm_name) = get_token_abs( statement-from + 1 ).

IF is_rfc_enabled( CONV #( fm_name ) ) = abap_true.
RETURN.
ENDIF.
CHECK keyword( ) = if_kaizen_keywords_c=>gc_function.
CHECK is_normal_mode( ) = abap_true.

DATA(check_configuration) = detect_check_configuration( statement ).

Expand All @@ -53,12 +42,10 @@ CLASS Y_CHECK_FUNCTION IMPLEMENTATION.
ENDMETHOD.


METHOD is_rfc_enabled.
SELECT SINGLE @abap_true
FROM tfdir
INTO @result
WHERE funcname = @name
AND fmode = 'R'.
METHOD is_normal_mode.
DATA(function_module) = next1( CONV #( if_kaizen_keywords_c=>gc_function ) ).
SELECT SINGLE pname INTO @DATA(function_group) FROM tfdir WHERE funcname = @function_module AND fmode = @space.
result = xsdbool( sy-subrc = 0 ).
ENDMETHOD.

ENDCLASS.
63 changes: 27 additions & 36 deletions src/checks/y_check_function.clas.testclasses.abap
Original file line number Diff line number Diff line change
Expand Up @@ -2,46 +2,44 @@ CLASS lth_function DEFINITION.
PROTECTED SECTION.
DATA cut TYPE REF TO ltd_check_function.

METHODS given_rfc_enabled.
METHODS given_rfc_disabled.
METHODS given_function_group.
METHODS when_run.
METHODS then_has_issue.
METHODS then_no_issue.
METHODS then_finds.

PRIVATE SECTION.
DATA expected_issues TYPE i.

ENDCLASS.


CLASS lth_function IMPLEMENTATION.

METHOD given_rfc_enabled.
SELECT SINGLE pname FROM tfdir INTO @DATA(function_group) WHERE fmode = 'R'.
cut->set_ref_scan( y_code_pal_ref_scan_double=>get_from_fuction_group( function_group ) ).
ENDMETHOD.
METHOD given_function_group.
" Get one that has RFC enabled and disabled
SELECT SINGLE tfdir~pname
FROM tfdir AS tfdir
INNER JOIN tfdir AS enabled ON enabled~pname = tfdir~pname
AND enabled~fmode <> @space
WHERE tfdir~fmode = @space
INTO @DATA(function_group).

SELECT COUNT( * )
FROM tfdir
WHERE pname = @function_group
AND tfdir~fmode = @space
INTO @expected_issues.

METHOD given_rfc_disabled.
SELECT SINGLE pname FROM tfdir INTO @DATA(function_group) WHERE fmode = 'X'.
cut->set_ref_scan( y_code_pal_ref_scan_double=>get_from_fuction_group( function_group ) ).
ENDMETHOD.

METHOD when_run.
cut->run( ).
ENDMETHOD.

METHOD then_no_issue.
cl_abap_unit_assert=>assert_initial( act = cut->get_statistics( )->count-errors
quit = if_aunit_constants=>quit-no ).
cl_abap_unit_assert=>assert_initial( act = cut->get_statistics( )->count-warnings
quit = if_aunit_constants=>quit-no ).
cl_abap_unit_assert=>assert_initial( act = cut->get_statistics( )->count-notes
quit = if_aunit_constants=>quit-no ).
cl_abap_unit_assert=>assert_initial( act = cut->get_statistics( )->count-pseudo_comments
quit = if_aunit_constants=>quit-no ).
ENDMETHOD.

METHOD then_has_issue.
cl_abap_unit_assert=>assert_not_initial( act = cut->get_statistics( )->count-notes
quit = if_aunit_constants=>quit-no ).

METHOD then_finds.
cl_abap_unit_assert=>assert_equals( act = cut->get_statistics( )->count-notes
exp = expected_issues
quit = if_aunit_constants=>quit-no ).
cl_abap_unit_assert=>assert_initial( act = cut->get_statistics( )->count-errors
quit = if_aunit_constants=>quit-no ).
cl_abap_unit_assert=>assert_initial( act = cut->get_statistics( )->count-warnings
Expand All @@ -56,8 +54,7 @@ ENDCLASS.

CLASS ltc_function DEFINITION FOR TESTING INHERITING FROM lth_function RISK LEVEL HARMLESS.
PUBLIC SECTION.
METHODS rfc_enabled FOR TESTING.
METHODS rfc_disabled FOR TESTING.
METHODS test FOR TESTING.

PRIVATE SECTION.
METHODS setup.
Expand All @@ -71,16 +68,10 @@ CLASS ltc_function IMPLEMENTATION.
cut = NEW #( ).
ENDMETHOD.

METHOD rfc_enabled.
given_rfc_enabled( ).
when_run( ).
then_no_issue( ).
ENDMETHOD.

METHOD rfc_disabled.
given_rfc_disabled( ).
METHOD test.
given_function_group( ).
when_run( ).
then_has_issue( ).
then_finds( ).
ENDMETHOD.

ENDCLASS.
Loading

0 comments on commit 4f6936f

Please sign in to comment.