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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0f0688286ddfbfdcc686368378288bfb25914eb4
4
- data.tar.gz: 3343039cccc137106652aed7061be6ecd6096995
3
+ metadata.gz: 5ce69d5f3767311808974507c74439d759b31bf2
4
+ data.tar.gz: 93b1e7492252470f04c3d4c97bdd4ae75d1c7f83
5
5
  SHA512:
6
- metadata.gz: 10294cd73ad93b2e289aa7f68b5bc08bed49fb3b6aaa30d6912ad1b61fd0e7f2dc550a335e0487da9149582a29bbb14754f9e7e28d21f4ec5fe88e0d86a6e308
7
- data.tar.gz: 29b71a28a0ca12b710cbd00bb232fa9100d516d16c4d0a8883783c0476016beb8cb04c7d8e5784e7881edcae5ca32e7a90b202ea9b15f0066c56a4643b797882
6
+ metadata.gz: 0661d29207244a62c42efa87a6fb9f6690ab5aaf93119ee343fcf0c569d1b331c2b5ea5232f39cef12cc1ef51b347616b2298ccc9993a936a92d68c7bb8b9a26
7
+ data.tar.gz: e79ebdcd74b911f630e480acb97c73fe6b6770b45ff8d4321db087c43d0685238fa57f99c050829ec670ebb6330689ae9d4a2351388eedaf463bcfc7a25ece3c
@@ -228,7 +228,7 @@ module Gergich
228
228
  "error" => -2
229
229
  }.freeze
230
230
 
231
- attr_reader :db, :commit
231
+ attr_reader :commit
232
232
 
233
233
  def initialize(commit = Commit.new)
234
234
  @commit = commit
@@ -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
- pattern = %r{ # Example:
6
- ^([^:\n]+):(\d+):\d+:\s(.*?)\n # bin/gergich:47:8: C: Prefer double-quoted strings
7
- ([^\n]+\n # if ENV['DEBUG']
8
- [^^\n]*\^+[^^\n]*\n)? # ^^^^^^^
9
- }mx
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: "error" }
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] C: Prefer double-quoted strings\n\n if ENV['DEBUG']\n ^^^^^^^\n",
26
- "error"
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.0
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-07 00:00:00.000000000 Z
11
+ date: 2016-04-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3