gergich 0.1.0 → 0.1.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 +4 -4
- data/lib/gergich.rb +1 -1
- data/lib/gergich/capture/rubocop_capture.rb +19 -7
- data/spec/gergich/capture_spec.rb +12 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5ce69d5f3767311808974507c74439d759b31bf2
|
4
|
+
data.tar.gz: 93b1e7492252470f04c3d4c97bdd4ae75d1c7f83
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0661d29207244a62c42efa87a6fb9f6690ab5aaf93119ee343fcf0c569d1b331c2b5ea5232f39cef12cc1ef51b347616b2298ccc9993a936a92d68c7bb8b9a26
|
7
|
+
data.tar.gz: e79ebdcd74b911f630e480acb97c73fe6b6770b45ff8d4321db087c43d0685238fa57f99c050829ec670ebb6330689ae9d4a2351388eedaf463bcfc7a25ece3c
|
data/lib/gergich.rb
CHANGED
@@ -1,17 +1,29 @@
|
|
1
1
|
module Gergich
|
2
2
|
module Capture
|
3
3
|
class RubocopCapture < BaseCapture
|
4
|
+
SEVERITY_MAP = {
|
5
|
+
"R" => "info", # refactor
|
6
|
+
"C" => "info", # convention
|
7
|
+
"W" => "warn", # warning
|
8
|
+
"E" => "error", # error
|
9
|
+
"F" => "error" # fatal
|
10
|
+
}.freeze
|
11
|
+
|
4
12
|
def run(output)
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
13
|
+
# Example:
|
14
|
+
# bin/gergich:47:8: C: Prefer double-quoted strings
|
15
|
+
# if ENV['DEBUG']
|
16
|
+
# ^^^^^^^
|
17
|
+
pattern = /
|
18
|
+
^([^:\n]+):(\d+):\d+:\s(\w):\s(.*?)\n
|
19
|
+
([^\n]+\n
|
20
|
+
[^^\n]*\^+[^^\n]*\n)?
|
21
|
+
/mx
|
10
22
|
|
11
|
-
output.scan(pattern).map { |file, line, error, context|
|
23
|
+
output.scan(pattern).map { |file, line, severity, error, context|
|
12
24
|
context = "\n\n" + context.gsub(/^/, " ") if context
|
13
25
|
{ path: file, message: "[rubocop] #{error}#{context}",
|
14
|
-
position: line.to_i, severity:
|
26
|
+
position: line.to_i, severity: SEVERITY_MAP[severity] }
|
15
27
|
}.compact
|
16
28
|
end
|
17
29
|
end
|
@@ -18,13 +18,23 @@ RSpec.describe Gergich::Capture do
|
|
18
18
|
bin/gergich:47:8: C: Prefer double-quoted strings
|
19
19
|
if ENV['DEBUG']
|
20
20
|
^^^^^^^
|
21
|
+
lib/gergich.rb:22:55: W: Line is too long. [55/54]
|
22
|
+
def initialize(ref = "HEAD", revision_number = nil)
|
23
|
+
^^
|
21
24
|
OUTPUT
|
22
25
|
expect(draft).to receive(:add_comment).with(
|
23
26
|
"bin/gergich",
|
24
27
|
47,
|
25
|
-
"[rubocop]
|
26
|
-
"
|
28
|
+
"[rubocop] Prefer double-quoted strings\n\n if ENV['DEBUG']\n ^^^^^^^\n",
|
29
|
+
"info"
|
27
30
|
)
|
31
|
+
expect(draft).to receive(:add_comment)
|
32
|
+
.with("lib/gergich.rb", 22, <<-OUTPUT, "warn")
|
33
|
+
[rubocop] Line is too long. [55/54]
|
34
|
+
|
35
|
+
def initialize(ref = "HEAD", revision_number = nil)
|
36
|
+
^^
|
37
|
+
OUTPUT
|
28
38
|
described_class.run("rubocop", "false")
|
29
39
|
end
|
30
40
|
end
|
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.
|
4
|
+
version: 0.1.1
|
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-04-
|
11
|
+
date: 2016-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: sqlite3
|