Skip to content

Commit

Permalink
Merge pull request #161 from SeongjunJo/exclude_path
Browse files Browse the repository at this point in the history
Add log and cover item for excluded path
  • Loading branch information
soimkim authored May 13, 2024
2 parents b23aac6 + 9423655 commit 17b0304
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
5 changes: 4 additions & 1 deletion src/fosslight_util/cover.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,18 @@ class CoverItem:
start_time_key = "Start time"
python_ver_key = "Python version"
analyzed_path_key = "Analyzed path"
excluded_path_key = "Excluded path"
comment_key = "Comment"

def __init__(self, tool_name="", start_time="", input_path="", comment=""):
def __init__(self, tool_name="", start_time="", input_path="", comment="", exclude_path=[]):
self.tool_name = tool_name
if start_time:
date, time = start_time.split('_')
self.start_time = f'{date}, {time[0:2]}:{time[2:4]}'
else:
self.start_time = ""
self.input_path = os.path.abspath(input_path)
self.exclude_path = ", ".join(exclude_path)
self.comment = comment

self.tool_version = print_package_version(self.tool_name, "", False)
Expand All @@ -39,6 +41,7 @@ def get_print_json(self):
json_item[self.start_time_key] = self.start_time
json_item[self.python_ver_key] = self.python_version
json_item[self.analyzed_path_key] = self.input_path
json_item[self.excluded_path_key] = self.exclude_path
json_item[self.comment_key] = self.comment

return json_item
4 changes: 3 additions & 1 deletion src/fosslight_util/set_log.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def process(self, msg, kwargs):


def init_log(log_file, create_file=True, stream_log_level=logging.INFO,
file_log_level=logging.DEBUG, main_package_name="", path_to_analyze=""):
file_log_level=logging.DEBUG, main_package_name="", path_to_analyze="", path_to_exclude=[]):

logger = logging.getLogger(constant.LOGGER_NAME)

Expand Down Expand Up @@ -83,5 +83,7 @@ def init_log(log_file, create_file=True, stream_log_level=logging.INFO,
_result_log["Tool Info"] = pkg_info
if path_to_analyze != "":
_result_log["Path to analyze"] = path_to_analyze
if path_to_exclude != []:
_result_log["Path to exclude"] = ", ".join(path_to_exclude)

return logger, _result_log

0 comments on commit 17b0304

Please sign in to comment.