gergich 0.1.10 → 0.1.11

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: 4a83e06009221c6f023ad9abb756eb7056d73c41
4
- data.tar.gz: ddaf87be3594c80b6f4fad98f989d02cf5980e3b
3
+ metadata.gz: c3fa3adc0194c17f11a88ffd258d1384608caa83
4
+ data.tar.gz: ac80e9921090135a33095168c0f17bef37c3b80c
5
5
  SHA512:
6
- metadata.gz: d4858b253d58eb97c5f8c8c41eb89edddd100061fbcf80609a7c9f61c7cda2cd7a61537352c15a036e7ad4ac33714a134f4e8d2c8700e74976d9bfd2fab72a3f
7
- data.tar.gz: bfb624112eaf912a283836a46be4768eb7898b6042494b5e9f230c9f4f18e482f5c1e5aa744622f3c364df702e273a5c0c3a36e8734e8a2b4a6fa29dce7facd9
6
+ metadata.gz: 054fe528157dc92c224291821b897afcdb6995bd7dec16a567e19609a677dd4afa5f666a3b24195da80b4574c4a1f0b7b16e1d5da1c4cfd37cd0659b0e4393b3
7
+ data.tar.gz: 25c021aac67fce6ed1693dcc4e5fa95f110783fc056dcdbf6bd0702325f76c079feeefba77f9b7192a7a672da5668b9ac8b8a6577363bb4442ff7a8ef636568f
@@ -14,21 +14,32 @@ module Gergich
14
14
  # bin/gergich:47:8: C: Prefer double-quoted strings
15
15
  # if ENV['DEBUG']
16
16
  # ^^^^^^^
17
- pattern = /
18
- ^([^:\n]+):(\d+):\d+:\s(\w):\s(.*?)\n
19
- ([^\n]+\n
20
- [^^\n]*\^+[^^\n]*\n)?
21
- /mx
17
+ first_line_pattern = /^([^:\n]+):(\d+):\d+:\s(\w):\s/
22
18
 
23
- output.scan(pattern).map { |file, line, severity, error, context|
24
- context = "\n\n" + context.gsub(/^/, " ") if context
25
- {
19
+ parts = output.split(first_line_pattern)
20
+ parts.shift
21
+ messages = []
22
+
23
+ until parts.empty?
24
+ file = parts.shift
25
+ line = parts.shift
26
+ severity = parts.shift
27
+ message = parts.shift
28
+ # if there is code context at the end, separate it and indent it
29
+ # so that gerrit preserves formatting
30
+ if /(?<context>[^\n]+\n *\^+\n)/m =~ message
31
+ message.sub!(context, "\n" + context.gsub(/^/, " "))
32
+ end
33
+
34
+ messages << {
26
35
  path: file,
27
36
  position: line.to_i,
28
- message: "[rubocop] #{error}#{context}",
37
+ message: "[rubocop] #{message}",
29
38
  severity: SEVERITY_MAP[severity]
30
39
  }
31
- }.compact
40
+ end
41
+
42
+ messages
32
43
  end
33
44
  end
34
45
  end
@@ -3,9 +3,17 @@ require_relative "../../support/capture_shared_examples"
3
3
  RSpec.describe Gergich::Capture::RubocopCapture do
4
4
  let(:output) do
5
5
  <<-OUTPUT
6
+ Offenses:
7
+
6
8
  bin/gergich:47:8: C: Prefer double-quoted strings
7
9
  if ENV['DEBUG']
8
10
  ^^^^^^^
11
+ foo/bar/baz.rb:1:2: W: no context for this one :shrug:
12
+ lib/gergich.rb:10:9: E: this is a terrible name
13
+
14
+ seriously, what were you thinking?
15
+ def foo
16
+ ^^^
9
17
  lib/gergich.rb:22:55: W: Line is too long. [55/54]
10
18
  def initialize(ref = "HEAD", revision_number = nil)
11
19
  ^^
@@ -19,6 +27,25 @@ lib/gergich.rb:22:55: W: Line is too long. [55/54]
19
27
  message: "[rubocop] Prefer double-quoted strings\n\n if ENV['DEBUG']\n ^^^^^^^\n",
20
28
  severity: "info"
21
29
  },
30
+ {
31
+ path: "foo/bar/baz.rb",
32
+ position: 1,
33
+ message: "[rubocop] no context for this one :shrug:\n",
34
+ severity: "warn"
35
+ },
36
+ {
37
+ path: "lib/gergich.rb",
38
+ position: 10,
39
+ message: <<-OUTPUT,
40
+ [rubocop] this is a terrible name
41
+
42
+ seriously, what were you thinking?
43
+
44
+ def foo
45
+ ^^^
46
+ OUTPUT
47
+ severity: "error"
48
+ },
22
49
  {
23
50
  path: "lib/gergich.rb",
24
51
  position: 22,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gergich
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.10
4
+ version: 0.1.11
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jon Jensen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-13 00:00:00.000000000 Z
11
+ date: 2017-02-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
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
- version: '0'
54
+ version: '12.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rspec
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -70,30 +70,30 @@ dependencies:
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'
75
+ version: 0.47.1
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'
82
+ version: 0.47.1
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'
89
+ version: 0.13.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'
96
+ version: 0.13.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
@@ -155,9 +155,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
155
  version: '0'
156
156
  requirements: []
157
157
  rubyforge_project:
158
- rubygems_version: 2.2.5
158
+ rubygems_version: 2.5.1
159
159
  signing_key:
160
160
  specification_version: 4
161
161
  summary: Command-line tool for adding Gerrit comments
162
162
  test_files: []
163
- has_rdoc: