Skip to content

Commit

Permalink
Add log_level to reporter
Browse files Browse the repository at this point in the history
  • Loading branch information
slgobinath committed Apr 6, 2018
1 parent c385759 commit 9b8cadc
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
3 changes: 2 additions & 1 deletion kodi_addon_checker/check_addon.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ def _find_in_file(path, search_terms, whitelisted_file_types):


def start(addon_path, config=None):
addon_report = Report()
addon_id = os.path.basename(os.path.normpath(addon_path))
addon_report = Report(addon_id)

global REL_PATH
# Extract common path from addon paths
Expand Down
2 changes: 1 addition & 1 deletion kodi_addon_checker/check_repo.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@


def check_repo(config, repo_path, parameters):
repo_report = Report()
repo_report = Report(repo_path)
repo_report.add(Record(INFORMATION, "Checking repository %s" % repo_path))
print("Repo path " + repo_path)
if len(parameters) == 0:
Expand Down
5 changes: 3 additions & 2 deletions kodi_addon_checker/report.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@


class Report(object):
def __init__(self):
def __init__(self, log_level):
self.log_level = log_level

This comment has been minimized.

Copy link
@razzeee

razzeee Apr 6, 2018

Member

Why does a Report have a log level? Doesn't make sense to me, please explain.

This comment has been minimized.

Copy link
@slgobinath

slgobinath Apr 6, 2018

Author Contributor

Hi,
It should be artifact_name/ file_name because Report is for repo, add-on or a file. However, the inheriting class Record is using the name log_level. I used the same name to maintain consistency and to avoid leaving inherited artifact_name/ file_name in Record without assigning a value.

If you find an alternative, please let me know.

self.problem_count = 0
self.warning_count = 0
self.information_count = 0
Expand All @@ -34,7 +35,7 @@ def __iter__(self):
class Record(Report):
def __init__(self, log_level, message, start_line=-1, end_line=-1, start_char_position=-1,
end_char_position=-1):
self.log_level = log_level
super().__init__(log_level)
self.message = message
self.start_line = start_line
self.end_line = end_line
Expand Down

0 comments on commit 9b8cadc

Please sign in to comment.