FOSSology  4.5.1
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, Packages scan_packages)
 
Packages get_scan_packages (self)
 
bool is_excluded_path (self, str path)
 
None set_copyright_list (self, bool all_results=False, bool whole=False)
 
None set_keyword_list (self, bool whole=False)
 
list[ScanResult]|list[ScanResultListget_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[ScanResultListget_copyright_results (self)
 
list[ScanResultListget_keyword_results (self)
 
list[ScanResultListget_license_results (self)
 
list[ScanResult]|list[ScanResultListresults_are_allow_listed (self, bool whole=False)
 
None set_scanner_results (self, bool whole=False)
 

Static Public Attributes

 str
 

Private Member Functions

str __normalize_path (self, str path, str against)
 
dict _execute_scanner_command (self, str scanner_path, str dir_to_scan, list[str] extra_args=None)
 
dict __get_nomos_result (self, str dir_to_scan)
 
dict __get_ojo_result (self, str dir_to_scan)
 
dict __get_copyright_results (self, str dir_to_scan)
 
dict __get_keyword_results (self, str dir_to_scan)
 
list[ScanResult]|list[ScanResultList_process_single_scanner_package (self, dict component, bool is_parent, callable scanner_func, str result_key, bool whole=False, bool all_results=False)
 
None __set_license_nomos (self, bool whole=False)
 
None __set_license_ojo (self, bool whole=False)
 
list[ScanResult__merge_nomos_ojo (self, list[ScanResult] nomos_licenses, list[ScanResult] ojo_licenses)
 

Private Attributes

 _allowlist_licenses_set
 

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 55 of file Scanners.py.

Constructor & Destructor Documentation

◆ __init__()

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

:param cli_options: CliOptions object to use
:type cli_options: CliOptions
:param scan_packages: ScanPackages for references
:type scan_packages: Packages

Definition at line 70 of file Scanners.py.

Member Function Documentation

◆ __get_copyright_results()

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

:return: raw json from copyright

Definition at line 175 of file Scanners.py.

◆ __get_keyword_results()

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

:return: raw json from keyword

Definition at line 183 of file Scanners.py.

◆ __get_nomos_result()

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

:return: raw json from nomos

Definition at line 156 of file Scanners.py.

◆ __get_ojo_result()

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

:return: raw json from ojo

Definition at line 167 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

Definition at line 359 of file Scanners.py.

◆ __normalize_path()

str FoScanner.Scanners.Scanners.__normalize_path (   self,
str  path,
str  against 
)
private
Normalize the given path against the given directory.

:param path: path to normalize
:param against: directory to normalize against
:return: Normalized path

Definition at line 102 of file Scanners.py.

◆ __set_license_nomos()

None FoScanner.Scanners.Scanners.__set_license_nomos (   self,
bool   whole = False 
)
private
Update the packages with formatted results of nomos scanner

Definition at line 325 of file Scanners.py.

◆ __set_license_ojo()

None FoScanner.Scanners.Scanners.__set_license_ojo (   self,
bool   whole = False 
)
private
Update the packages with formatted results of ojo scanner

Definition at line 342 of file Scanners.py.

◆ _execute_scanner_command()

dict FoScanner.Scanners.Scanners._execute_scanner_command (   self,
str  scanner_path,
str  dir_to_scan,
list[str]   extra_args = None 
)
private
Helper to execute a scanner command and return its JSON output.

Definition at line 119 of file Scanners.py.

◆ _process_single_scanner_package()

list[ScanResult] | list[ScanResultList] FoScanner.Scanners.Scanners._process_single_scanner_package (   self,
dict  component,
bool  is_parent,
callable  scanner_func,
str  result_key,
bool   whole = False,
bool   all_results = False 
)
private
Generalized function to process results from a single scanner for a given
component. Set `result_key` to 'results' for copyrights and 'licenses' for
license scanning.

Definition at line 191 of file Scanners.py.

◆ get_copyright_results()

list[ScanResultList] FoScanner.Scanners.Scanners.get_copyright_results (   self)
Get list of copyright scan results from the package list.

Definition at line 419 of file Scanners.py.

◆ get_keyword_results()

list[ScanResultList] FoScanner.Scanners.Scanners.get_keyword_results (   self)
Get list of keywords scan results from the package list.

Definition at line 431 of file Scanners.py.

◆ get_license_results()

list[ScanResultList] FoScanner.Scanners.Scanners.get_license_results (   self)
Get list of license scan results from the package list.

Definition at line 443 of file Scanners.py.

◆ get_non_allow_listed_copyrights()

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

Definition at line 411 of file Scanners.py.

◆ get_non_allow_listed_results()

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.

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

◆ results_are_allow_listed()

list[ScanResult] | list[ScanResultList] 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

Definition at line 455 of file Scanners.py.

◆ set_copyright_list()

None FoScanner.Scanners.Scanners.set_copyright_list (   self,
bool   all_results = False,
bool   whole = False 
)
Set the formatted results from copyright scanner for the components.

Definition at line 285 of file Scanners.py.

◆ set_keyword_list()

None FoScanner.Scanners.Scanners.set_keyword_list (   self,
bool   whole = False 
)
Get the formatted results from keyword scanner

Definition at line 306 of file Scanners.py.

◆ set_scanner_results()

None FoScanner.Scanners.Scanners.set_scanner_results (   self,
bool   whole = False 
)
Set the key `SCANNER_RESULTS` for all components in scan_packages using
nomos and ojo scanners (whichever is selected).

Definition at line 481 of file Scanners.py.


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