Skip to content

Commit

Permalink
fix: fix pre-commit issues
Browse files Browse the repository at this point in the history
Signed-off-by: Mikaël Barbero <mikael.barbero@eclipse-foundation.org>
  • Loading branch information
mbarbero authored and netomi committed Oct 29, 2024
1 parent 6e4a62c commit 46937d6
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions otterdog/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -729,6 +729,7 @@ def list_advisories(state: list[str], details: bool, organizations: list[str]):
"""
_execute_operation(organizations, ListAdvisoriesOperation(state, details))


@cli.command(short_help="Installs required dependencies.")
def install_deps():
"""
Expand Down
26 changes: 13 additions & 13 deletions otterdog/operations/list_advisories.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,11 @@
from typing import TYPE_CHECKING

from otterdog.providers.github import GitHubProvider
from otterdog.utils import is_info_enabled, style, format_date_for_csv
from otterdog.utils import format_date_for_csv, is_info_enabled, style

from . import Operation

if TYPE_CHECKING:
from typing import Any

from otterdog.config import OrganizationConfig


Expand Down Expand Up @@ -46,7 +44,9 @@ def pre_execute(self) -> None:
if is_info_enabled():
self.printer.println(f"Listing {self.states} repository security advisories:")
if not self.details:
self.printer.println("organization,created_at,updated_at,published_at,state,ghsa_id,cve_id,html_url,summary")
self.printer.println(
"organization,created_at,updated_at,published_at,state,ghsa_id,cve_id,html_url,summary"
)

def post_execute(self) -> None:
pass
Expand Down Expand Up @@ -86,19 +86,19 @@ async def execute(

for advisory in advisories:
if not self.details:
cve_id = advisory['cve_id'] if advisory['cve_id'] is not None else 'NO_CVE'
summary = advisory['summary'].replace('"', '""')
cve_id = advisory["cve_id"] if advisory["cve_id"] is not None else "NO_CVE"
summary = advisory["summary"].replace('"', '""')

formatted_values = {
"org_name": org_config.name,
"created_at": format_date_for_csv(advisory['created_at']),
"updated_at": format_date_for_csv(advisory['updated_at']),
"published_at": format_date_for_csv(advisory['published_at']),
"state": advisory['state'],
"ghsa_id": advisory['ghsa_id'],
"created_at": format_date_for_csv(advisory["created_at"]),
"updated_at": format_date_for_csv(advisory["updated_at"]),
"published_at": format_date_for_csv(advisory["published_at"]),
"state": advisory["state"],
"ghsa_id": advisory["ghsa_id"],
"cve_id": cve_id,
"html_url": advisory['html_url'],
"summary": summary
"html_url": advisory["html_url"],
"summary": summary,
}

self.printer.println(
Expand Down
3 changes: 2 additions & 1 deletion otterdog/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -607,7 +607,8 @@ def deep_merge_dict(source: dict[str, Any], destination: dict[str, Any]):

return destination

def format_date_for_csv(iso_date_str : str) -> str:

def format_date_for_csv(iso_date_str: str) -> str:
if iso_date_str is None:
return ""
date_obj = datetime.fromisoformat(iso_date_str)
Expand Down

0 comments on commit 46937d6

Please sign in to comment.