Skip to content

Commit

Permalink
chore: update Black to 24.3.0
Browse files Browse the repository at this point in the history
This required disabling E704 in flake8. That seems to be expected:
psf/black#3887
  • Loading branch information
agateau-gg committed Apr 3, 2024
1 parent 8812987 commit 1004aaf
Show file tree
Hide file tree
Showing 15 changed files with 61 additions and 61 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
@@ -1,7 +1,7 @@
default_stages: [commit]
repos:
- repo: https://github.com/ambv/black
rev: 22.3.0
rev: 24.3.0
hooks:
- id: black
language_version: python3
Expand Down
2 changes: 1 addition & 1 deletion Pipfile
Expand Up @@ -8,7 +8,7 @@ verify_ssl = true
ggshield = { editable = true, path = "." }

[dev-packages]
black = "==22.3.0"
black = "==24.3.0"
coverage = "*"
flake8 = "*"
flake8-isort = "*"
Expand Down
58 changes: 29 additions & 29 deletions Pipfile.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions ggshield/cmd/iac/scan/all.py
Expand Up @@ -105,9 +105,9 @@ def iac_scan_all(
scan_parameters,
ScanContext(
command_path=ctx.command_path,
scan_mode=scan_mode
if ci_mode is None
else f"{scan_mode.value}/{ci_mode.value}",
scan_mode=(
scan_mode if ci_mode is None else f"{scan_mode.value}/{ci_mode.value}"
),
extra_headers={"Ci-Mode": str(ci_mode.value)} if ci_mode else None,
target_path=directory,
).get_http_headers(),
Expand Down
6 changes: 3 additions & 3 deletions ggshield/cmd/iac/scan/diff.py
Expand Up @@ -186,9 +186,9 @@ def iac_scan_diff(
scan_parameters,
ScanContext(
command_path=ctx.command_path,
scan_mode=scan_mode
if ci_mode is None
else f"{scan_mode.value}/{ci_mode.value}",
scan_mode=(
scan_mode if ci_mode is None else f"{scan_mode.value}/{ci_mode.value}"
),
extra_headers={"Ci-Mode": str(ci_mode.value)} if ci_mode else None,
target_path=directory,
).get_http_headers(),
Expand Down
1 change: 1 addition & 0 deletions ggshield/cmd/iac/scan/iac_scan_common_options.py
Expand Up @@ -9,6 +9,7 @@
The `kwargs` argument is required due to the way click works,
`add_common_options()` adds an argument for each option it defines.
"""

from typing import Any, Callable, Sequence

import click
Expand Down
1 change: 1 addition & 0 deletions ggshield/cmd/sca/scan/scan_common_options.py
Expand Up @@ -9,6 +9,7 @@
The `kwargs` argument is required due to the way click works,
`add_common_options()` adds an argument for each option it defines.
"""

from typing import Callable, Sequence

import click
Expand Down
1 change: 1 addition & 0 deletions ggshield/cmd/utils/common_options.py
Expand Up @@ -10,6 +10,7 @@
The `kwargs` argument is required because due to the way click works,
`add_common_options()` adds an argument for each option it defines.
"""

from pathlib import Path
from typing import Any, Callable, Optional, TypeVar

Expand Down
6 changes: 2 additions & 4 deletions ggshield/core/config/utils.py
Expand Up @@ -67,13 +67,11 @@ def get_global_path(filename: str) -> Path:


@overload
def find_global_config_path(*, to_write: Literal[False] = False) -> Optional[Path]:
...
def find_global_config_path(*, to_write: Literal[False] = False) -> Optional[Path]: ...


@overload
def find_global_config_path(*, to_write: Literal[True]) -> Path:
...
def find_global_config_path(*, to_write: Literal[True]) -> Path: ...


def find_global_config_path(*, to_write: bool = False) -> Optional[Path]:
Expand Down
1 change: 1 addition & 0 deletions ggshield/core/errors.py
Expand Up @@ -2,6 +2,7 @@
This module centralizes GGShield error handling. For more details, have a look
at doc/dev/error-handling.md.
"""

import platform
import traceback
from enum import IntEnum
Expand Down
8 changes: 5 additions & 3 deletions ggshield/core/scan/scan_context.py
Expand Up @@ -56,7 +56,9 @@ def get_http_headers(self) -> Dict[str, str]:

return {
**{f"GGShield-{key}": str(value) for key, value in headers.items()},
"mode": self.scan_mode.value
if isinstance(self.scan_mode, ScanMode)
else self.scan_mode,
"mode": (
self.scan_mode.value
if isinstance(self.scan_mode, ScanMode)
else self.scan_mode
),
}
2 changes: 1 addition & 1 deletion ggshield/utils/git_shell.py
Expand Up @@ -129,7 +129,7 @@ def simplify_git_url(url: str) -> str:
- extension
https://user:pass@mygitlab.corp.com:84/path/to/repo.git -> mygitlab.corp.com/toto/titi/tata
"""
for (pattern, replace) in (
for pattern, replace in (
(r"https?://", ""), # Scheme
(r".+@", ""), # Credentials
(r":\d*/", "/"), # Port
Expand Down
18 changes: 6 additions & 12 deletions ggshield/utils/os.py
Expand Up @@ -67,13 +67,11 @@ def cd(newdir: Union[str, Path]) -> Iterator[None]:


@overload
def getenv_int(key: str, default: None = None) -> Optional[int]:
...
def getenv_int(key: str, default: None = None) -> Optional[int]: ...


@overload
def getenv_int(key: str, default: int) -> int:
...
def getenv_int(key: str, default: int) -> int: ...


def getenv_int(key: str, default: Optional[int] = None) -> Optional[int]:
Expand All @@ -84,13 +82,11 @@ def getenv_int(key: str, default: Optional[int] = None) -> Optional[int]:


@overload
def getenv_float(key: str, default: None = None) -> Optional[float]:
...
def getenv_float(key: str, default: None = None) -> Optional[float]: ...


@overload
def getenv_float(key: str, default: float) -> float:
...
def getenv_float(key: str, default: float) -> float: ...


def getenv_float(key: str, default: Optional[float] = None) -> Optional[float]:
Expand All @@ -101,13 +97,11 @@ def getenv_float(key: str, default: Optional[float] = None) -> Optional[float]:


@overload
def getenv_bool(key: str, default: None = None) -> Optional[bool]:
...
def getenv_bool(key: str, default: None = None) -> Optional[bool]: ...


@overload
def getenv_bool(key: str, default: bool) -> bool:
...
def getenv_bool(key: str, default: bool) -> bool: ...


def getenv_bool(key: str, default: Optional[bool] = None) -> Optional[bool]:
Expand Down
8 changes: 5 additions & 3 deletions ggshield/verticals/iac/output/iac_text_output_handler.py
Expand Up @@ -462,9 +462,11 @@ def label_incident(n: int) -> str:
format_text(
f"[~] {num_unchanged} {label_incident(num_unchanged)} remaining",
STYLE[
"iac_remaining_vulnerability"
if num_unchanged > 0
else "iac_dim_summary"
(
"iac_remaining_vulnerability"
if num_unchanged > 0
else "iac_dim_summary"
)
],
)
)
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Expand Up @@ -63,5 +63,5 @@ console_scripts = ggshield=ggshield.__main__:main
[flake8]
inline-quotes = double
max-line-length = 120
ignore = E203, W503
ignore = E203, E704, W503
exclude = **/snapshots/*.py, .venv, build

0 comments on commit 1004aaf

Please sign in to comment.