Skip to content

Commit

Permalink
Check whether message has a line before posting to GitLab
Browse files Browse the repository at this point in the history
  • Loading branch information
mmozuras committed Feb 19, 2017
1 parent f65f083 commit a9d1374
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 10 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@

### Bugs fixed

* [#125](https://github.com/mmozuras/pronto/issues/125): check whether message has a line before posting to GitLab.
* Post on commit comments on correct commit: use message.commit_sha to set comment.sha instead of head.
* [#201](https://github.com/mmozuras/pronto/issues/201): allow messages without line positions or paths.

Expand Down
2 changes: 1 addition & 1 deletion lib/pronto/formatter/bitbucket_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def pretty_name
end

def line_number(message, _)
message.line.new_lineno
message.line.new_lineno if message.line
end
end
end
Expand Down
4 changes: 4 additions & 0 deletions lib/pronto/formatter/bitbucket_pull_request_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ def client_module
def pretty_name
'BitBucket'
end

def line_number(message, _)
message.line.line.new_lineno if message.line
end
end
end
end
4 changes: 0 additions & 4 deletions lib/pronto/formatter/commit_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ def existing_comments(messages, client, repo)
grouped_comments(comments)
end

def line_number(message, _)
message.line.new_lineno
end

def submit_comments(client, comments)
comments.each { |comment| client.create_commit_comment(comment) }
rescue Octokit::UnprocessableEntity, HTTParty::Error => e
Expand Down
2 changes: 1 addition & 1 deletion lib/pronto/formatter/gitlab_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ def pretty_name
end

def line_number(message, _)
message.line.commit_line.new_lineno
message.line.commit_line.new_lineno if message.line
end
end
end
Expand Down
4 changes: 0 additions & 4 deletions lib/pronto/formatter/pull_request_formatter.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,6 @@ def existing_comments(messages, client, repo)
grouped_comments(comments)
end

def line_number(message, _)
message.line.line.new_lineno
end

def submit_comments(client, comments)
comments.each { |comment| client.create_pull_comment(comment) }
rescue Octokit::UnprocessableEntity, HTTParty::Error => e
Expand Down

0 comments on commit a9d1374

Please sign in to comment.