FOSSology  4.5.1
Open Source License Compliance by Open Source Software
FoScanner.FormatResults.FormatResult Class Reference
Collaboration diagram for FoScanner.FormatResults.FormatResult:
Collaboration graph

Public Member Functions

def __init__ (self, CliOptions cli_options)
 
def format_diff (self, diff_content)
 
def find_line_numbers (self, diff_string, word_start_byte, word_end_byte)
 
dict find_word_line_numbers (self, file_path, list words, str key)
 
def process_files (self, root_dir)
 

Public Attributes

 cli_options
 

Static Public Attributes

 CliOptions
 

Detailed Description

For formatting the results from scanners with line number information

:ivar cli_options: CliOptions object

Definition at line 12 of file FormatResults.py.

Member Function Documentation

◆ find_line_numbers()

def FoScanner.FormatResults.FormatResult.find_line_numbers (   self,
  diff_string,
  word_start_byte,
  word_end_byte 
)
Find line numbers from formmatted diff data

:param: diff_string : str Formatted diff string 
:param: word_start_byte : int Start byte of scanner result
:param: word_end_byte : int End byte of scanner result
:return: List of line_numbers found for a given word

Definition at line 63 of file FormatResults.py.

◆ find_word_line_numbers()

dict FoScanner.FormatResults.FormatResult.find_word_line_numbers (   self,
  file_path,
list  words,
str  key 
)
Find the line number of each word found for a given file path

:param: file_path : str Path of the file to scan
:param: words: list List of words(ScanResult Objects) to be scanned for
:param: Key to scan: 'contents' for copyright and keyword and 'license' for nomos and ojo
:return: found_words_with_line_number : dict Dictionary of scanned results
          with key as scanned word and value as list of line_numbers where 
          it is found.

Definition at line 77 of file FormatResults.py.

◆ format_diff()

def FoScanner.FormatResults.FormatResult.format_diff (   self,
  diff_content 
)
Format the diff content in a particular format with corrected line numbers.

:param: diff_content: str String to format
:return: str formatted_string

Definition at line 23 of file FormatResults.py.

◆ process_files()

def FoScanner.FormatResults.FormatResult.process_files (   self,
  root_dir 
)
Format the files according to unified diff format

:param: root_dir : str Path of the temp dir root to format the files
:return: None

Definition at line 117 of file FormatResults.py.


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