github/gh-gei

[gei] Align code and tests for secret scanning and code scanning

dlinares-linux opened this issue · 0 comments

Description

Following the review done #1241, some potential improvement have been identified, aligning the code and tests for secret scanning and code scanning.

Changes

Use default null value instead of string.Empty

  • for the secret scanning resolution_comment
  • for the code scanning dismissed_comment (example of patch below to check)
       var payload = state == "open"
            ? (new { state })
            : (object)(new
            {
                state,
                dismissed_reason = dismissedReason,
---             dismissed_comment = dismissedComment ?? string.Empty
+++             dismissed_comment = dismissedComment
            });
        await _client.PatchAsync(url, payload);

Remove null to string.Empty conversion tests

Following the change done above, the following tests could probably be deleted:

  • UpdateSecretScanningAlert_Replaces_Null_Resolution_Comment_With_Empty_String()
  • UpdateCodeScanningAlert_Replaces_Null_Dismissed_Comment_With_Empty_String()