github / github/gh-gei

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

Open
#1,248 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
C#
Stars
478
Forks
146
Avg merge
7d 21h
Merged PRs (30d)
2

Description

## 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)
```csharp
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()

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.