Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Consolidate PR comments #154

Merged
merged 2 commits into from
Jul 10, 2016
Merged

Conversation

doomspork
Copy link
Member

Hi @mmozuras, here are the changes I made regarding #147. I figured a PR was a good way to get and incorporate feedback. You'll see I removed the checkboxes in favor of a bulleted list.

@mmozuras
Copy link
Member

mmozuras commented May 15, 2016

@doomspork good work! 😄 🙇

@doomspork @kt0 what do you think about a separate runner?
I'm just not sure if consolidation should be the default. And having a separate runner seems cleaner than a configuration option.

@doomspork
Copy link
Member Author

@mmozuras a separate runner or a configuration option works for me. I'd like to look into the BitBucket runner and see how much of this can be shared.

@mmozuras
Copy link
Member

@doomspork if you'd find a general solution that works for GitHub/Bitbucket/Gitlab, it would amazing 😄

@doomspork
Copy link
Member Author

After a quick glance I don't think that should be a problem. What do you think @mmozuras, all new runners or update the existing runners to support a consolidated option?

@mmozuras
Copy link
Member

@doomspork on the second thought, having a separate runner would be too confusing. Runners should only be about "where/how to show/post". So, do the config option 😄

@doomspork
Copy link
Member Author

@mmozuras take a peek when you have a moment. I pulled most of the PR code into a separate PullRequestFormatter class which I inherit from in both BitBucket and GitHub. Tests are passing.

It doesn't look like GitLab has a PR formatter yet?

@@ -0,0 +1,87 @@
module Pronto
module Formatter
class PullRequestFormatter
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To clear up any confusion maybe this should be something like: PullRequestFormatterBase or AbstractPullRequestFormatter.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this code can almost entirely be re-used for the commit formatters maybe this would be better as: GitClientFormatterBase or some variation of that. Thoughts?

@doomspork
Copy link
Member Author

I think I can further consolidate GitHub, GitLab, and BitBucket commit formatters and incorporate the consolidation. Want me to go ahead with that @mmozuras?

def submit_comments(client, comments)
puts comments
comments.each { |comment| client.create_pull_comment(comment) }
rescue Octokit::UnprocessableEntity => e
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a BitBucket client error we should listen for? The BitBucket formatter didn't handle any exceptions.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doomspork BitbucketClient uses httparty. We could listen for HTTParty::Error.

@doomspork
Copy link
Member Author

@mmozuras just a heads up it may be a week or two before I finish up this change, I'm in the process of moving across the country. 😄

@mmozuras
Copy link
Member

@doomspork no worries, it's an amazing feature - well worth the wait 😄

@doomspork
Copy link
Member Author

@mmozuras I'm finally settled in, I'll resume my work on this now 👍

@doomspork
Copy link
Member Author

@mmozuras I've added the consolidation portion to commits and PRs, mind taking a look at these changes now?

end

def line_number(message)
message.line.new_linen
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

new_linen - a mistype perchance? 😄

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch 👍

@mmozuras
Copy link
Member

mmozuras commented Jun 20, 2016

@doomspork amazing! 🙇

I've also found a couple of style issues, which revealed that TravisCI no longer runs Pronto successfully (I'll fix that, no worries). Could you run pronto with rubocop locally on your PR and fix the issues? 😸

@doomspork
Copy link
Member Author

@mmozuras I cleaned up the pieces of feedback you left, ran Rubocop, and resolved the issues with my code. There's still a number of outstanding Rubocop changes but I assume you're not expecting me to fix them all 😀

@doomspork
Copy link
Member Author

@mmozuras I added a second commit with a number of Rubocop fixes for other pieces of code, I can drop the commit if you'd prefer 😀

@doomspork
Copy link
Member Author

@mmozuras any other feedback or things you'd like to see changed?

@@ -6,7 +6,7 @@ class CLI < Thor
require 'pronto/version'

class << self
def is_thor_reserved_word?(word, type)
def thor_reserved_word?(word, type)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doomspork overrides a method in thor. Can't be changed, should be reverted 😄

@mmozuras
Copy link
Member

mmozuras commented Jul 3, 2016

@doomspork only change that one line (the last comment) and it's good to go! 😄

@@ -29,6 +29,9 @@
require 'pronto/formatter/colorizable'
require 'pronto/formatter/text_formatter'
require 'pronto/formatter/json_formatter'
require 'pronto/formatter/git_formatter_base'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I suggest removing base from the name too. Not using that convention anywhere else in this project.

@doomspork
Copy link
Member Author

@mmozuras feedback has been incorporated 👍

@mmozuras
Copy link
Member

mmozuras commented Jul 4, 2016

@doomspork the code looks good 👍

Alas, Travis is still failing at after_success: https://travis-ci.org/mmozuras/pronto/jobs/142075404. If you could try to figure it out, it would be amazing 😄. If you won't find the time, I'll do it on Wednesday. It'll be a holiday here in Lithuania, so I will also release the next version of Pronto on that magical day (including this PR) 😄.

@mmozuras mmozuras merged commit a41eb03 into prontolabs:master Jul 10, 2016
@doomspork
Copy link
Member Author

Thanks @mmozuras! I've been busy preparing for a conference this week so I haven't had a chance to investigate the after_success further.

@doomspork doomspork deleted the consolidated-messaging branch July 10, 2016 17:11
@mmozuras
Copy link
Member

@doomspork no, thanks to you for contributing 😄

What kind of conference? Are you going to speak?

@doomspork
Copy link
Member Author

doomspork commented Jul 10, 2016

@mmozuras you're welcome! I'm working on Pronto-as-a-Service for work, once it's ready I'll open-source it and give you a ping.

I am speaking and doing a workshop @ http:https://elixircamp.io. If you happen to be in NYC stop by! 😀

@mmozuras
Copy link
Member

@doomspork looks like a fun conference! Alas, I won't be in NYC, but good luck on your talk and workshop 😄

I'm working on Pronto-as-a-Service for work, once it's ready I'll open-source it and give you a ping.

Exciting! Will it be free for OSS and paid for everyone else? Looking forward to see it 😄

@doomspork doomspork restored the consolidated-messaging branch August 1, 2016 20:56
@@ -11,6 +11,10 @@ def initialize(config_hash = ConfigFile.new.to_h)
end
end

def consolidate_comments?
!@config_hash['consolidate_comments'].nil?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This bypasses the ability to set it via an environment variable, right?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jhass correct, ENVs are not currently supported for: consolidate_comments, verbose, max_warnings, or exclusions.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should consider changing that.

Meanwhile https://github.com/mmozuras/pronto#configuration should be updated I guess, for both, mentioning that there are no overrides as well as this new option.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's up to @mmozuras to decide. 😀

Happy to contribute the change if it's something he's keen on.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@doomspork @jhass having consistency between config yml and ENV config would be amazing. I'd gladly accept a PR that improves it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

!@config_hash['consolidate_comments'].nil?
I found this a little bit counter intuitive.

My .pronto.yml config:

consolidate_comments: false

as a result !false.nil? is truthy.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch @mknapik, I've opened a PR with a fix.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please see #187

@doomspork
Copy link
Member Author

@mmozuras we just opened sourced our Pronto-as-a-Service that I mentioned to you, feel free to take a peek: https://github.com/wombatsecurity/nag

Any and all feedback is welcomed 👍

@mmozuras
Copy link
Member

@doomspork thanks, I'll try to find the time to try it myself in the next couple of days 😄

@doomspork
Copy link
Member Author

I need to update the README a bit but feel free to reach out to me via the email in my profile if you need a hand 😀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants