gergich 0.2.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (34) hide show
  1. checksums.yaml +5 -5
  2. data/bin/check_coverage +2 -1
  3. data/bin/gergich +1 -0
  4. data/bin/master_bouncer +1 -1
  5. data/bin/run_tests.sh +0 -5
  6. data/lib/gergich.rb +17 -23
  7. data/lib/gergich/capture.rb +6 -2
  8. data/lib/gergich/capture/androidlint_capture.rb +4 -0
  9. data/lib/gergich/capture/brakeman_capture.rb +4 -2
  10. data/lib/gergich/capture/eslint_capture.rb +2 -0
  11. data/lib/gergich/capture/flake8_capture.rb +2 -0
  12. data/lib/gergich/capture/i18nliner_capture.rb +2 -0
  13. data/lib/gergich/capture/rubocop_capture.rb +2 -0
  14. data/lib/gergich/capture/shellcheck_capture.rb +2 -0
  15. data/lib/gergich/capture/stylelint_capture.rb +6 -4
  16. data/lib/gergich/capture/swiftlint_capture.rb +4 -0
  17. data/lib/gergich/cli.rb +4 -2
  18. data/lib/gergich/cli/gergich.rb +119 -118
  19. data/lib/gergich/cli/master_bouncer.rb +16 -14
  20. data/spec/gergich/capture/androidlint_capture_spec.rb +14 -9
  21. data/spec/gergich/capture/brakeman_capture_spec.rb +43 -41
  22. data/spec/gergich/capture/custom_capture_spec.rb +4 -2
  23. data/spec/gergich/capture/eslint_capture_spec.rb +6 -4
  24. data/spec/gergich/capture/flake8_capture_spec.rb +4 -2
  25. data/spec/gergich/capture/i18nliner_capture_spec.rb +6 -4
  26. data/spec/gergich/capture/rubocop_capture_spec.rb +24 -22
  27. data/spec/gergich/capture/shellcheck_capture_spec.rb +45 -43
  28. data/spec/gergich/capture/stylelint_capture_spec.rb +9 -7
  29. data/spec/gergich/capture/swiftlint_capture_spec.rb +7 -4
  30. data/spec/gergich/capture_spec.rb +6 -4
  31. data/spec/gergich_spec.rb +43 -4
  32. data/spec/spec_helper.rb +2 -0
  33. data/spec/support/capture_shared_examples.rb +2 -0
  34. metadata +35 -35
@@ -1,15 +1,17 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../../support/capture_shared_examples"
2
4
 
3
5
  RSpec.describe Gergich::Capture::StylelintCapture do
4
6
  let(:output) do
5
- <<-OUTPUT
6
- app/stylesheets/base/_print.scss
7
- 3:17 ✖ Unexpected invalid hex color "#owiehfi" color-no-invalid-hex
8
- 3:17 ⚠ Expected "#owiehfi" to be "#OWIEHFI" color-hex-case
7
+ <<~OUTPUT
8
+ app/stylesheets/base/_print.scss
9
+ 3:17 ✖ Unexpected invalid hex color "#owiehfi" color-no-invalid-hex
10
+ 3:17 ⚠ Expected "#owiehfi" to be "#OWIEHFI" color-hex-case
9
11
 
10
- app/stylesheets/base/_variables.scss
11
- 2:15 ✖ Unexpected invalid hex color "#2D3B4" color-no-invalid-hex
12
- 30:15 ⚠ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
12
+ app/stylesheets/base/_variables.scss
13
+ 2:15 ✖ Unexpected invalid hex color "#2D3B4" color-no-invalid-hex
14
+ 30:15 ⚠ Expected "#2d3b4a" to be "#2D3B4A" color-hex-case
13
15
  OUTPUT
14
16
  end
15
17
  let(:comments) do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../../support/capture_shared_examples"
2
4
 
3
5
  RSpec.describe Gergich::Capture::SwiftlintCapture do
@@ -5,11 +7,12 @@ RSpec.describe Gergich::Capture::SwiftlintCapture do
5
7
  let(:colon_violation) { "Colon Violation: Colons should be next to the identifier when specifying a type. (colon)" }
6
8
  let(:line_length_violation) { "Line Length Violation: Line should be 100 characters or less: currently 129 characters (line_length)" }
