FOSSology  4.5.1
Open Source License Compliance by Open Source Software
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
FoScanner.Scanners.Scanners Class Reference
Collaboration diagram for FoScanner.Scanners.Scanners:
Collaboration graph

Public Member Functions

def __init__ (self, CliOptions cli_options)
 
bool is_excluded_path (self, str path)
 
Union[List[ScanResult], List[ScanResultList], bool] get_copyright_list (self, bool all_results=False, bool whole=False)
 
Union[List[ScanResult], List[ScanResultList], bool] get_keyword_list (self, bool whole=False)
 
Union[List[ScanResult], List[ScanResultList]] get_non_allow_listed_results (self, List[ScanResult] scan_results=None, List[ScanResultList] scan_results_whole=None, bool whole=False)
 
List[ScanResultget_non_allow_listed_copyrights (self, List[ScanResult] copyright_results)
 
Union[List[ScanResult], List[ScanResultList], bool] results_are_allow_listed (self, bool whole=False)
 
Union[List[ScanResult], List[ScanResultList]] get_scanner_results (self, bool whole=False)
 

Static Public Attributes

 str
 

Private Member Functions

str __normalize_path (self, str path)
 
dict __get_nomos_result (self)
 
dict __get_ojo_result (self)
 
dict __get_copyright_results (self)
 
dict __get_keyword_results (self)
 
Union[List[ScanResult], List[ScanResultList]] __get_license_nomos (self, bool whole=False)
 
Union[List[ScanResult], List[ScanResultList]] __get_license_ojo (self, bool whole=False)
 
List[ScanResult__merge_nomos_ojo (self, List[ScanResult] nomos_licenses, List[ScanResult] ojo_licenses)
 

Detailed Description

Handle all the data from different scanners.

:ivar nomos_path: path to nomos bin
:ivar copyright_path: path to copyright bin
:ivar keyword_path: path to keyword bin
:ivar ojo_path: path to ojo bin
:ivar cli_options: CliOptions object

Definition at line 53 of file Scanners.py.

Constructor & Destructor Documentation

◆ __init__()

def FoScanner.Scanners.Scanners.__init__ (   self,
CliOptions  cli_options 
)
Initialize the cli_options

:param cli_options: CliOptions object to use
:type cli_options: CliOptions

Definition at line 68 of file Scanners.py.

Member Function Documentation

◆ __get_copyright_results()

dict FoScanner.Scanners.Scanners.__get_copyright_results (   self)
private
Get the raw results from copyright scanner

:return: raw json from copyright

Definition at line 125 of file Scanners.py.

◆ __get_keyword_results()

dict FoScanner.Scanners.Scanners.__get_keyword_results (   self)
private
Get the raw results from keyword scanner

:return: raw json from keyword

Definition at line 136 of file Scanners.py.

◆ __get_license_nomos()

Union[List[ScanResult],List[ScanResultList]] FoScanner.Scanners.Scanners.__get_license_nomos (   self,
bool   whole = False 
)
private
Get the formatted results from nomos scanner

:param: whole: return whole content from scanner
:return: list of findings
:rtype: List[ScanResult] | List[ScanResultList]

Definition at line 222 of file Scanners.py.

◆ __get_license_ojo()

Union[List[ScanResult],List[ScanResultList]] FoScanner.Scanners.Scanners.__get_license_ojo (   self,
bool   whole = False 
)
private
Get the formatted results from ojo scanner

:param: whole: return whole content from scanner
:return: list of findings
:rtype: List[ScanResult] | List[ScanResultList]

Definition at line 250 of file Scanners.py.

◆ __get_nomos_result()

dict FoScanner.Scanners.Scanners.__get_nomos_result (   self)
private
Get the raw results from nomos scanner

:return: raw json from nomos

Definition at line 102 of file Scanners.py.

◆ __get_ojo_result()

dict FoScanner.Scanners.Scanners.__get_ojo_result (   self)
private
Get the raw results from ojo scanner

:return: raw json from ojo

Definition at line 114 of file Scanners.py.

◆ __merge_nomos_ojo()

List[ScanResult] FoScanner.Scanners.Scanners.__merge_nomos_ojo (   self,
List[ScanResult nomos_licenses,
List[ScanResult ojo_licenses 
)
private
Merge the results from nomos and ojo based on file name

:param nomos_licenses: formatted result form nomos
:param ojo_licenses: formatted result form ojo

:return: merged list of scanner findings

Definition at line 279 of file Scanners.py.

◆ __normalize_path()

str FoScanner.Scanners.Scanners.__normalize_path (   self,
str  path 
)
private
Normalize the given path to repository root

:param path: path to normalize
:return: Normalized path

Definition at line 93 of file Scanners.py.

◆ get_copyright_list()

Union[List[ScanResult],List[ScanResultList],bool] FoScanner.Scanners.Scanners.get_copyright_list (   self,
bool   all_results = False,
bool   whole = False 
)
Get the formatted results from copyright scanner

:param all_results: Get all results even excluded files?
:type all_results: bool
:param: whole: return whole content from scanner
:return: list of findings
:rtype: List[ScanResult] | List[ScanResultList]

Definition at line 147 of file Scanners.py.

◆ get_keyword_list()

Union[List[ScanResult],List[ScanResultList],bool] FoScanner.Scanners.Scanners.get_keyword_list (   self,
bool   whole = False 
)
Get the formatted results from keyword scanner

:param: whole: return whole content from scanner
:return: List of findings
:rtype: List[ScanResult] | List[ScanResultList] | bool

Definition at line 186 of file Scanners.py.

◆ get_non_allow_listed_copyrights()

List[ScanResult] FoScanner.Scanners.Scanners.get_non_allow_listed_copyrights (   self,
List[ScanResult copyright_results 
)
Get copyrights from files which are not allow listed.

:param copyright_results: Copyright results from copyright agent
:return: List of scan results where copyrights found.

Definition at line 335 of file Scanners.py.

◆ get_non_allow_listed_results()

Union[List[ScanResult],List[ScanResultList]] FoScanner.Scanners.Scanners.get_non_allow_listed_results (   self,
List[ScanResult scan_results = None,
List[ScanResultList scan_results_whole = None,
bool   whole = False 
)
Get results where license check failed.

:param scan_results: Scan result from ojo/nomos
:param scan_results_whole: Whole scan result from ojo/nomos
:param: whole: return whole content from scanner

:return: List of results with only not allowed licenses
:rtype: List[ScanResult] | List[ScanResultList]

Definition at line 298 of file Scanners.py.

◆ get_scanner_results()

Union[List[ScanResult],List[ScanResultList]] FoScanner.Scanners.Scanners.get_scanner_results (   self,
bool   whole = False 
)
Get scan results from nomos and ojo scanners (whichever is selected).

:param: whole: return whole content from scanner
:return: List of scan results
:rtype: List[ScanResult] | List[ScanResultList]

Definition at line 398 of file Scanners.py.

◆ is_excluded_path()

bool FoScanner.Scanners.Scanners.is_excluded_path (   self,
str  path 
)
Check if the path is allow listed

The function used fnmatch to check if the path is in allow list or not.

:param path: path to check
:return: True if the path is in allow list, False otherwise

Definition at line 77 of file Scanners.py.

◆ results_are_allow_listed()

Union[List[ScanResult],List[ScanResultList],bool] FoScanner.Scanners.Scanners.results_are_allow_listed (   self,
bool   whole = False 
)
Get the formatted list of license scanner findings

The list contains the merged result of nomos/ojo scanner based on
cli_options passed

:param: whole: return whole content from scanner
:return: merged list of scanner findings
:rtype: List[ScanResult] | List[ScanResultList] | bool

Definition at line 350 of file Scanners.py.


The documentation for this class was generated from the following file: