stash_pull_request_commenter 0.0.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2807845857d80b6789d5af785da2fa78ef77d0b7
|
4
|
+
data.tar.gz: b4c70be5400e2674f2c3aef90914627c677d5c52
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9a72bd6404e5022af44e59c480d330c3e6d3fd46e0813f8cd77b2c9afba122f357fd88c4cdcc4e305d1e5256c05848b7c2bb718bb8f15cf2b74976f78caa035
|
7
|
+
data.tar.gz: a642ef3477c845fc2a452986c3d82080bee07be452605603adc32ada66865ca62d19f6b9b6bcf10d835ed69197a19b2264171b52490f8a74127199d01719633e
|
data/README.md
CHANGED
@@ -4,7 +4,9 @@
|
|
4
4
|
|
5
5
|
Comment on added lines in a Stash pull request.
|
6
6
|
Take comments from static checkers reports.
|
7
|
-
(Currently
|
7
|
+
(Currently supports RuboCop and CoffeeLint.)
|
8
|
+
|
9
|
+
Inspired by [Hound](https://houndci.com).
|
8
10
|
|
9
11
|
## Installation
|
10
12
|
|
@@ -12,4 +14,6 @@ Take comments from static checkers reports.
|
|
12
14
|
|
13
15
|
## Usage
|
14
16
|
|
17
|
+
rubocop -f json -o rubocop.json
|
18
|
+
coffeelint --reporter raw app/assets/javascripts > coffeelint_report.json
|
15
19
|
stash-comment <project> <repository> <pull_request_id>
|
data/bin/stash-comment
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
require 'docopt'
|
4
4
|
require 'stash_pull_request_commenter/inputs/rubocop_json'
|
5
|
+
require 'stash_pull_request_commenter/inputs/coffeelint_raw'
|
5
6
|
require 'logger'
|
6
7
|
require 'stash/config'
|
7
8
|
require 'stash/server'
|
@@ -14,15 +15,16 @@ begin
|
|
14
15
|
repository = args['<repository>']
|
15
16
|
pull_request_id = args['<pull_request_id>']
|
16
17
|
|
17
|
-
input = Inputs::RubocopJson.new
|
18
|
-
|
19
18
|
config = Stash::Config.new
|
20
19
|
server = Stash::Server.new(config.host, config.user, config.password, Logger.new(STDOUT))
|
21
20
|
repository = server.repository(project, repository)
|
22
21
|
pull_request = repository.pull_request(pull_request_id)
|
23
22
|
|
24
|
-
|
25
|
-
|
23
|
+
[Inputs::RubocopJson, Inputs::CoffeeLintRaw].each do |input_class|
|
24
|
+
input = input_class.new
|
25
|
+
input.comments.each do |comment|
|
26
|
+
pull_request.add_comment(comment.file, comment.line, comment.text)
|
27
|
+
end
|
26
28
|
end
|
27
29
|
rescue Docopt::Exit => e
|
28
30
|
puts e.message
|
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'json'
|
2
|
+
require 'comment'
|
3
|
+
|
4
|
+
module Inputs
|
5
|
+
class CoffeeLintRaw
|
6
|
+
attr_accessor :filename
|
7
|
+
|
8
|
+
def initialize(filename = 'coffeelint_report.json')
|
9
|
+
self.filename = filename
|
10
|
+
|
11
|
+
fail "#{filename} does not exist" unless File.exist?(filename)
|
12
|
+
end
|
13
|
+
|
14
|
+
def comments
|
15
|
+
report.map do |file, problems|
|
16
|
+
problems.map do |problem|
|
17
|
+
Comment.new(
|
18
|
+
file: file,
|
19
|
+
line: problem['lineNumber'],
|
20
|
+
text: "(#{problem['level']}) #{problem['message']}"
|
21
|
+
)
|
22
|
+
end
|
23
|
+
end.flatten
|
24
|
+
end
|
25
|
+
|
26
|
+
private
|
27
|
+
|
28
|
+
def report
|
29
|
+
JSON.parse(File.read(filename))
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: stash_pull_request_commenter
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Vassilevsky
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-01-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: docopt
|
@@ -89,6 +89,7 @@ files:
|
|
89
89
|
- lib/stash/repository.rb
|
90
90
|
- lib/stash/server.rb
|
91
91
|
- lib/stash_pull_request_commenter.rb
|
92
|
+
- lib/stash_pull_request_commenter/inputs/coffeelint_raw.rb
|
92
93
|
- lib/stash_pull_request_commenter/inputs/rubocop_json.rb
|
93
94
|
- lib/stash_pull_request_commenter/version.rb
|
94
95
|
- stash_pull_request_commenter.gemspec
|
@@ -112,8 +113,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
113
|
version: '0'
|
113
114
|
requirements: []
|
114
115
|
rubyforge_project:
|
115
|
-
rubygems_version: 2.
|
116
|
+
rubygems_version: 2.2.2
|
116
117
|
signing_key:
|
117
118
|
specification_version: 4
|
118
119
|
summary: Comment on pull requests in Atlassian Stash repositories
|
119
120
|
test_files: []
|
121
|
+
has_rdoc:
|