pronto 0.8.0 → 0.8.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: a5a612afb137e615ee5e2ff77940bef61836f285
4
- data.tar.gz: 0028f06bc680ba757b55872dadb633a38dae08e0
3
+ metadata.gz: aaeb87265191eb83028cbb2472b1420ee19377d9
4
+ data.tar.gz: 19c3d10ff59f8a50f1d179023579ccfda4a4284c
5
5
  SHA512:
6
- metadata.gz: 8232ab1382ee1447884bf1061e58d28f8a62100c59743ac5a6a8264404c94b61966e8478b0b11b2da999eaab21a136233fc44cbc1354d4403dc6301094d88915
7
- data.tar.gz: 8a4a1196d482efceedb8c64edced6b56fa8977fe07ce9511cd4cf6374863dd5fdfa2e4f5992d56cc93eeb6a03f669182c67de03418cffbe6774e914a773e62ad
6
+ metadata.gz: b10a90fd0bd0d9289bb1989b91e61eb1d0ed0026860bd4056729247fddea2bea9631ca645492e40f67434be185afff16f579888410ce00cebe14e2891cdc5f7e
7
+ data.tar.gz: bdfb4bc6140b8d65b7dfddbe70b663410adb9476eec31d566256811b2b128ac1f0864790298ce7ebe941f22ff34c542a6b21407c458d1b41536d489a7055c317
data/CHANGELOG.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.8.1
4
+
5
+ ### Changes
6
+
7
+ * Add a default GitLab API endpoint: https://gitlab.com/api/v3
8
+
9
+ ### Bugs fixed
10
+
11
+ * [#125](https://github.com/mmozuras/pronto/issues/125): check whether message has a line before posting to GitLab.
12
+ * Post on commit comments on correct commit: use message.commit_sha to set comment.sha instead of head.
13
+ * [#201](https://github.com/mmozuras/pronto/issues/201): allow messages without line positions or paths.
14
+
3
15
  ## 0.8.0
4
16
 
5
17
  ### New features
data/README.md CHANGED
@@ -137,14 +137,14 @@ on GitLab commits using `GitlabFormatter`.
137
137
 
138
138
  Set the `PRONTO_GITLAB_API_ENDPOINT` environment variable or value in `.pronto.yml` to
139
139
  your API endpoint URL. If you are using Gitlab.com's hosted service your
140
- endpoint will be `https://gitlab.com/api/v3`.
140
+ endpoint will be set by default.
141
141
  Set the `PRONTO_GITLAB_API_PRIVATE_TOKEN` environment variable or value in `.pronto.yml
142
142
  to your Gitlab private token which you can find in your account settings.
143
143
 
144
144
  Then just run it:
145
145
 
146
146
  ```sh
147
- $ PRONTO_GITLAB_API_ENDPOINT="https://gitlab.com/api/v3" PRONTO_GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
147
+ $ PRONTO_GITLAB_API_PRIVATE_TOKEN=token pronto run -f gitlab -c origin/master
148
148
  ```
149
149
 
150
150
  ### Bitbucket Integration
@@ -214,7 +214,10 @@ Currently available:
214
214
 
215
215
  * [pronto-brakeman](https://github.com/mmozuras/pronto-brakeman)
216
216
  * [pronto-coffeelint](https://github.com/siebertm/pronto-coffeelint)
217
+ * [pronto-clippy](https://github.com/hauleth/pronto-clippy)
217
218
  * [pronto-credo](https://github.com/carakan/pronto-credo)
219
+ * [pronto-dialyzer](https://github.com/iurifq/pronto-dialyzer)
220
+ * [pronto-dogma](https://github.com/iurifq/pronto-dogma)
218
221
  * [pronto-eslint](https://github.com/mmozuras/pronto-eslint) (uses [eslintrb](https://github.com/zendesk/eslintrb))
219
222
  * [pronto-eslint_npm](https://github.com/doits/pronto-eslint_npm) (uses eslint installed from npm)
220
223
  * [pronto-fasterer](https://github.com/mmozuras/pronto-fasterer)
@@ -235,10 +238,12 @@ Currently available:
235
238
  * [pronto-scss](https://github.com/mmozuras/pronto-scss)
236
239
  * [pronto-shellcheck](https://github.com/pclalv/pronto-shellcheck)
237
240
  * [pronto-slim](https://github.com/nysthee/pronto-slim)
241
+ * [pronto-slim_lint](https://github.com/ibrahima/pronto-slim_lint)
238
242
  * [pronto-spell](https://github.com/mmozuras/pronto-spell)
239
243
  * [pronto-stylelint](https://github.com/kevinjalbert/pronto-stylelint)
240
244
  * [pronto-swiftlint](https://github.com/ajanauskas/pronto-swiftlint)
241
245
  * [pronto-tailor](https://github.com/ajanauskas/pronto-tailor)
246
+ * [pronto-textlint](https://github.com/seikichi/pronto-textlint)
242
247
 
243
248
  ## Articles
244
249
 
@@ -261,4 +266,4 @@ Make a Pull Request to add something you wrote or found useful.
261
266
 
262
267
  ## Copyright
263
268
 
264
- Copyright (c) 2013-2016 Mindaugas Mozūras. See [LICENSE](LICENSE) for further details.
269
+ Copyright (c) 2013-2017 Mindaugas Mozūras. See [LICENSE](LICENSE) for further details.
@@ -30,9 +30,13 @@ module Pronto
30
30
  end
31
31
 
32
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)
33
+ if comment.path && comment.position
34
+ @config.logger.log("Creating pull request comment on #{pull_id}")
35
+ client.create_pull_comment(slug, pull_id, comment.body,
36
+ comment.path, comment.position)
37
+ else
38
+ create_commit_comment(comment)
39
+ end
36
40
  end
37
41
 
38
42
  private
@@ -14,7 +14,7 @@ module Pronto
14
14
  'gitlab' => {
15
15
  'slug' => nil,
16
16
  'api_private_token' => nil,
17
- 'api_endpoint' => nil
17
+ 'api_endpoint' => 'https://gitlab.com/api/v3'
18
18
  },
19
19
  'bitbucket' => {
20
20
  'slug' => nil,
@@ -10,7 +10,7 @@ module Pronto
10
10
  end
11
11
 
12
12
  def line_number(message, _)
13
- message.line.new_lineno
13
+ message.line.new_lineno if message.line
14
14
  end
15
15
  end
16
16
  end
@@ -8,6 +8,10 @@ module Pronto
8
8
  def pretty_name
9
9
  'BitBucket'
10
10
  end
11
+
12
+ def line_number(message, _)
13
+ message.line.line.new_lineno if message.line
14
+ end
11
15
  end
12
16
  end
13
17
  end
@@ -1,15 +1,12 @@
1
1
  module Pronto
2
2
  module Formatter
3
3
  class CommitFormatter < GitFormatter
4
- def existing_comments(client, sha)
5
- comments = client.commit_comments(sha)
4
+ def existing_comments(messages, client, repo)
5
+ shas = messages.map(&:commit_sha)
6
+ comments = shas.flat_map { |sha| client.commit_comments(sha) }
6
7
  grouped_comments(comments)
7
8
  end
8
9
 
9
- def line_number(message, _)
10
- message.line.new_lineno
11
- end
12
-
13
10
  def submit_comments(client, comments)
14
11
  comments.each { |comment| client.create_commit_comment(comment) }
15
12
  rescue Octokit::UnprocessableEntity, HTTParty::Error => e
@@ -3,9 +3,8 @@ module Pronto
3
3
  class GitFormatter
4
4
  def format(messages, repo, patches)
5
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)
6
+ existing = existing_comments(messages, client, repo)
7
+ comments = new_comments(messages, patches)
9
8
  additions = remove_duplicate_comments(existing, comments)
10
9
  submit_comments(client, additions)
11
10
 
@@ -63,18 +62,19 @@ module Pronto
63
62
  comments.map { |comment| "- #{comment.body}" }.join("\n")
64
63
  end
65
64
 
66
- def new_comment(message, patches, sha)
65
+ def new_comment(message, patches)
66
+ config.logger.log("Creating a comment from message: #{message.inspect}")
67
+ sha = message.commit_sha
67
68
  body = message.msg
68
69
  path = message.path
69
- lineno = line_number(message, patches)
70
-
70
+ lineno = line_number(message, patches) if message.line
71
71
  Comment.new(sha, body, path, lineno)
72
72
  end
73
73
 
74
- def new_comments(messages, patches, sha)
74
+ def new_comments(messages, patches)
75
75
  comments = messages
76
76
  .uniq
77
- .map { |message| new_comment(message, patches, sha) }
77
+ .map { |message| new_comment(message, patches) }
78
78
  grouped_comments(comments)
79
79
  end
80
80
 
@@ -10,7 +10,7 @@ module Pronto
10
10
  end
11
11
 
12
12
  def line_number(message, _)
13
- message.line.commit_line.new_lineno
13
+ message.line.commit_line.new_lineno if message.line
14
14
  end
15
15
  end
16
16
  end
@@ -1,15 +1,12 @@
1
1
  module Pronto
2
2
  module Formatter
3
3
  class PullRequestFormatter < GitFormatter
4
- def existing_comments(client, sha)
4
+ def existing_comments(messages, client, repo)
5
+ sha = repo.head_commit_sha
5
6
  comments = client.pull_comments(sha)
6
7
  grouped_comments(comments)
7
8
  end
8
9
 
9
- def line_number(message, _)
10
- message.line.line.new_lineno
11
- end
12
-
13
10
  def submit_comments(client, comments)
14
11
  comments.each { |comment| client.create_pull_comment(comment) }
15
12
  rescue Octokit::UnprocessableEntity, HTTParty::Error => e
data/lib/pronto/github.rb CHANGED
@@ -31,10 +31,14 @@ module Pronto
31
31
  end
32
32
 
33
33
  def create_pull_comment(comment)
34
- @config.logger.log("Creating pull request comment on #{pull_id}")
35
- client.create_pull_comment(slug, pull_id, comment.body,
36
- pull_sha || comment.sha,
37
- comment.path, comment.position)
34
+ if comment.path && comment.position
35
+ @config.logger.log("Creating pull request comment on #{pull_id}")
36
+ client.create_pull_comment(slug, pull_id, comment.body,
37
+ pull_sha || comment.sha,
38
+ comment.path, comment.position)
39
+ else
40
+ create_commit_comment(comment)
41
+ end
38
42
  end
39
43
 
40
44
  def create_commit_status(status)
@@ -1,6 +1,6 @@
1
1
  module Pronto
2
2
  module Version
3
- STRING = '0.8.0'.freeze
3
+ STRING = '0.8.1'.freeze
4
4
 
5
5
  MSG = '%s (running on %s %s %s)'.freeze
6
6
 
data/pronto.gemspec CHANGED
@@ -52,6 +52,6 @@ Gem::Specification.new do |s|
52
52
  s.add_development_dependency('rspec-expectations', '~> 3.4')
53
53
  s.add_development_dependency('bundler', '~> 1.3')
54
54
  s.add_development_dependency('simplecov', '~> 0.11')
55
- s.add_development_dependency('rubocop', '~> 0.42')
56
- s.add_development_dependency('pronto-rubocop', '~> 0.7.0')
55
+ s.add_development_dependency('rubocop', '~> 0.47')
56
+ s.add_development_dependency('pronto-rubocop', '~> 0.8.0')
57
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.8.0
4
+ version: 0.8.1
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: 2017-02-12 00:00:00.000000000 Z
11
+ date: 2017-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rugged
@@ -208,28 +208,28 @@ dependencies:
208
208
  requirements:
209
209
  - - "~>"
210
210
  - !ruby/object:Gem::Version
211
- version: '0.42'
211
+ version: '0.47'
212
212
  type: :development
213
213
  prerelease: false
214
214
  version_requirements: !ruby/object:Gem::Requirement
215
215
  requirements:
216
216
  - - "~>"
217
217
  - !ruby/object:Gem::Version
218
- version: '0.42'
218
+ version: '0.47'
219
219
  - !ruby/object:Gem::Dependency
220
220
  name: pronto-rubocop
221
221
  requirement: !ruby/object:Gem::Requirement
222
222
  requirements:
223
223
  - - "~>"
224
224
  - !ruby/object:Gem::Version
225
- version: 0.7.0
225
+ version: 0.8.0
226
226
  type: :development
227
227
  prerelease: false
228
228
  version_requirements: !ruby/object:Gem::Requirement
229
229
  requirements:
230
230
  - - "~>"
231
231
  - !ruby/object:Gem::Version
232
- version: 0.7.0
232
+ version: 0.8.0
233
233
  description: |2
234
234
  Pronto runs analysis quickly by checking only the relevant changes. Created
235
235
  to be used on pull requests, but suited for other scenarios as well. Perfect