7
9
  let(:force_cast_violation) { "Force Cast Violation: Force casts should be avoided. (force_cast)" }
10
+ # rubocop:enable Metrics/LineLength
8
11
  let(:output) do
9
- <<-OUTPUT
10
- /path/to/My.swift:13:22: warning: #{colon_violation}
11
- /path/to/Fail.swift:76: warning: #{line_length_violation}
12
- /path/to/Cast.swift:15:9: error: #{force_cast_violation}
12
+ <<~OUTPUT
13
+ /path/to/My.swift:13:22: warning: #{colon_violation}
14
+ /path/to/Fail.swift:76: warning: #{line_length_violation}
15
+ /path/to/Cast.swift:15:9: error: #{force_cast_violation}
13
16
  OUTPUT
14
17
  end
15
18
  let(:comments) do
@@ -1,13 +1,15 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../../lib/gergich/capture"
2
4
 
3
5
  RSpec.describe Gergich::Capture do
4
6
  let!(:draft) { double }
5
7
 
6
8
  let :output do
7
- <<-OUTPUT
8
- #{path}
9
- 4:21 error Missing semicolon semi
10
- OUTPUT
9
+ <<~OUTPUT
10
+ #{path}
11
+ 4:21 error Missing semicolon semi
12
+ OUTPUT
11
13
  end
12
14
 
13
15
  before do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  RSpec.describe Gergich::API do
2
4
  context "bad change-id" do
3
5
  let(:result) { double(:result, body: "Not Found: 1234") }
@@ -99,6 +101,11 @@ RSpec.describe Gergich::Draft do
99
101
  expect(subject).to eq("foo.rb" => [{ line: 1, message: "[INFO] fix foo" }])
100
102
  end
101
103
 
104
+ it "strips whitespace from filename" do
105
+ draft.add_comment " foo.rb\n", 1, "fix foo", "info"
106
+ expect(subject).to eq("foo.rb" => [{ line: 1, message: "[INFO] fix foo" }])
107
+ end
108
+
102
109
  it "includes COMMIT_MSG comments" do
103
110
  draft.add_comment "/COMMIT_MSG", 1, "fix commit", "info"
104
111
  expect(subject).to eq("/COMMIT_MSG" => [{ line: 1, message: "[INFO] fix commit" }])
@@ -210,16 +217,18 @@ RSpec.describe Gergich::Draft do
210
217
  end
211
218
 
212
219
  RSpec.describe Gergich::Review do
220
+ let(:change_id) { "test" }
213
221
  let!(:commit) do
214
222
  double(
215
223
  :commit,
224
+ change_id: change_id,
216
225
  files: [
217
226
  "foo.rb",
218
227
  "bar/baz.lol"
219
228
  ],
220
- revision_id: "test",
221
- revision_number: 1,
222
- change_id: "test"
229
+ info: {},
230
+ revision_id: change_id,
231
+ revision_number: 1
223
232
  )
224
233
  end
225
234
  let!(:draft) do
@@ -231,6 +240,37 @@ RSpec.describe Gergich::Review do
231
240
  draft.reset!
232
241
  end
233
242
 
243
+ describe "#status" do
244
+ subject { review.status }
245
+
246
+ context "nothing to publish" do
247
+ before :each do
248
+ allow(review).to receive(:anything_to_publish?).and_return(false)
249
+ end
250
+ it { expect { subject }.to output(include("Nothing to publish")).to_stdout }
251
+ end
252
+
253
+ context "something to publish" do
254
+ before :each do
255
+ allow(review).to receive(:anything_to_publish?).and_return(true)
256
+ allow(review).to receive(:already_commented?).and_return(false)
257
+ allow(review).to receive(:generate_payload).and_return({})
258
+ allow(review).to receive(:my_messages).and_return([])
259
+ end
260
+ it {
261
+ expected_outputs = [
262
+ "Project:",
263
+ "Branch:",
264
+ "Revision:",
265
+ "ChangeId: #{change_id}",
266
+ "Files:"
267
+ # There's more... but this is good
268
+ ]
269
+ expect { subject }.to output(include(*expected_outputs)).to_stdout
270
+ }
271
+ end
272
+ end
273
+
234
274
  describe "#publish!" do
235
275
  context "nothing to publish" do
236
276
  before :each do
