Skip to content

Commit

Permalink
chore: minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
gg-mmill committed Dec 9, 2024
1 parent 05d2bd6 commit 76f7711
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
15 changes: 12 additions & 3 deletions ggshield/verticals/secret/secret_scan_collection.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,17 @@
from collections import Counter
from dataclasses import dataclass, field
from enum import Enum
from pathlib import Path
from typing import Dict, Iterable, List, NamedTuple, Optional, Tuple, Union, cast
from typing import (
Counter,
Dict,
Iterable,
List,
NamedTuple,
Optional,
Tuple,
Union,
cast,
)

from pygitguardian import GGClient
from pygitguardian.models import (
Expand Down Expand Up @@ -33,7 +42,7 @@ class IgnoreReason(str, Enum):

def compute_ignore_reason(
policy_break: PolicyBreak, secret_config: SecretConfig
) -> Union[str, None]:
) -> Optional[str]:
"""Computes the possible ignore reason associated with a PolicyBreak"""
ignore_reason = None
if policy_break.diff_kind in {DiffKind.DELETION, DiffKind.CONTEXT}:
Expand Down
5 changes: 2 additions & 3 deletions tests/unit/verticals/secret/test_secret_scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -434,9 +434,8 @@ def test_scan_unexpected_error(scan_mock: Mock, client):
@patch("pygitguardian.GGClient.multi_content_scan")
def test_all_secrets_is_used(scan_mock: Mock, client):
"""
GIVEN -
WHEN calling scanner.scan
THEN the all_secrets_option is used
GIVEN one secret ignored in backend, and one not ignored
WHEN calling scanner.scan with the all_secrets option set to False
THEN secrets excluded by the backend are ignored
"""
scannable = StringScannable(url="localhost", content="known\nunknown")
Expand Down

0 comments on commit 76f7711

Please sign in to comment.