Skip to content

Commit

Permalink
[#46]: Fix issues with newly added is_note
Browse files Browse the repository at this point in the history
  • Loading branch information
JacobDomagala committed Oct 26, 2022
1 parent e1934b9 commit 59333d7
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/run_static_analysis.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
TARGET_REPO_NAME = os.getenv("INPUT_REPO")
SHA = os.getenv("GITHUB_SHA")
COMMENT_TITLE = os.getenv("INPUT_COMMENT_TITLE")
ONLY_PR_CHANGES = os.getenv("INPUT_REPORT_PR_CHANGES_ONLY")
ONLY_PR_CHANGES = os.getenv("INPUT_REPORT_PR_CHANGES_ONLY").lower()
VERBOSE = os.getenv("INPUT_VERBOSE", "False").lower() == "true"
FILES_WITH_ISSUES = dict()

Expand Down Expand Up @@ -116,10 +116,9 @@ def is_excluded_dir(line):
return False

excluded_dir = f"{WORK_DIR}/{exclude_dir}"
if VERBOSE:
debug_print(
f"{line} and {excluded_dir} with result {line.startswith(excluded_dir)}"
)
debug_print(
f"{line} and {excluded_dir} with result {line.startswith(excluded_dir)}"
)

return line.startswith(excluded_dir)

Expand Down Expand Up @@ -150,9 +149,11 @@ def create_comment_for_output(
line = line[file_path_end_idx + 1 :]
file_line_start = int(line[: line.index(":")])
file_line_end = get_file_line_end(file_path, file_line_start)
issue_description = line[line.index(' ')+1:]
is_note = issue_description.starts_with("note:")
description = f"\n```diff\n!Line: {file_line_start} - {issue_description}``` \n"
issue_description = line[line.index(" ") + 1 :]
is_note = issue_description.startswith("note:")
description = (
f"\n```diff\n!Line: {file_line_start} - {issue_description}``` \n"
)

if not is_note:
if TARGET_REPO_NAME != REPO_NAME:
Expand Down Expand Up @@ -190,7 +191,8 @@ def create_comment_for_output(
if check_for_char_limit(new_line):
output_string += new_line
CURRENT_COMMENT_LENGTH += len(new_line)
issues_found += 1
if not is_note:
issues_found += 1
else:
CURRENT_COMMENT_LENGTH = COMMENT_MAX_SIZE
return output_string, issues_found
Expand Down

0 comments on commit 59333d7

Please sign in to comment.