Skip to content

Commit 378f702

Browse files
committed
Remove dependency:audit from CI pipelines as unnecessary and reduce options
1 parent dee2995 commit 378f702

File tree

3 files changed

+12
-82
lines changed

3 files changed

+12
-82
lines changed

.github/workflows/checks.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -137,25 +137,6 @@ jobs:
137137
path: .security.json
138138
include-hidden-files: true
139139

140-
Vulnerabilities:
141-
name: Check Vulnerabilities (Python-${{ matrix.python-version }})
142-
needs: [ Version-Check, build-matrix ]
143-
runs-on: ubuntu-24.04
144-
strategy:
145-
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
146-
147-
steps:
148-
- name: SCM Checkout
149-
uses: actions/checkout@v4
150-
151-
- name: Setup Python & Poetry Environment
152-
uses: ./.github/actions/python-environment
153-
with:
154-
python-version: ${{ matrix.python-version }}
155-
156-
- name: Run Package vulnerabilities Check
157-
run: poetry run nox -s dependency:audit
158-
159140
Format:
160141
name: Format Check
161142
runs-on: ubuntu-24.04

exasol/toolbox/nox/_dependencies.py

Lines changed: 12 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -217,23 +217,6 @@ def _normalize_package_name(name: str) -> str:
217217
return template.format(heading=heading(), rows=rows)
218218

219219

220-
class PipAuditFormat(Enum):
221-
columns = auto()
222-
json = auto()
223-
224-
@classmethod
225-
def _missing_(cls, value):
226-
if isinstance(value, str):
227-
for member in cls:
228-
if member.name == value.lower():
229-
return member
230-
return None
231-
232-
@classmethod
233-
def name_tuple(cls) -> tuple:
234-
return tuple(fmt.name for fmt in PipAuditFormat)
235-
236-
237220
class Audit:
238221
@staticmethod
239222
def _filter_json_for_vulnerabilities(audit_json_bytes: bytes) -> dict:
@@ -272,14 +255,6 @@ def _parse_args(session) -> argparse.Namespace:
272255
description="Audits dependencies for security vulnerabilities",
273256
usage="nox -s dependency:audit -- -- [options]",
274257
)
275-
parser.add_argument(
276-
"-f",
277-
"--format",
278-
type=str,
279-
default=PipAuditFormat.columns.name,
280-
help="Format to emit audit results in",
281-
choices=PipAuditFormat.name_tuple(),
282-
)
283258
parser.add_argument(
284259
"-o",
285260
"--output",
@@ -291,28 +266,21 @@ def _parse_args(session) -> argparse.Namespace:
291266

292267
def run(self, session: Session) -> None:
293268
args = self._parse_args(session)
294-
audit_format = PipAuditFormat[args.format]
295-
296-
command = ["poetry", "run", "pip-audit", "-f", audit_format.name]
297-
if audit_format == PipAuditFormat.columns:
298-
if args.output:
299-
command.extend(["-o", args.output])
300-
session.run(*command)
301269

302-
elif audit_format == PipAuditFormat.json:
303-
output = subprocess.run(command, capture_output=True)
304-
audit_json = self._filter_json_for_vulnerabilities(output.stdout)
270+
command = ["poetry", "run", "pip-audit", "-f", "json"]
271+
output = subprocess.run(command, capture_output=True)
305272

306-
if args.output:
307-
with open(args.output, "w") as file:
308-
json.dump(audit_json, file)
309-
else:
310-
print(audit_json)
273+
audit_json = self._filter_json_for_vulnerabilities(output.stdout)
274+
if args.output:
275+
with open(args.output, "w") as file:
276+
json.dump(audit_json, file)
277+
else:
278+
print(json.dumps(audit_json, indent=2))
311279

312-
if output.returncode != 0:
313-
session.warn(
314-
f"Command {' '.join(command)} failed with exit code {output.returncode}",
315-
)
280+
if output.returncode != 0:
281+
session.warn(
282+
f"Command {' '.join(command)} failed with exit code {output.returncode}",
283+
)
316284

317285

318286
@nox.session(name="dependency:licenses", python=False)

exasol/toolbox/templates/github/workflows/checks.yml

Lines changed: 0 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -139,25 +139,6 @@ jobs:
139139
path: .security.json
140140
include-hidden-files: true
141141

142-
Vulnerabilities:
143-
name: Check Vulnerabilities (Python-${{ matrix.python-version }})
144-
needs: [ Version-Check, build-matrix ]
145-
runs-on: ubuntu-24.04
146-
strategy:
147-
matrix: ${{ fromJson(needs.build-matrix.outputs.matrix) }}
148-
149-
steps:
150-
- name: SCM Checkout
151-
uses: actions/checkout@v4
152-
153-
- name: Setup Python & Poetry Environment
154-
uses: ./.github/actions/python-environment
155-
with:
156-
python-version: ${{ matrix.python-version }}
157-
158-
- name: Run Package vulnerabilities Check
159-
run: poetry run nox -s dependency:audit
160-
161142
Format:
162143
name: Format Check
163144
runs-on: ubuntu-24.04

0 commit comments

Comments
 (0)