Added branch override for artifacts
This commit is contained in:
parent
62c96fcbf6
commit
44bae3fa85
@ -219,6 +219,7 @@ class Artifact(TypedDict):
|
||||
file: str
|
||||
lines: NotRequired[list[int]]
|
||||
repository: NotRequired[str]
|
||||
branch: NotRequired[str]
|
||||
|
||||
RuleStatus = Literal["disregarded", "observed", "not applicable", "unknown"]
|
||||
|
||||
@ -258,6 +259,8 @@ properties:
|
||||
type: string
|
||||
repository:
|
||||
type: string
|
||||
branch:
|
||||
type: string
|
||||
lines:
|
||||
type: array
|
||||
items:
|
||||
@ -311,7 +314,9 @@ rule_names = {
|
||||
def artifact_to_string(info: ModelInformation, artifact: Artifact):
|
||||
file = Path(artifact['file'])
|
||||
filename = file.name
|
||||
file_url = f"https://github.com/{artifact.get('repository', info['slug'])}/blob/{info.get('branch', 'master')}/{artifact['file']}"
|
||||
project_branch = info.get("branch", "master")
|
||||
branch = artifact.get("branch", project_branch)
|
||||
file_url = f"https://github.com/{artifact.get('repository', info['slug'])}/blob/{branch}/{artifact['file']}"
|
||||
lines = artifact.get("lines")
|
||||
if lines is None:
|
||||
return f"- {filename}: [File]({file_url})"
|
||||
|
@ -28,6 +28,7 @@
|
||||
"additionalProperties": false,
|
||||
"properties": {
|
||||
"repository": { "type": "string" },
|
||||
"branch": { "type": "string" },
|
||||
"file": { "type": "string" },
|
||||
"lines": { "type": "array", "items": { "type": "integer" } }
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user