|
def | __init__ (self, CliOptions cli_options) |
|
str | format_diff (self, str diff_content) |
|
list[Any] | find_line_numbers (self, str diff_string, int word_start_byte, int word_end_byte) |
|
dict[str, set[str]]|None | find_word_line_numbers (self, str file_path, list words, str key) |
|
None | process_files (self, str root_dir) |
|
|
| _RE_DIFF_HEADER = re.compile(r'^@@ -([0-9]+),([0-9]+) [+]([0-9]+),([0-9]+) @@') |
|
| _RE_NON_CONTENT_LINE = re.compile(r'^(---|\+\+\+|[^-+ ])') |
|
For formatting the results from scanners with line number information
:ivar cli_options: CliOptions object
Definition at line 17 of file FormatResults.py.
◆ find_line_numbers()
list[Any] FoScanner.FormatResults.FormatResult.find_line_numbers |
( |
|
self, |
|
|
str |
diff_string, |
|
|
int |
word_start_byte, |
|
|
int
|
word_end_byte |
|
) |
| |
Find line numbers from formatted diff data
:param diff_string: Formatted diff string
:param word_start_byte: Start byte of scanner result
:param word_end_byte: End byte of scanner result
:return: List of line_numbers found for a given word
Definition at line 80 of file FormatResults.py.
◆ find_word_line_numbers()
dict[str, set[str]] | None FoScanner.FormatResults.FormatResult.find_word_line_numbers |
( |
|
self, |
|
|
str |
file_path, |
|
|
list |
words, |
|
|
str
|
key |
|
) |
| |
Find the line number of each word found for a given file path
:param file_path: Path of the file to scan
:param words: List of words(ScanResult Objects) to be scanned for
:param key: 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 96 of file FormatResults.py.
◆ format_diff()
str FoScanner.FormatResults.FormatResult.format_diff |
( |
|
self, |
|
|
str |
diff_content |
|
) |
| |
Format the diff content in a particular format with corrected line numbers.
:param diff_content: String to format
:return: formatted_string
Definition at line 32 of file FormatResults.py.
◆ process_files()
None FoScanner.FormatResults.FormatResult.process_files |
( |
|
self, |
|
|
str |
root_dir |
|
) |
| |
Format the files according to unified diff format
:param root_dir: Path of the temp dir root to format the files
:return: None
Definition at line 146 of file FormatResults.py.
The documentation for this class was generated from the following file: