pronto 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +24 -4
  3. data/README.md +54 -16
  4. data/lib/pronto/bitbucket.rb +76 -0
  5. data/lib/pronto/cli.rb +8 -2
  6. data/lib/pronto/clients/bitbucket_client.rb +55 -0
  7. data/lib/pronto/comment.rb +13 -0
  8. data/lib/pronto/config.rb +9 -1
  9. data/lib/pronto/config_file.rb +6 -0
  10. data/lib/pronto/formatter/bitbucket_formatter.rb +17 -0
  11. data/lib/pronto/formatter/bitbucket_pull_request_formatter.rb +13 -0
  12. data/lib/pronto/formatter/colorizable.rb +17 -0
  13. data/lib/pronto/formatter/commit_formatter.rb +21 -0
  14. data/lib/pronto/formatter/formatter.rb +3 -0
  15. data/lib/pronto/formatter/git_formatter.rb +96 -0
  16. data/lib/pronto/formatter/github_formatter.rb +8 -20
  17. data/lib/pronto/formatter/github_pull_request_formatter.rb +5 -28
  18. data/lib/pronto/formatter/github_status_formatter/inflector.rb +17 -0
  19. data/lib/pronto/formatter/github_status_formatter/sentence.rb +42 -0
  20. data/lib/pronto/formatter/github_status_formatter/status_builder.rb +76 -0
  21. data/lib/pronto/formatter/github_status_formatter.rb +28 -0
  22. data/lib/pronto/formatter/gitlab_formatter.rb +8 -19
  23. data/lib/pronto/formatter/json_formatter.rb +1 -0
  24. data/lib/pronto/formatter/pull_request_formatter.rb +20 -0
  25. data/lib/pronto/formatter/text_formatter.rb +27 -5
  26. data/lib/pronto/gem_names.rb +9 -4
  27. data/lib/pronto/github.rb +9 -13
  28. data/lib/pronto/gitlab.rb +11 -15
  29. data/lib/pronto/runner.rb +1 -1
  30. data/lib/pronto/status.rb +14 -0
  31. data/lib/pronto/version.rb +1 -1
  32. data/lib/pronto.rb +14 -0
  33. data/pronto.gemspec +4 -0
  34. metadata +72 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ff7961eb19513e5f97591c8c3fe3630e3236728a
4
- data.tar.gz: 967a58d14779d25bce8f2532795ce8002984512f
3
+ metadata.gz: ed857182c87afee371e2822b26f8303a42cd848a
4
+ data.tar.gz: 152bd31948ddf2b999dbc7334c5292842e99ffcd
5
5
  SHA512:
6
- metadata.gz: 6d5dd6119ee5480bcd3d2df9eab8a7a260d7ba22fde8d4eeb5bdcecc25b67564eab12507507e9a315d5673a8f11753eede5480723238895c2129b1e62adc5fd6
7
- data.tar.gz: 1dd77adf6e74f41db0241da701de825084da6dff03370ab9e2faf37681b019bb6b2a66685dee304c545c3edc1d13dfd1c421756e69a481a1cdddba40ff4ec9fa
6
+ metadata.gz: c06cb847d4a953da70c9b79944a55d7b93058c49e737cd898d7247ca803ea00960b8343395b0376cea0efc2c2d18bda55ae6cd52a65aa60d391e55aa95b16a86
7
+ data.tar.gz: 181ab9b31d663a84e3a49c38d4e59826cda02f7cf047813dc92c8d4350ea81c6940da803b5109c7c031f918edd5c2cb79f31992179c922b76a1dcbe34a95a020
data/CHANGELOG.md CHANGED
@@ -2,11 +2,31 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+
6
+ ## 0.7.0
7
+
8
+ ### New features
9
+
10
+ * [#135](https://github.com/mmozuras/pronto/pull/135): add Bitbucket formatter.
11
+ * [#135](https://github.com/mmozuras/pronto/pull/135): add Bitbucket pull request formatter.
12
+ * [#134](https://github.com/mmozuras/pronto/pull/134): colorize text formatter.
13
+ * [#144](https://github.com/mmozuras/pronto/pull/144): add GitHub status formatter.
14
+ * [#157](https://github.com/mmozuras/pronto/pull/157): ability to run pronto CLI from within subdirectories of a git repository.
15
+ * [#154](https://github.com/mmozuras/pronto/pull/154): add an option to consolidate pull request comments.
16
+
17
+ ### Changes
18
+
19
+ * [#162](https://github.com/mmozuras/pronto/pull/162): don't count info messages for error exit code.
20
+
21
+ ### Bugs fixed
22
+
23
+ * [#153](https://github.com/mmozuras/pronto/pull/153): correctly get repo_path.
24
+
5
25
  ## 0.6.0
6
26
 
7
27
  ### New features
8
28
 
9
- * Added `-V/--verbose-version` option that displays Ruby version.
29
+ * Add `-V/--verbose-version` option that displays Ruby version.
10
30
  * [#127](https://github.com/mmozuras/pronto/pull/127): ability to specify `max_warnings` via configuration or environment variable.
11
31
  * [#18](https://github.com/mmozuras/pronto/issues/18): ability to specify `verbose` via configuration, which can provide more output for debugging purposes.
12
32
  * [#83](https://github.com/mmozuras/pronto/issues/83): support multiple formatters as an option to `pronto run`.
@@ -14,9 +34,9 @@
14
34
  ### Changes
15
35
 
16
36
  * `--version` only displays the version itself without any additional text.
17
- * Replaced `Pronto.gem_names` with `Pronto::GemNames.new.to_a`.
18
- * [#116](https://github.com/mmozuras/pronto/pull/116): improved GitHub formatter error output.
19
- * [#123](https://github.com/mmozuras/pronto/pull/126): added runner attribute to message initialization.
37
+ * Replace `Pronto.gem_names` with `Pronto::GemNames.new.to_a`.
38
+ * [#116](https://github.com/mmozuras/pronto/pull/116): improve GitHub formatter error output.
39
+ * [#123](https://github.com/mmozuras/pronto/pull/126): add runner attribute to message initialization.
20
40
  * Runner expects to receive patches/commit via `initialize(patches, commit)`, instead of `run(patches, commit)`.
21
41
 
22
42
  ### Bugs fixed
data/README.md CHANGED
@@ -1,13 +1,13 @@
1
1
  # Pronto
2
2
 
3
- [![Code Climate](https://codeclimate.com/github/mmozuras/pronto.png)](https://codeclimate.com/github/mmozuras/pronto)
4
- [![Build Status](https://secure.travis-ci.org/mmozuras/pronto.png)](http://travis-ci.org/mmozuras/pronto)
5
- [![Gem Version](https://badge.fury.io/rb/pronto.png)](http://badge.fury.io/rb/pronto)
6
- [![Dependency Status](https://gemnasium.com/mmozuras/pronto.png)](https://gemnasium.com/mmozuras/pronto)
7
- [![Inline docs](http://inch-ci.org/github/mmozuras/pronto.png)](http://inch-ci.org/github/mmozuras/pronto)
3
+ [![Code Climate](https://codeclimate.com/github/mmozuras/pronto.svg)](https://codeclimate.com/github/mmozuras/pronto)
4
+ [![Build Status](https://secure.travis-ci.org/mmozuras/pronto.svg)](http://travis-ci.org/mmozuras/pronto)
5
+ [![Gem Version](https://badge.fury.io/rb/pronto.svg)](http://badge.fury.io/rb/pronto)
6
+ [![Dependency Status](https://gemnasium.com/mmozuras/pronto.svg)](https://gemnasium.com/mmozuras/pronto)
7
+ [![Inline docs](http://inch-ci.org/github/mmozuras/pronto.svg)](http://inch-ci.org/github/mmozuras/pronto)
8
8
 
9
9
  **Pronto** runs analysis quickly by checking only the relevant changes. Created to
10
- be used on [pull requests](#github-integration), but also works [locally](#local-changes) and integrates with [GitLab](#gitlab-integration).
10
+ be used on [pull requests](#github-integration), but also works [locally](#local-changes) and integrates with [GitLab](#gitlab-integration) and [Bitbucket](#bitbucket-integration).
11
11
  Perfect if want to find out quickly if branch introduces changes that conform
12
12
  to your [styleguide](https://github.com/mmozuras/pronto-rubocop), [are DRY](https://github.com/mmozuras/pronto-flay), [don't introduce security holes](https://github.com/mmozuras/pronto-brakeman) and [more](#runners).
13
13
 
@@ -18,6 +18,7 @@ to your [styleguide](https://github.com/mmozuras/pronto-rubocop), [are DRY](http
18
18
  * [Local Changes](#local-changes)
19
19
  * [GitHub Integration](#github-integration)
20
20
  * [GitLab Integration](#gitlab-integration)
21
+ * [Bitbucket Integration](#bitbucket-integration)
21
22
  * [Configuration](#configuration)
22
23
  * [Runners](#runners)
23
24
  * [Articles](#articles)
@@ -100,7 +101,20 @@ $ GITHUB_ACCESS_TOKEN=token pronto run -f github -c origin/master
100
101
  or, if you want comments to appear on pull request diff, instead of commit:
101
102
 
102
103
  ```sh
103
- $ GITHUB_ACCESS_TOKEN=token PULL_REQUEST_ID=id pronto run -f github_pr -c origin/master
104
+ $ GITHUB_ACCESS_TOKEN=token pronto run -f github_pr -c origin/master
105
+ ```
106
+
107
+ Use `GithubStatusFormatter` to submit [commit status](https://github.com/blog/1227-commit-status-api):
108
+
109
+ ```sh
110
+ $ GITHUB_ACCESS_TOKEN=token pronto run -f github_status -c origin/master
111
+ ```
112
+
113
+ It's possible to combine multiple formatters.
114
+ To get both pull request comments and commit status summary use:
115
+
116
+ ```sh
117
+ $ GITHUB_ACCESS_TOKEN=token PULL_REQUEST_ID=id pronto run -f github_status github_pr -c origin/master
104
118
  ```
105
119
 
106
120
  As an alternative, you can also set up a rake task:
@@ -109,7 +123,9 @@ As an alternative, you can also set up a rake task:
109
123
  Pronto::GemNames.new.to_a.each { |gem_name| require "pronto/#{gem_name}" }
110
124
 
111
125
  formatter = Pronto::Formatter::GithubFormatter.new # or GithubPullRequestFormatter
112
- Pronto.run('origin/master', '.', formatter)
126
+ status_formatter = Pronto::Formatter::GithubStatusFormatter.new
127
+ formatters = [formatter, status_formatter]
128
+ Pronto.run('origin/master', '.', formatters)
113
129
  ```
114
130
 
115
131
  ### GitLab Integration
@@ -131,13 +147,26 @@ Then just run it:
131
147
  $ GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
132
148
  ```
133
149
 
134
- As an alternative, you can also set up a rake task:
150
+ ### Bitbucket Integration
135
151
 
136
- ```ruby
137
- Pronto::GemNames.new.to_a.each { |gem_name| require "pronto/#{gem_name}" }
152
+ You can run Pronto as a step of your CI builds and get the results as comments
153
+ on Bitbucket commits using `BitbucketFormatter` or `BitbucketPullRequestFormatter`.
154
+
155
+ Add Pronto runners you want to use to your Gemfile:
156
+
157
+ Set the BITBUCKET_USERNAME and BITBUCKET_PASSWORD environment variables or values in `.pronto.yml`.
158
+ .
159
+
160
+ Then just run it:
138
161
 
139
- formatter = Pronto::Formatter::GitlabFormatter.new
140
- Pronto.run('origin/master', '.', formatter)
162
+ ```sh
163
+ $ BITBUCKET_USERNAME=user BITBUCKET_PASSWORD=pass pronto run -f bitbucket -c origin/master
164
+ ```
165
+
166
+ or, if you want comments to appear on pull request diff, instead of commit:
167
+
168
+ ```sh
169
+ $ BITBUCKET_USERNAME=user BITBUCKET_PASSWORD=pass pronto run -f bitbucket_pr -c origin/master
141
170
  ```
142
171
 
143
172
  ## Configuration
@@ -157,9 +186,14 @@ github:
157
186
  api_endpoint: https://api.github.com/
158
187
  web_endpoint: https://github.com/
159
188
  gitlab:
160
- slug: mmozuras/pronto,
161
- api_private_token: 46751,
189
+ slug: mmozuras/42
190
+ api_private_token: 46751
162
191
  api_endpoint: https://api.vinted.com/gitlab
192
+ bitbucket:
193
+ slug: mmozuras/pronto
194
+ username: user
195
+ password: pass
196
+ web_endpoint: https://bitbucket.org/
163
197
  max_warnings: 150
164
198
  verbose: false
165
199
  ```
@@ -176,13 +210,16 @@ Currently available:
176
210
 
177
211
  * [pronto-brakeman](https://github.com/mmozuras/pronto-brakeman)
178
212
  * [pronto-coffeelint](https://github.com/siebertm/pronto-coffeelint)
213
+ * [pronto-credo](https://github.com/carakan/pronto-credo)
179
214
  * [pronto-eslint](https://github.com/mmozuras/pronto-eslint)
180
215
  * [pronto-fasterer](https://github.com/mmozuras/pronto-fasterer)
181
216
  * [pronto-flay](https://github.com/mmozuras/pronto-flay)
182
217
  * [pronto-foodcritic](https://github.com/mmozuras/pronto-foodcritic)
218
+ * [pronto-haml](https://github.com/mmozuras/pronto-haml)
183
219
  * [pronto-jscs](https://github.com/spajus/pronto-jscs)
184
220
  * [pronto-jshint](https://github.com/mmozuras/pronto-jshint)
185
- * [pronto-haml](https://github.com/mmozuras/pronto-haml)
221
+ * [pronto-json](https://github.com/deees/pronto-json)
222
+ * [pronto-luacheck](https://github.com/seikichi/pronto-luacheck)
186
223
  * [pronto-poper](https://github.com/mmozuras/pronto-poper)
187
224
  * [pronto-rails_best_practices](https://github.com/mmozuras/pronto-rails_best_practices)
188
225
  * [pronto-rails_schema](https://github.com/raimondasv/pronto-rails_schema)
@@ -202,6 +239,7 @@ Articles to help you to get started:
202
239
  * [Continuous Static Analysis using Pronto](http://codingfearlessly.com/2014/11/06/continuous-static-analysis/)
203
240
  * [Pronto and git hooks](http://elliotthilaire.net/gem-pronto-and-git-hooks/)
204
241
  * [How to end fruitless dev discussions about your project’s code style?](https://medium.com/appaloosa-store-engineering/how-to-end-fruitless-dev-discussions-about-your-project-s-code-style-245070bff6d4)
242
+ * [Free automated code reviews using Pronto](https://hovancik.net/blog/2016/04/11/free-automated-code-reviews-using-pronto.html)
205
243
 
206
244
  Make a Pull Request to add something you wrote or found useful.
207
245
 
@@ -0,0 +1,76 @@
1
+ module Pronto
2
+ class Bitbucket
3
+ def initialize(repo)
4
+ @repo = repo
5
+ @config = Config.new
6
+ @comment_cache = {}
7
+ @pull_id_cache = {}
8
+ end
9
+
10
+ def pull_comments(sha)
11
+ @comment_cache["#{pull_id}/#{sha}"] ||= begin
12
+ client.pull_comments(slug, pull_id).map do |comment|
13
+ Comment.new(sha, comment.content, comment.filename, comment.line_to)
14
+ end
15
+ end
16
+ end
17
+
18
+ def commit_comments(sha)
19
+ @comment_cache[sha.to_s] ||= begin
20
+ client.commit_comments(slug, sha).map do |comment|
21
+ Comment.new(sha, comment.content, comment.filename, comment.line_to)
22
+ end
23
+ end
24
+ end
25
+
26
+ def create_commit_comment(comment)
27
+ @config.logger.log("Creating commit comment on #{comment.sha}")
28
+ client.create_commit_comment(slug, comment.sha, comment.body,
29
+ comment.path, comment.position)
30
+ end
31
+
32
+ def create_pull_comment(comment)
33
+ @config.logger.log("Creating pull request comment on #{pull_id}")
34
+ client.create_pull_comment(slug, pull_id, comment.body,
35
+ comment.path, comment.position)
36
+ end
37
+
38
+ private
39
+
40
+ def slug
41
+ return @config.bitbucket_slug if @config.bitbucket_slug
42
+ @slug ||= begin
43
+ @repo.remote_urls.map do |url|
44
+ hostname = Regexp.escape(@config.bitbucket_hostname)
45
+ match = %r{.*#{hostname}(:|\/)(?<slug>.*?)(?:\.git)?\z}.match(url)
46
+ match[:slug] if match
47
+ end.compact.first
48
+ end
49
+ end
50
+
51
+ def client
52
+ @client ||= BitbucketClient.new(@config.bitbucket_username,
53
+ @config.bitbucket_password)
54
+ end
55
+
56
+ def pull_id
57
+ pull ? pull.id.to_i : env_pull_id.to_i
58
+ end
59
+
60
+ def env_pull_id
61
+ ENV['PULL_REQUEST_ID']
62
+ end
63
+
64
+ def pull
65
+ @pull ||= if env_pull_id
66
+ pull_requests.find { |pr| pr.id.to_i == env_pull_id.to_i }
67
+ elsif @repo.branch
68
+ pull_requests.find { |pr| pr.branch['name'] == @repo.branch }
69
+ end
70
+ end
71
+
72
+ def pull_requests
73
+ @pull_requests ||= client.pull_requests(slug)
74
+ end
75
+ end
76
+ end
data/lib/pronto/cli.rb CHANGED
@@ -49,8 +49,14 @@ module Pronto
49
49
 
50
50
  formatters = ::Pronto::Formatter.get(options[:formatters])
51
51
  commit = options[:index] ? :index : options[:commit]
52
- messages = ::Pronto.run(commit, '.', formatters, path)
53
- exit(messages.count) if options[:'exit-code']
52
+ repo_workdir = ::Rugged::Repository.discover('.').workdir
53
+ messages = Dir.chdir(repo_workdir) do
54
+ ::Pronto.run(commit, '.', formatters, path)
55
+ end
56
+ if options[:'exit-code']
57
+ error_messages_count = messages.count { |m| m.level != :info }
58
+ exit(error_messages_count)
59
+ end
54
60
  rescue Rugged::RepositoryError
55
61
  puts '"pronto" should be run from a git repository'
56
62
  end
@@ -0,0 +1,55 @@
1
+ class BitbucketClient
2
+ include HTTParty
3
+ base_uri 'https://api.bitbucket.org/1.0/repositories'
4
+
5
+ def initialize(username, password)
6
+ credentials = { username: username, password: password }
7
+ @headers = { basic_auth: credentials }
8
+ end
9
+
10
+ def commit_comments(slug, sha)
11
+ response = self.class.get("/#{slug}/changesets/#{sha}/comments", @headers)
12
+ openstruct(response.parsed_response)
13
+ end
14
+
15
+ def create_commit_comment(slug, sha, body, path, position)
16
+ options = {
17
+ body: {
18
+ content: body,
19
+ line_to: position,
20
+ filename: path
21
+ }
22
+ }
23
+ options.merge!(@headers)
24
+ self.class.post("/#{slug}/changesets/#{sha}/comments", options)
25
+ end
26
+
27
+ def pull_comments(slug, pr_id)
28
+ url = "/#{slug}/pullrequests/#{pr_id}/comments"
29
+ response = self.class.get(url, @headers)
30
+ openstruct(response.parsed_response)
31
+ end
32
+
33
+ def pull_requests(slug)
34
+ base = 'https://api.bitbucket.org/2.0/repositories'
35
+ url = "#{base}/#{slug}/pullrequests?state=OPEN"
36
+ response = self.class.get(url, @headers)
37
+ openstruct(response.parsed_response['values'])
38
+ end
39
+
40
+ def create_pull_comment(slug, pull_id, body, path, position)
41
+ options = {
42
+ body: {
43
+ content: body,
44
+ line_to: position,
45
+ filename: path
46
+ }
47
+ }
48
+ options.merge!(@headers)
49
+ self.class.post("/#{slug}/pullrequests/#{pull_id}/comments", options)
50
+ end
51
+
52
+ def openstruct(response)
53
+ response.map { |r| OpenStruct.new(r) }
54
+ end
55
+ end
@@ -0,0 +1,13 @@
1
+ module Pronto
2
+ Comment = Struct.new(:sha, :body, :path, :position) do
3
+ def ==(other)
4
+ position == other.position &&
5
+ path == other.path &&
6
+ body == other.body
7
+ end
8
+
9
+ def to_s
10
+ "[#{sha}] #{path}:#{position} - #{body}"
11
+ end
12
+ end
13
+ end
data/lib/pronto/config.rb CHANGED
@@ -4,13 +4,17 @@ module Pronto
4
4
  @config_hash = config_hash
5
5
  end
6
6
 
7
- %w(github gitlab).each do |service|
7
+ %w(github gitlab bitbucket).each do |service|
8
8
  ConfigFile::EMPTY[service].each do |key, _|
9
9
  name = "#{service}_#{key}"
10
10
  define_method(name) { ENV[name.upcase] || @config_hash[service][key] }
11
11
  end
12
12
  end
13
13
 
14
+ def consolidate_comments?
15
+ !@config_hash['consolidate_comments'].nil?
16
+ end
17
+
14
18
  def excluded_files
15
19
  @excluded_files ||= Array(exclude)
16
20
  .flat_map { |path| Dir[path.to_s] }
@@ -21,6 +25,10 @@ module Pronto
21
25
  URI.parse(github_web_endpoint).host
22
26
  end
23
27
 
28
+ def bitbucket_hostname
29
+ URI.parse(bitbucket_web_endpoint).host
30
+ end
31
+
24
32
  def max_warnings
25
33
  @config_hash['max_warnings']
26
34
  end
@@ -16,6 +16,12 @@ module Pronto
16
16
  'api_private_token' => nil,
17
17
  'api_endpoint' => nil
18
18
  },
19
+ 'bitbucket' => {
20
+ 'slug' => nil,
21
+ 'username' => nil,
22
+ 'password' => nil,
23
+ 'web_endpoint' => 'https://bitbucket.org/'
24
+ },
19
25
  'runners' => [],
20
26
  'formatters' => [],
21
27
  'max_warnings' => nil,
@@ -0,0 +1,17 @@
1
+ module Pronto
2
+ module Formatter
3
+ class BitbucketFormatter < CommitFormatter
4
+ def client_module
5
+ Bitbucket
6
+ end
7
+
8
+ def pretty_name
9
+ 'BitBucket'
10
+ end
11
+
12
+ def line_number(message)
13
+ message.line.new_lineno
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,13 @@
1
+ module Pronto
2
+ module Formatter
3
+ class BitbucketPullRequestFormatter < PullRequestFormatter
4
+ def client_module
5
+ Bitbucket
6
+ end
7
+
8
+ def pretty_name
9
+ 'BitBucket'
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,17 @@
1
+ module Pronto
2
+ module Formatter
3
+ module Colorizable
4
+ def colorize(string, color)
5
+ rainbow.wrap(string).color(color)
6
+ end
7
+
8
+ private
9
+
10
+ def rainbow
11
+ @rainbow ||= Rainbow.new.tap do |rainbow|
12
+ rainbow.enabled = $stdout.tty?
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,21 @@
1
+ module Pronto
2
+ module Formatter
3
+ class CommitFormatter < GitFormatter
4
+ def existing_comments(client, sha)
5
+ comments = client.commit_comments(sha)
6
+ grouped_comments(comments)
7
+ end
8
+
9
+ def line_number(message)
10
+ message.line.new_lineno
11
+ end
12
+
13
+ def submit_comments(client, comments)
14
+ comments.each { |comment| client.create_commit_comment(comment) }
15
+ rescue Octokit::UnprocessableEntity, HTTParty::Error => e
16
+ $stderr.puts "Failed to post: #{e.message}"
17
+ $stderr.puts e.inspect
18
+ end
19
+ end
20
+ end
21
+ end
@@ -12,8 +12,11 @@ module Pronto
12
12
 
13
13
  FORMATTERS = {
14
14
  'github' => GithubFormatter,
15
+ 'github_status' => GithubStatusFormatter,
15
16
  'github_pr' => GithubPullRequestFormatter,
16
17
  'gitlab' => GitlabFormatter,
18
+ 'bitbucket' => BitbucketFormatter,
19
+ 'bitbucket_pr' => BitbucketPullRequestFormatter,
17
20
  'json' => JsonFormatter,
18
21
  'checkstyle' => CheckstyleFormatter,
19
22
  'text' => TextFormatter,
@@ -0,0 +1,96 @@
1
+ module Pronto
2
+ module Formatter
3
+ class GitFormatter
4
+ def format(messages, repo, patches)
5
+ client = client_module.new(repo)
6
+ head = repo.head_commit_sha
7
+ existing = existing_comments(client, head)
8
+ comments = new_comments(messages, patches, head)
9
+ additions = remove_duplicate_comments(existing, comments)
10
+ submit_comments(client, additions)
11
+
12
+ "#{additions.count} Pronto messages posted to #{pretty_name}"
13
+ end
14
+
15
+ def client_module
16
+ raise NotImplementedError
17
+ end
18
+
19
+ def pretty_name
20
+ raise NotImplementedError
21
+ end
22
+
23
+ protected
24
+
25
+ def existing_comments(*)
26
+ raise NotImplementedError
27
+ end
28
+
29
+ def line_number(*)
30
+ raise NotImplementedError
31
+ end
32
+
33
+ def submit_comments(*)
34
+ raise NotImplementedError
35
+ end
36
+
37
+ private
38
+
39
+ def grouped_comments(comments)
40
+ comments.group_by { |comment| [comment.path, comment.position] }
41
+ end
42
+
43
+ def config
44
+ @config ||= Config.new
45
+ end
46
+
47
+ def consolidate_comments(comments)
48
+ comment = comments.first
49
+ if comments.length > 1
50
+ joined_body = join_comments(comments)
51
+ Comment.new(comment.sha, joined_body, comment.path, comment.position)
52
+ else
53
+ comment
54
+ end
55
+ end
56
+
57
+ def dedupe_comments(existing, comments)
58
+ body = existing.map(&:body).join(' ')
59
+ comments.select { |comment| !body.include?(comment.body) }
60
+ end
61
+
62
+ def join_comments(comments)
63
+ comments.map { |comment| "- #{comment.body}" }.join("\n")
64
+ end
65
+
66
+ def new_comment(message, _patches, sha)
67
+ body = message.msg
68
+ path = message.path
69
+ lineno = line_number(message)
70
+
71
+ Comment.new(sha, body, path, lineno)
72
+ end
73
+
74
+ def new_comments(messages, patches, sha)
75
+ comments = messages
76
+ .uniq
77
+ .map { |message| new_comment(message, patches, sha) }
78
+ grouped_comments(comments)
79
+ end
80
+
81
+ def remove_duplicate_comments(old_comments, new_comments)
82
+ new_comments.each_with_object([]) do |(key, comments), memo|
83
+ existing = old_comments[key]
84
+ comments = dedupe_comments(existing, comments) if existing
85
+
86
+ if config.consolidate_comments?
87
+ comment = consolidate_comments(comments)
88
+ memo.push(comment)
89
+ else
90
+ memo.concat(comments)
91
+ end
92
+ end
93
+ end
94
+ end
95
+ end
96
+ end
@@ -1,28 +1,16 @@
1
1
  module Pronto
2
2
  module Formatter
3
- class GithubFormatter
4
- def format(messages, repo, _)
5
- client = Github.new(repo)
6
-
7
- commit_messages = messages.uniq.map do |message|
8
- sha = message.commit_sha
9
- body = message.msg
10
- path = message.path
11
- position = message.line.commit_line.position if message.line
12
-
13
- create_comment(client, sha, body, path, position)
14
- end
15
-
16
- "#{commit_messages.compact.count} Pronto messages posted to GitHub"
3
+ class GithubFormatter < CommitFormatter
4
+ def client_module
5
+ Github
17
6
  end
18
7
 
19
- private
8
+ def pretty_name
9
+ 'GitHub'
10
+ end
20
11
 
21
- def create_comment(client, sha, body, path, position)
22
- comment = Github::Comment.new(sha, body, path, position)
23
- comments = client.commit_comments(sha)
24
- existing = comments.any? { |c| comment == c }
25
- client.create_commit_comment(comment) unless existing
12
+ def line_number(message)
13
+ message.line.commit_line.position
26
14
  end
27
15
  end
28
16
  end
@@ -1,35 +1,12 @@
1
1
  module Pronto
2
2
  module Formatter
3
- class GithubPullRequestFormatter
4
- def format(messages, repo, patches)
5
- client = Github.new(repo)
6
- head = repo.head_commit_sha
7
-
8
- commit_messages = messages.uniq.map do |message|
9
- body = message.msg
10
- path = message.path
11
- line = patches.find_line(message.full_path, message.line.new_lineno)
12
-
13
- create_comment(client, head, body, path, line.position)
14
- end
15
-
16
- "#{commit_messages.compact.count} Pronto messages posted to GitHub"
3
+ class GithubPullRequestFormatter < PullRequestFormatter
4
+ def client_module
5
+ Github
17
6
  end
18
7
 
19
- private
20
-
21
- def create_comment(client, sha, body, path, position)
22
- comment = Github::Comment.new(sha, body, path, position)
23
- comments = client.pull_comments(sha)
24
- existing = comments.any? { |c| comment == c }
25
- client.create_pull_comment(comment) unless existing
26
- rescue Octokit::UnprocessableEntity => e
27
- # The diff output of the local git version and Github is not always
28
- # consistent, especially in areas where file renames happened, Github
29
- # tends to recognize these better, leading to messages we can't post
30
- # because their diff position is non-existent on Github.
31
- # Ignore such occasions and continue posting other messages.
32
- $stderr.puts "Failed to post: #{comment} with #{e.message}"
8
+ def pretty_name
9
+ 'GitHub'
33
10
  end
34
11
  end
35
12
  end
@@ -0,0 +1,17 @@
1
+ module Pronto
2
+ module Formatter
3
+ class GithubStatusFormatter
4
+ class Inflector
5
+ def self.underscore(camel_cased_word)
6
+ return camel_cased_word unless camel_cased_word =~ /[A-Z-]|::/
7
+ word = camel_cased_word.to_s.gsub(/::/, '/')
8
+ word.gsub!(/([A-Z\d]+)([A-Z][a-z])/, '\1_\2')
9
+ word.gsub!(/([a-z\d])([A-Z])/, '\1_\2')
10
+ word.tr!('-', '_')
11
+ word.downcase!
12
+ word
13
+ end
14
+ end
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,42 @@
1
+ module Pronto
2
+ module Formatter
3
+ class GithubStatusFormatter
4
+ class Sentence
5
+ def initialize(words)
6
+ @words = words
7
+ end
8
+
9
+ def to_s
10
+ case words.size
11
+ when 0
12
+ ''
13
+ when 1
14
+ words[0].to_s.dup
15
+ when 2
16
+ "#{words[0]}#{WORD_CONNECTORS[:two_words_connector]}#{words[1]}"
17
+ else
18
+ to_oxford_comma_sentence
19
+ end
20
+ end
21
+
22
+ private
23
+
24
+ attr_reader :words
25
+
26
+ WORD_CONNECTORS = {
27
+ words_connector: ', ',
28
+ two_words_connector: ' and ',
29
+ last_word_connector: ', and '
30
+ }.freeze
31
+
32
+ private_constant :WORD_CONNECTORS
33
+
34
+ def to_oxford_comma_sentence
35
+ "#{words[0...-1].join(WORD_CONNECTORS[:words_connector])}"\
36
+ "#{WORD_CONNECTORS[:last_word_connector]}"\
37
+ "#{words[-1]}"
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -0,0 +1,76 @@
1
+ require_relative 'sentence'
2
+ require_relative 'inflector'
3
+
4
+ module Pronto
5
+ module Formatter
6
+ class GithubStatusFormatter
7
+ class StatusBuilder
8
+ def initialize(runner, messages)
9
+ @runner = runner
10
+ @messages = messages
11
+ end
12
+
13
+ def description
14
+ desc = map_description
15
+ desc.empty? ? NO_ISSUES_DESCRIPTION : "Found #{desc}."
16
+ end
17
+
18
+ def state
19
+ failure? ? :failure : :success
20
+ end
21
+
22
+ def context
23
+ Inflector.underscore(@runner.name)
24
+ end
25
+
26
+ private
27
+
28
+ def failure?
29
+ @messages.any? { |message| failure_message?(message) }
30
+ end
31
+
32
+ def failure_message?(message)
33
+ message_state(message) == :failure
34
+ end
35
+
36
+ def message_state(message)
37
+ DEFAULT_LEVEL_TO_STATE_MAPPING[message.level]
38
+ end
39
+
40
+ def map_description
41
+ words = count_issue_types.map do |issue_type, issue_count|
42
+ pluralize(issue_count, issue_type)
43
+ end
44
+
45
+ Sentence.new(words).to_s
46
+ end
47
+
48
+ def count_issue_types
49
+ counts = @messages.each_with_object(Hash.new(0)) do |message, r|
50
+ r[message.level] += 1
51
+ end
52
+ order_by_severity(counts)
53
+ end
54
+
55
+ def order_by_severity(counts)
56
+ Hash[counts.sort_by { |k, _v| Pronto::Message::LEVELS.index(k) }]
57
+ end
58
+
59
+ def pluralize(count, word)
60
+ "#{count} #{word}#{count > 1 ? 's' : ''}"
61
+ end
62
+
63
+ DEFAULT_LEVEL_TO_STATE_MAPPING = {
64
+ info: :success,
65
+ warning: :failure,
66
+ error: :failure,
67
+ fatal: :failure
68
+ }.freeze
69
+
70
+ NO_ISSUES_DESCRIPTION = 'Coast is clear!'.freeze
71
+
72
+ private_constant :DEFAULT_LEVEL_TO_STATE_MAPPING, :NO_ISSUES_DESCRIPTION
73
+ end
74
+ end
75
+ end
76
+ end
@@ -0,0 +1,28 @@
1
+ require_relative 'github_status_formatter/status_builder'
2
+
3
+ module Pronto
4
+ module Formatter
5
+ class GithubStatusFormatter
6
+ def format(messages, repo, _)
7
+ client = Github.new(repo)
8
+ head = repo.head_commit_sha
9
+
10
+ messages_by_runner = messages.uniq.group_by(&:runner)
11
+
12
+ Runner.runners.each do |runner|
13
+ create_status(client, head, runner, messages_by_runner[runner] || [])
14
+ end
15
+ end
16
+
17
+ private
18
+
19
+ def create_status(client, sha, runner, messages)
20
+ builder = StatusBuilder.new(runner, messages)
21
+ status = Status.new(sha, builder.state,
22
+ builder.context, builder.description)
23
+
24
+ client.create_commit_status(status)
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,27 +1,16 @@
1
1
  module Pronto
2
2
  module Formatter
3
- class GitlabFormatter
4
- def format(messages, repo, _)
5
- client = Gitlab.new repo
6
-
7
- commit_messages = messages.uniq.map do |message|
8
- create_comment(client,
9
- message.commit_sha,
10
- message.msg,
11
- message.path,
12
- message.line.commit_line.new_lineno)
13
- end
14
-
15
- "#{commit_messages.compact.count} Pronto messages posted to GitLab"
3
+ class GitlabFormatter < CommitFormatter
4
+ def client_module
5
+ Gitlab
16
6
  end
17
7
 
18
- private
8
+ def pretty_name
9
+ 'GitLab'
10
+ end
19
11
 
20
- def create_comment(client, sha, note, path, line)
21
- comment = Gitlab::Comment.new(sha, note, path, line)
22
- comments = client.commit_comments(sha)
23
- existing = comments.any? { |c| comment == c }
24
- client.create_commit_comment(comment) unless existing
12
+ def line_number(message)
13
+ message.line.commit_line.new_lineno
25
14
  end
26
15
  end
27
16
  end
@@ -11,6 +11,7 @@ module Pronto
11
11
  result[:path] = message.path if message.path
12
12
  result[:line] = lineno if lineno
13
13
  result[:commit_sha] = message.commit_sha if message.commit_sha
14
+ result[:runner] = message.runner if message.runner
14
15
  result
15
16
  end.to_json
16
17
  end
@@ -0,0 +1,20 @@
1
+ module Pronto
2
+ module Formatter
3
+ class PullRequestFormatter < GitFormatter
4
+ def existing_comments(client, sha)
5
+ comments = client.pull_comments(sha)
6
+ grouped_comments(comments)
7
+ end
8
+
9
+ def line_number(message)
10
+ message.line.line.new_lineno
11
+ end
12
+
13
+ def submit_comments(client, comments)
14
+ comments.each { |comment| client.create_pull_comment(comment) }
15
+ rescue Octokit::UnprocessableEntity, HTTParty::Error => e
16
+ $stderr.puts "Failed to post: #{e.message}"
17
+ end
18
+ end
19
+ end
20
+ end
@@ -1,22 +1,44 @@
1
1
  module Pronto
2
2
  module Formatter
3
3
  class TextFormatter
4
+ include Colorizable
5
+
6
+ LOCATION_COLOR = :cyan
7
+
8
+ LEVEL_COLORS = {
9
+ info: :yellow,
10
+ warning: :magenta,
11
+ error: :red,
12
+ fatal: :red
13
+ }.freeze
14
+
4
15
  def format(messages, _, _)
5
16
  messages.map do |message|
6
- level = message.level[0].upcase
7
- "#{location(message)} #{level}: #{message.msg}"
17
+ "#{format_location(message)} #{format_level(message)}: #{message.msg}".strip
8
18
  end
9
19
  end
10
20
 
11
21
  private
12
22
 
13
- def location(message)
23
+ def format_location(message)
14
24
  line = message.line
15
25
  lineno = line.new_lineno if line
16
26
  path = message.path
17
- commit_sha = message.commit_sha[0..6] if message.commit_sha
27
+ commit_sha = message.commit_sha
28
+
29
+ if path || lineno
30
+ path = colorize(path, LOCATION_COLOR) if path
31
+ "#{path}:#{lineno}"
32
+ elsif commit_sha
33
+ colorize(commit_sha[0..6], LOCATION_COLOR)
34
+ end
35
+ end
36
+
37
+ def format_level(message)
38
+ level = message.level
39
+ color = LEVEL_COLORS.fetch(level)
18
40
 
19
- (path.nil? && lineno.nil?) ? commit_sha : "#{path}:#{lineno}"
41
+ colorize(level[0].upcase, color)
20
42
  end
21
43
  end
22
44
  end
@@ -1,16 +1,21 @@
1
1
  module Pronto
2
2
  class GemNames
3
3
  def to_a
4
- gems = Gem::Specification.find_all.select do |gem|
4
+ gems.map { |gem| gem.name.sub(/^pronto-/, '') }.uniq.sort
5
+ end
6
+
7
+ private
8
+
9
+ def gems
10
+ Gem::Specification.find_all.select do |gem|
5
11
  if gem.name =~ /^pronto-/
6
12
  true
7
13
  elsif gem.name != 'pronto'
8
- runner_path = File.join(gem.full_gem_path, "lib/pronto/#{gem.name}.rb")
14
+ runner_path = File.join(gem.full_gem_path,
15
+ "lib/pronto/#{gem.name}.rb")
9
16
  File.exist?(runner_path)
10
17
  end
11
18
  end
12
-
13
- gems.map { |gem| gem.name.sub(/^pronto-/, '') }.uniq.sort
14
19
  end
15
20
  end
16
21
  end
data/lib/pronto/github.rb CHANGED
@@ -37,6 +37,14 @@ module Pronto
37
37
  comment.path, comment.position)
38
38
  end
39
39
 
40
+ def create_commit_status(status)
41
+ sha = pull_sha || status.sha
42
+ @config.logger.log("Creating comment status on #{sha}")
43
+ client.create_status(slug,
44
+ sha,
45
+ status.state, context: status.context, description: status.description)
46
+ end
47
+
40
48
  private
41
49
 
42
50
  def slug
@@ -44,7 +52,7 @@ module Pronto
44
52
  @slug ||= begin
45
53
  @repo.remote_urls.map do |url|
46
54
  hostname = Regexp.escape(@config.github_hostname)
47
- match = /.*#{hostname}(:|\/)(?<slug>.*?)(?:\.git)?\z/.match(url)
55
+ match = %r{.*#{hostname}(:|\/)(?<slug>.*?)(?:\.git)?\z}.match(url)
48
56
  match[:slug] if match
49
57
  end.compact.first
50
58
  end
@@ -80,17 +88,5 @@ module Pronto
80
88
  def pull_requests
81
89
  @pull_requests ||= client.pull_requests(slug)
82
90
  end
83
-
84
- Comment = Struct.new(:sha, :body, :path, :position) do
85
- def ==(other)
86
- position == other.position &&
87
- path == other.path &&
88
- body == other.body
89
- end
90
-
91
- def to_s
92
- "[#{sha}] #{path}:#{position} - #{body}"
93
- end
94
- end
95
91
  end
96
92
  end
data/lib/pronto/gitlab.rb CHANGED
@@ -16,8 +16,8 @@ module Pronto
16
16
 
17
17
  def create_commit_comment(comment)
18
18
  @config.logger.log("Creating commit comment on #{comment.sha}")
19
- client.create_commit_comment(slug, comment.sha, comment.note,
20
- path: comment.path, line: comment.line,
19
+ client.create_commit_comment(slug, comment.sha, comment.body,
20
+ path: comment.path, line: comment.position,
21
21
  line_type: 'new')
22
22
  end
23
23
 
@@ -27,17 +27,21 @@ module Pronto
27
27
  return @config.gitlab_slug if @config.gitlab_slug
28
28
  @slug ||= begin
29
29
  slug = @repo.remote_urls.map do |url|
30
- match = if url =~ /^ssh:\/\//
31
- /.*#{host}(:[0-9]+)?(:|\/)(?<slug>.*).git/.match(url)
32
- else
33
- /.*#{host}(:|\/)(?<slug>.*).git/.match(url)
34
- end
30
+ match = slug_regex(url).match(url)
35
31
  match[:slug] if match
36
32
  end.compact.first
37
33
  URI.escape(slug, '/') if slug
38
34
  end
39
35
  end
40
36
 
37
+ def slug_regex(url)
38
+ if url =~ %r{^ssh:\/\/}
39
+ %r{.*#{host}(:[0-9]+)?(:|\/)(?<slug>.*).git}
40
+ else
41
+ %r{.*#{host}(:|\/)(?<slug>.*).git}
42
+ end
43
+ end
44
+
41
45
  def host
42
46
  @host ||= URI.split(gitlab_api_endpoint)[2, 2].compact.join(':')
43
47
  end
@@ -54,13 +58,5 @@ module Pronto
54
58
  def gitlab_api_endpoint
55
59
  @config.gitlab_api_endpoint
56
60
  end
57
-
58
- Comment = Struct.new(:sha, :note, :path, :line) do
59
- def ==(other)
60
- line == other.line &&
61
- path == other.path &&
62
- note == other.note
63
- end
64
- end
65
61
  end
66
62
  end
data/lib/pronto/runner.rb CHANGED
@@ -23,7 +23,7 @@ module Pronto
23
23
  end
24
24
 
25
25
  def repo_path
26
- ruby_patches.first.repo.path
26
+ @patches.first.repo.path
27
27
  end
28
28
 
29
29
  private
@@ -0,0 +1,14 @@
1
+ module Pronto
2
+ Status = Struct.new(:sha, :state, :context, :description) do
3
+ def ==(other)
4
+ sha == other.sha &&
5
+ state == other.state &&
6
+ context == other.context &&
7
+ description == other.description
8
+ end
9
+
10
+ def to_s
11
+ "[#{sha}] #{context} #{state} - #{description}"
12
+ end
13
+ end
14
+ end
@@ -1,6 +1,6 @@
1
1
  module Pronto
2
2
  module Version
3
- STRING = '0.6.0'.freeze
3
+ STRING = '0.7.0'.freeze
4
4
 
5
5
  MSG = '%s (running on %s %s %s)'.freeze
6
6
 
data/lib/pronto.rb CHANGED
@@ -2,6 +2,8 @@ require 'rugged'
2
2
  require 'octokit'
3
3
  require 'gitlab'
4
4
  require 'forwardable'
5
+ require 'httparty'
6
+ require 'rainbow'
5
7
 
6
8
  require 'pronto/gem_names'
7
9
 
@@ -9,6 +11,8 @@ require 'pronto/logger'
9
11
  require 'pronto/config_file'
10
12
  require 'pronto/config'
11
13
 
14
+ require 'pronto/clients/bitbucket_client'
15
+
12
16
  require 'pronto/git/repository'
13
17
  require 'pronto/git/patches'
14
18
  require 'pronto/git/patch'
@@ -16,16 +20,26 @@ require 'pronto/git/line'
16
20
 
17
21
  require 'pronto/plugin'
18
22
  require 'pronto/message'
23
+ require 'pronto/comment'
24
+ require 'pronto/status'
19
25
  require 'pronto/runner'
20
26
  require 'pronto/runners'
21
27
  require 'pronto/github'
22
28
  require 'pronto/gitlab'
29
+ require 'pronto/bitbucket'
23
30
 
31
+ require 'pronto/formatter/colorizable'
24
32
  require 'pronto/formatter/text_formatter'
25
33
  require 'pronto/formatter/json_formatter'
34
+ require 'pronto/formatter/git_formatter'
35
+ require 'pronto/formatter/commit_formatter'
36
+ require 'pronto/formatter/pull_request_formatter'
26
37
  require 'pronto/formatter/github_formatter'
38
+ require 'pronto/formatter/github_status_formatter'
27
39
  require 'pronto/formatter/github_pull_request_formatter'
28
40
  require 'pronto/formatter/gitlab_formatter'
41
+ require 'pronto/formatter/bitbucket_formatter'
42
+ require 'pronto/formatter/bitbucket_pull_request_formatter'
29
43
  require 'pronto/formatter/checkstyle_formatter'
30
44
  require 'pronto/formatter/null_formatter'
31
45
  require 'pronto/formatter/formatter'
data/pronto.gemspec CHANGED
@@ -44,10 +44,14 @@ Gem::Specification.new do |s|
44
44
  s.add_runtime_dependency('thor', '~> 0.19.0')
45
45
  s.add_runtime_dependency('octokit', '~> 4.3', '>= 4.1.0')
46
46
  s.add_runtime_dependency('gitlab', '~> 3.6', '>= 3.4.0')
47
+ s.add_runtime_dependency('httparty', '~> 0.13.7')
48
+ s.add_runtime_dependency('rainbow', '~> 2.1')
47
49
  s.add_development_dependency('rake', '~> 11.0')
48
50
  s.add_development_dependency('rspec', '~> 3.4')
49
51
  s.add_development_dependency('rspec-its', '~> 1.2')
50
52
  s.add_development_dependency('rspec-expectations', '~> 3.4')
51
53
  s.add_development_dependency('bundler', '~> 1.3')
52
54
  s.add_development_dependency('simplecov', '~> 0.11')
55
+ s.add_development_dependency('rubocop', '~> 0.39.0')
56
+ s.add_development_dependency('pronto-rubocop', '~> 0.6.2')
53
57
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pronto
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mindaugas Mozūras
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-13 00:00:00.000000000 Z
11
+ date: 2016-08-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -84,6 +84,34 @@ dependencies:
84
84
  - - ">="
85
85
  - !ruby/object:Gem::Version
86
86
  version: 3.4.0
87
+ - !ruby/object:Gem::Dependency
88
+ name: httparty
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: 0.13.7
94
+ type: :runtime
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: 0.13.7
101
+ - !ruby/object:Gem::Dependency
102
+ name: rainbow
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '2.1'
108
+ type: :runtime
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: '2.1'
87
115
  - !ruby/object:Gem::Dependency
88
116
  name: rake
89
117
  requirement: !ruby/object:Gem::Requirement
@@ -168,6 +196,34 @@ dependencies:
168
196
  - - "~>"
169
197
  - !ruby/object:Gem::Version
170
198
  version: '0.11'
199
+ - !ruby/object:Gem::Dependency
200
+ name: rubocop
201
+ requirement: !ruby/object:Gem::Requirement
202
+ requirements:
203
+ - - "~>"
204
+ - !ruby/object:Gem::Version
205
+ version: 0.39.0
206
+ type: :development
207
+ prerelease: false
208
+ version_requirements: !ruby/object:Gem::Requirement
209
+ requirements:
210
+ - - "~>"
211
+ - !ruby/object:Gem::Version
212
+ version: 0.39.0
213
+ - !ruby/object:Gem::Dependency
214
+ name: pronto-rubocop
215
+ requirement: !ruby/object:Gem::Requirement
216
+ requirements:
217
+ - - "~>"
218
+ - !ruby/object:Gem::Version
219
+ version: 0.6.2
220
+ type: :development
221
+ prerelease: false
222
+ version_requirements: !ruby/object:Gem::Requirement
223
+ requirements:
224
+ - - "~>"
225
+ - !ruby/object:Gem::Version
226
+ version: 0.6.2
171
227
  description: |2
172
228
  Pronto runs analysis quickly by checking only the relevant changes. Created
173
229
  to be used on pull requests, but suited for other scenarios as well. Perfect
@@ -187,16 +243,29 @@ files:
187
243
  - README.md
188
244
  - bin/pronto
189
245
  - lib/pronto.rb
246
+ - lib/pronto/bitbucket.rb
190
247
  - lib/pronto/cli.rb
248
+ - lib/pronto/clients/bitbucket_client.rb
249
+ - lib/pronto/comment.rb
191
250
  - lib/pronto/config.rb
192
251
  - lib/pronto/config_file.rb
252
+ - lib/pronto/formatter/bitbucket_formatter.rb
253
+ - lib/pronto/formatter/bitbucket_pull_request_formatter.rb
193
254
  - lib/pronto/formatter/checkstyle_formatter.rb
255
+ - lib/pronto/formatter/colorizable.rb
256
+ - lib/pronto/formatter/commit_formatter.rb
194
257
  - lib/pronto/formatter/formatter.rb
258
+ - lib/pronto/formatter/git_formatter.rb
195
259
  - lib/pronto/formatter/github_formatter.rb
196
260
  - lib/pronto/formatter/github_pull_request_formatter.rb
261
+ - lib/pronto/formatter/github_status_formatter.rb
262
+ - lib/pronto/formatter/github_status_formatter/inflector.rb
263
+ - lib/pronto/formatter/github_status_formatter/sentence.rb
264
+ - lib/pronto/formatter/github_status_formatter/status_builder.rb
197
265
  - lib/pronto/formatter/gitlab_formatter.rb
198
266
  - lib/pronto/formatter/json_formatter.rb
199
267
  - lib/pronto/formatter/null_formatter.rb
268
+ - lib/pronto/formatter/pull_request_formatter.rb
200
269
  - lib/pronto/formatter/text_formatter.rb
201
270
  - lib/pronto/gem_names.rb
202
271
  - lib/pronto/git/line.rb
@@ -211,6 +280,7 @@ files:
211
280
  - lib/pronto/rake_task/travis_pull_request.rb
212
281
  - lib/pronto/runner.rb
213
282
  - lib/pronto/runners.rb
283
+ - lib/pronto/status.rb
214
284
  - lib/pronto/version.rb
215
285
  - pronto.gemspec
216
286
  homepage: http://github.com/mmozuras/pronto