Skip to content

Commit

Permalink
dont try to post messages on files not in pr (#431)
Browse files Browse the repository at this point in the history
fixes #430
  • Loading branch information
guykisel authored Dec 28, 2018
1 parent e354b99 commit d13e5e0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions inlineplz/interfaces/github.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ def __init__(
self.review_comments = list(self.pull_request.review_comments())
self.last_update = time.time()
self.messages_in_files = dict()
self.filenames = []
self.filenames = set()

try:
try:
Expand All @@ -171,7 +171,7 @@ def __init__(
# github.py == 0.9.6
pr_files = self.pull_request.iter_files()
self.filenames = set(
os.path.abspath(os.path.normcase(pr_file.filename))
os.path.relpath(pr_file.filename).replace("\\", "/").strip()
for pr_file in pr_files
)
print("Files in PR: {}".format(self.filenames))
Expand Down Expand Up @@ -301,7 +301,7 @@ def post_messages(self, messages, max_comments):
if not msg_position:
continue

if msg.path.split("/")[0] in self.ignore_paths:
if msg.path not in self.filenames or msg.path.split("/")[0] in self.ignore_paths:
continue

paths.setdefault(msg.path, 0)
Expand Down
2 changes: 1 addition & 1 deletion inlineplz/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def add_message(self, path, line, message):
# replace line numbers to improve deduping. we're commenting inline anyway,
# so line numbers don't really matter
if line > 1:
message = message.replace(str(line), "_")
message = " ".join(part for part in message.split(" ") if part != str(line))
if (path, line) not in self.messages:
try:
self.messages[(path, line)] = Message(path, line)
Expand Down

0 comments on commit d13e5e0

Please sign in to comment.