@@ -253,7 +293,6 @@ RSpec.describe Gergich::Review do
253
293
 
254
294
  it "publishes via the api" do
255
295
  expect(Gergich::API).to receive(:post)
256
- allow(review).to receive(:change_name?).and_return(false)
257
296
  review.publish!
258
297
  end
259
298
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require "simplecov" if ENV["COVERAGE"]
2
4
  require_relative "../lib/gergich"
3
5
 
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require_relative "../../lib/gergich/capture"
2
4
 
3
5
  RSpec.shared_examples_for "a captor" do
metadata CHANGED
@@ -1,99 +1,99 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gergich
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-11-17 00:00:00.000000000 Z
11
+ date: 2019-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: sqlite3
14
+ name: httparty
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.3'
19
+ version: '0.16'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - ~>
24
+ - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '1.3'
26
+ version: '0.16'
27
27
  - !ruby/object:Gem::Dependency
28
- name: httparty
28
+ name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - ~>
31
+ - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '0.6'
33
+ version: '1.3'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - ~>
38
+ - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '0.6'
40
+ version: '1.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: '12.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ~>
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
54
  version: '12.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: '3.5'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: '3.5'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
- version: 0.47.1
75
+ version: '0.49'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - ~>
80
+ - - "~>"
81
81
  - !ruby/object:Gem::Version
82
- version: 0.47.1
82
+ version: '0.49'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: simplecov
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
- version: 0.13.0
89
+ version: 0.16.0
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - ~>
94
+ - - "~>"
95
95
  - !ruby/object:Gem::Version
96
- version: 0.13.0
96
+ version: 0.16.0
97
97
  description: Gergich is a little command-line tool for wiring up linters to Gerrit
98
98
  so you can get nice inline comments right on the review
99
99
  email: jon@instructure.com
@@ -105,6 +105,12 @@ extra_rdoc_files: []
105
105
  files:
106
106
  - LICENSE
107
107
  - README.md
108
+ - bin/check_coverage
109
+ - bin/gergich
110
+ - bin/master_bouncer
111
+ - bin/run_tests.sh
112
+ - lib/gergich.rb
113
+ - lib/gergich/capture.rb
108
114
  - lib/gergich/capture/androidlint_capture.rb
109
115
  - lib/gergich/capture/brakeman_capture.rb
110
116
  - lib/gergich/capture/eslint_capture.rb
@@ -114,11 +120,9 @@ files:
114
120
  - lib/gergich/capture/shellcheck_capture.rb
115
121
  - lib/gergich/capture/stylelint_capture.rb
116
122
  - lib/gergich/capture/swiftlint_capture.rb
117
- - lib/gergich/capture.rb
123
+ - lib/gergich/cli.rb
118
124
  - lib/gergich/cli/gergich.rb
119
125
  - lib/gergich/cli/master_bouncer.rb
120
- - lib/gergich/cli.rb
121
- - lib/gergich.rb
122
126
  - spec/gergich/capture/androidlint_capture_spec.rb
123
127
  - spec/gergich/capture/brakeman_capture_spec.rb
124
128
  - spec/gergich/capture/custom_capture_spec.rb
@@ -133,10 +137,6 @@ files:
133
137
  - spec/gergich_spec.rb
134
138
  - spec/spec_helper.rb
135
139
  - spec/support/capture_shared_examples.rb
136
- - bin/check_coverage
137
- - bin/gergich
138
- - bin/master_bouncer
139
- - bin/run_tests.sh
140
140
  homepage: https://github.com/instructure/gergich
141
141
  licenses:
142
142
  - MIT
@@ -147,17 +147,17 @@ require_paths:
147
147
  - lib
148
148
  required_ruby_version: !ruby/object:Gem::Requirement
149
149
  requirements:
150
- - - '>='
150
+ - - ">="
151
151
  - !ruby/object:Gem::Version
152
- version: 1.9.3
152
+ version: 2.4.0
153
153
  required_rubygems_version: !ruby/object:Gem::Requirement
154
154
  requirements:
155
- - - '>='
155
+ - - ">="
156
156
  - !ruby/object:Gem::Version
157
157
  version: '0'
158
158
  requirements: []
159
159
  rubyforge_project:
160
- rubygems_version: 2.0.14.1
160
+ rubygems_version: 2.7.6.2
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Command-line tool for adding Gerrit comments