FOSSology  4.4.0
Open Source License Compliance by Open Source Software
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], bool] get_copyright_list (self, bool all_results=False)
 
Union[List[ScanResult], bool] get_keyword_list (self)
 
List[ScanResultget_non_allow_listed_results (self, List[ScanResult] scan_results)
 
List[ScanResultget_non_allow_listed_copyrights (self, List[ScanResult] copyright_results)
 
Union[List[ScanResult], bool] results_are_allow_listed (self)
 
List[ScanResultget_scanner_results (self)
 

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)
 
List[ScanResult__get_license_nomos (self)
 
List[ScanResult__get_license_ojo (self)
 
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 35 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 50 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 107 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 118 of file Scanners.py.

◆ __get_license_nomos()

List[ScanResult] FoScanner.Scanners.Scanners.__get_license_nomos (   self)
private
Get the formatted results from nomos scanner

:return: list of findings

Definition at line 187 of file Scanners.py.

◆ __get_license_ojo()

List[ScanResult] FoScanner.Scanners.Scanners.__get_license_ojo (   self)
private
Get the formatted results from ojo scanner

:return: list of findings

Definition at line 205 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 84 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 96 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 225 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 75 of file Scanners.py.

◆ get_copyright_list()

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

:param all_results: Get all results even excluded files?
:type all_results: bool
:return: list of findings
:rtype: list[ScanResult]

Definition at line 129 of file Scanners.py.

◆ get_keyword_list()

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

:return: list of findings

Definition at line 160 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 264 of file Scanners.py.

◆ get_non_allow_listed_results()

List[ScanResult] FoScanner.Scanners.Scanners.get_non_allow_listed_results (   self,
List[ScanResult scan_results 
)
Get results where license check failed.

:param scan_results: Scan result from ojo/nomos
:return: List of results with only not allowed licenses

Definition at line 244 of file Scanners.py.

◆ get_scanner_results()

List[ScanResult] FoScanner.Scanners.Scanners.get_scanner_results (   self)
Get scan results from nomos and ojo scanners (whichever is selected).

:return: List of scan results

Definition at line 306 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 59 of file Scanners.py.

◆ results_are_allow_listed()

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

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

:return: merged list of scanner findings

Definition at line 279 of file Scanners.py.


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