gergich 0.1.17 → 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: 07fde95880fbf7f7195ce8f7ca43cdfd47005d8c
4
- data.tar.gz: 8c6f1be4ab8bb1e4ea565da45087cfa6a85d1f11
3
+ metadata.gz: 9da4c870097f2129eaa052c2b41b840da0cc096f
4
+ data.tar.gz: 4d3102825f2858c5e63cade4fb751d29f9c2a73b
5
5
  SHA512:
6
- metadata.gz: 976fbe4fe6a0dff8babf88f8994206a31ce2cceef84ed06ffc828a0efc77da806272aebb07e4ee514f6341bd79f2eed63bb388c2dea98418b0feb2390605f2e2
7
- data.tar.gz: f2b3b77e61633b7eb00b44a11679e77dcd98d6851d190d105879888d4b8c4832b97d0ce104882530a283ac7e1fb54efc13bcbe2f895fe1e6b369e7fb4f3907b8
6
+ metadata.gz: 011eb695e557e2c00074731bd9521d606ba13f0fa18d0fccd71095b7db8c1cc58e215eeeabee1fd80ac34075111621d3ece3fc85ccf0d2ccb5620686400ea1c3
7
+ data.tar.gz: b616b994af49ce7c2c714d3d40a7e8eee6cb613aede43e31d7e4cb106844d1acd538d02f71dfedab83aa0c0a5843ea02427603f9adff3552bdfc850c96821015
data/README.md CHANGED
@@ -107,6 +107,7 @@ do `gergich comment` calls so you don't have to wire it up yourself.
107
107
  * `i18nliner`
108
108
  * `flake8`
109
109
  * `stylelint`
110
+ * `shellcheck` - shellcheck json output
110
111
  * `custom:<path>:<class_name>` - file path and ruby class_name of a custom
111
112
  formatter.
112
113
 
@@ -140,6 +141,8 @@ gergich capture eslint eslint
140
141
 
141
142
  gergich capture i18nliner "rake i18nliner:check"
142
143
 
144
+ gergich capture shellcheck "shellcheck --format json build.sh"
145
+
143
146
  gergich capture custom:./gergich/xss:Gergich::XSS "node script/xsslint"
144
147
 
145
148
  docker-compose run --rm web eslint | gergich capture eslint -
@@ -0,0 +1,27 @@
1
+ require "json"
2
+
3
+ module Gergich
4
+ module Capture
5
+ class ShellcheckCapture < BaseCapture
6
+ # https://github.com/koalaman/shellcheck/blob/6c068e7d/ShellCheck/Formatter/Format.hs#L41-L47
7
+ SEVERITY_MAP = {
8
+ "style" => "info",
9
+ "info" => "info",
10
+ "warning" => "warn",
11
+ "error" => "error"
12
+ }.freeze
13
+
14
+ def run(output)
15
+ JSON.parse(output).map do |warning|
16
+ severity = warning.fetch("level")
17
+ {
18
+ path: warning.fetch("file"),
19
+ position: warning.fetch("line"),
20
+ message: warning.fetch("message"),
21
+ severity: SEVERITY_MAP.fetch(severity)
22
+ }
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,81 @@
1
+ require_relative "../../support/capture_shared_examples"
2
+
3
+ RSpec.describe Gergich::Capture::ShellcheckCapture do
4
+ let(:output) do
5
+ <<-'OUTPUT'
6
+ [
7
+ {
8
+ "file": "bin/sync-translations.sh",
9
+ "line": 23,
10
+ "endLine": 23,
11
+ "column": 21,
12
+ "endColumn": 21,
13
+ "level": "style",
14
+ "code": 2006,
15
+ "message": "Use $(..) instead of legacy `..`."
16
+ },
17
+ {
18
+ "file": "bin/sync-translations.sh",
19
+ "line": 23,
20
+ "endLine": 23,
21
+ "column": 43,
22
+ "endColumn": 43,
23
+ "level": "warning",
24
+ "code": 2046,
25
+ "message": "Quote this to prevent word splitting."
26
+ },
27
+ {
28
+ "file": "bin/sync-translations.sh",
29
+ "line": 32,
30
+ "endLine": 32,
31
+ "column": 62,
32
+ "endColumn": 62,
33
+ "level": "info",
34
+ "code": 2086,
35
+ "message": "Double quote to prevent globbing and word splitting."
36
+ },
37
+ {
38
+ "file": "fail.sh",
39
+ "line": 3,
40
+ "endLine": 3,
41
+ "column": 12,
42
+ "endColumn": 12,
43
+ "level": "error",
44
+ "code": 1101,
45
+ "message": "Delete trailing spaces after \\ to break line (or use quotes for literal space)."
46
+ }
47
+ ]
48
+ OUTPUT
49
+ end
50
+
51
+ let(:comments) do
52
+ [
53
+ {
54
+ path: "bin/sync-translations.sh",
55
+ position: 23,
56
+ message: "Use $(..) instead of legacy `..`.",
57
+ severity: "info"
58
+ },
59
+ {
60
+ path: "bin/sync-translations.sh",
61
+ position: 23,
62
+ message: "Quote this to prevent word splitting.",
63
+ severity: "warn"
64
+ },
65
+ {
66
+ path: "bin/sync-translations.sh",
67
+ position: 32,
68
+ message: "Double quote to prevent globbing and word splitting.",
69
+ severity: "info"
70
+ },
71
+ {
72
+ path: "fail.sh",
73
+ position: 3,
74
+ message: "Delete trailing spaces after \\ to break line (or use quotes for literal space).",
75
+ severity: "error"
76
+ }
77
+ ]
78
+ end
79
+
80
+ it_behaves_like "a captor"
81
+ 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.17
4
+ version: 0.2.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-09-08 00:00:00.000000000 Z
11
+ date: 2017-10-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sqlite3
@@ -117,6 +117,7 @@ files:
117
117
  - lib/gergich/capture/flake8_capture.rb
118
118
  - lib/gergich/capture/i18nliner_capture.rb
119
119
  - lib/gergich/capture/rubocop_capture.rb
120
+ - lib/gergich/capture/shellcheck_capture.rb
120
121
  - lib/gergich/capture/stylelint_capture.rb
121
122
  - lib/gergich/capture/swiftlint_capture.rb
122
123
  - lib/gergich/cli.rb
@@ -129,6 +130,7 @@ files:
129
130
  - spec/gergich/capture/flake8_capture_spec.rb
130
131
  - spec/gergich/capture/i18nliner_capture_spec.rb
131
132
  - spec/gergich/capture/rubocop_capture_spec.rb
133
+ - spec/gergich/capture/shellcheck_capture_spec.rb
132
134
  - spec/gergich/capture/stylelint_capture_spec.rb
133
135
  - spec/gergich/capture/swiftlint_capture_spec.rb
134
136
  - spec/gergich/capture_spec.rb
@@ -155,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
155
157
  version: '0'
156
158
  requirements: []
157
159
  rubyforge_project:
158
- rubygems_version: 2.6.11
160
+ rubygems_version: 2.6.14
159
161
  signing_key:
160
162
  specification_version: 4
161
163
  summary: Command-line tool for adding Gerrit comments