Skip to content

Commit 27e3a74

Browse files
committed
fix(codeql): fix ruff lint issues
- remove unused ocm import from codeql.py - break long log lines - rename ambiguous variable l -> lang - add missing blank line in findings.py - break long warning message in extensions_cfg.py Signed-off-by: Patryk Dobrowolski <patryk.dobrowolski@sap.com>
1 parent f860a32 commit 27e3a74

3 files changed

Lines changed: 12 additions & 5 deletions

File tree

src/codeql.py

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@
88

99
import ci.log
1010
import cnudie.retrieve
11-
import ocm
1211
import ocm.iter
1312

1413
import github_util
@@ -95,9 +94,15 @@ def fetch_repo_info(
9594
ref = access.ref if access.ref.startswith('refs/') else f'refs/heads/{access.ref}'
9695
elif isinstance(repo_info, dict) and (default_branch := repo_info.get('default_branch')):
9796
ref = f'refs/heads/{default_branch}'
98-
logger.info(f'No ref in OCM access for {repo_url=}, falling back to default branch {default_branch!r}')
97+
logger.info(
98+
f'No ref in OCM access for {repo_url=}, '
99+
f'falling back to default branch {default_branch!r}',
100+
)
99101
else:
100-
logger.warning(f'No ref in OCM access and could not determine default branch for {repo_url=}, skipping')
102+
logger.warning(
103+
f'No ref in OCM access and could not determine default branch '
104+
f'for {repo_url=}, skipping',
105+
)
101106
return repo_url, set(), set()
102107

103108
active_languages = set()
@@ -194,7 +199,7 @@ def iter_artefact_metadata(
194199
if not repo_url:
195200
return
196201

197-
for language in [l.lower() for l in codeql_config.languages]:
202+
for language in [lang.lower() for lang in codeql_config.languages]:
198203
if language not in repo_languages:
199204
logger.info(
200205
f'skipping CodeQL check for {language=}: not present in {repo_url=}',

src/odg/extensions_cfg.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,8 @@ def is_supported(
956956
if artefact_kind and artefact_kind not in supported_artefact_kinds:
957957
if self.on_unsupported is WarningVerbosities.WARNING:
958958
logger.warning(
959-
f'{artefact_kind=} is not supported for CodeQL scans, {supported_artefact_kinds=}',
959+
f'{artefact_kind=} is not supported for CodeQL scans, '
960+
f'{supported_artefact_kinds=}',
960961
)
961962
return False
962963

src/odg/findings.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,7 @@ class CodeqlFindingSelector:
101101

102102
codeql_status: list[str]
103103

104+
104105
@dataclasses.dataclass
105106
class VulnerabilityFindingSelector:
106107
"""

0 commit comments

Comments
 (0)