-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor into run, tool, artifacts (#261)
New class objects closely matching SARIF. * New Tool class to represent information about precli itself * New Run class to represent an instance of a run of the analysis * New Artifact class representing the files, source language, and contents. Signed-off-by: Eric Brown <[email protected]>
- Loading branch information
Showing
10 changed files
with
423 additions
and
174 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
from importlib import metadata | ||
|
||
|
||
__author__ = metadata.metadata("precli")["Author"] | ||
__version__ = metadata.version("precli") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# Copyright 2024 Secure Saurce LLC | ||
|
||
|
||
class Artifact: | ||
def __init__(self, file_name: str, uri: str = None): | ||
self._file_name = file_name | ||
# TODO: if uri is None, use file:/// | ||
self._uri = uri | ||
self._contents = None | ||
self._language = None | ||
|
||
@property | ||
def file_name(self) -> str: | ||
""" | ||
The name of the file. | ||
:return: file name | ||
:rtype: str | ||
""" | ||
return self._file_name | ||
|
||
@file_name.setter | ||
def file_name(self, file_name): | ||
""" | ||
Set the file name | ||
:param str file_name: file name | ||
""" | ||
self._file_name = file_name | ||
|
||
@property | ||
def uri(self) -> str: | ||
""" | ||
The URI of the artifact. | ||
:return: URI | ||
:rtype: str | ||
""" | ||
return self._uri | ||
|
||
@uri.setter | ||
def uri(self, uri): | ||
""" | ||
Set the artifact URI. | ||
:param str uri: URI | ||
""" | ||
self._uri = uri | ||
|
||
@property | ||
def contents(self) -> str: | ||
""" | ||
The contents of the artifact. | ||
:return: typically file contents | ||
:rtype: str | ||
""" | ||
return self._contents | ||
|
||
@contents.setter | ||
def contents(self, contents) -> str: | ||
""" | ||
Set the contents (for typically the file). | ||
:param str contents: file contents | ||
""" | ||
self._contents = contents | ||
|
||
@property | ||
def language(self) -> str: | ||
""" | ||
The programming language for this artifact. | ||
:return: programming language name | ||
:rtype: str | ||
""" | ||
return self._language | ||
|
||
@language.setter | ||
def language(self, language) -> str: | ||
""" | ||
Set the programming language. | ||
:param str language: program language | ||
""" | ||
self._language = language |
Oops, something went wrong.