Added support for external repository file links
This commit is contained in:
parent
ca6fee127c
commit
b4f5e3ebd4
@ -218,6 +218,7 @@ from typing import TypedDict
|
||||
class Artifact(TypedDict):
|
||||
file: str
|
||||
lines: NotRequired[list[int]]
|
||||
repository: NotRequired[str]
|
||||
|
||||
class SecurityRule(TypedDict):
|
||||
status: str
|
||||
@ -253,6 +254,8 @@ properties:
|
||||
properties:
|
||||
file:
|
||||
type: string
|
||||
repository:
|
||||
type: string
|
||||
lines:
|
||||
type: array
|
||||
items:
|
||||
@ -306,7 +309,7 @@ rule_names = {
|
||||
def artifact_to_string(info: ModelInformation, artifact: Artifact):
|
||||
file = Path(artifact['file'])
|
||||
filename = file.name
|
||||
file_url = f"https://github.com/{info['slug']}/blob/{info.get('branch', 'master')}/{artifact['file']}"
|
||||
file_url = f"https://github.com/{artifact.get('repository', info['slug'])}/blob/{info.get('branch', 'master')}/{artifact['file']}"
|
||||
lines = artifact.get("lines")
|
||||
if lines is None:
|
||||
return f"- {filename}: [File]({file_url})"
|
||||
|
@ -27,6 +27,7 @@
|
||||
"type": "object",
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"repository": { "type": "string" },
|
||||
"file": { "type": "string" },
|
||||
"lines": { "type": "array", "items": { "type": "integer" } }
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user