goodcheck 1.7.0 → 1.7.1

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
- SHA1:
3
- metadata.gz: 941c25a76e1e8d433dabf11a05e9881251666ea6
4
- data.tar.gz: af4c6b7a6f0c7de3318efd540a9031127a6eab22
2
+ SHA256:
3
+ metadata.gz: d857a24ca9b2ca50fe761dad0fa03fbeab34a7bf2c2d34eb6cdbeb349f31f53f
4
+ data.tar.gz: d50e1f2b04239b282eaa1a89eb8965f68de2ff681b1ba814d6695f0491cd497f
5
5
  SHA512:
6
- metadata.gz: 30d772081204a902869971bded0ba16b779500d3cad31a0857b75a10979c0cacbe7ce5be45b6b4c0520bd587649394bb54cf0873ea18dccba1896cedcdd20a5a
7
- data.tar.gz: a3020566b156d0a23f3ca4b1a2ac590d39182bf47597dcc6fb89bcd861198821f671967925fcf37e0e56f01c39a388e45d9237181f2d2bb4a9b1467083c2d156
6
+ metadata.gz: f64e084cb6b268d3d3febf63a37b811830b3ef77318e73e0f049fb4fbae2c8bec97b8e339562042b2e8029f1035bb20a86ba03086366ac8caaa57bc418521061
7
+ data.tar.gz: 7b8c73bd327db455afd2a61c74f0b4b6589e4c71c4c0205f60a71f3be37666f826832b608f4f0b0016fa6cdd905a62a90ab08814aa490d5e21de44a9543eee00
data/CHANGELOG.md CHANGED
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## master
4
4
 
5
+ ## 1.7.1 (2019-05-29)
6
+
7
+ * Fix test command error handling
8
+ * Update strong_json
9
+
5
10
  ## 1.7.0 (2019-05-28)
6
11
 
7
12
  * Support a rule without `pattern` [#52](https://github.com/sider/goodcheck/pull/52)
data/goodcheck.gemspec CHANGED
@@ -28,7 +28,7 @@ Gem::Specification.new do |spec|
28
28
  spec.add_development_dependency "minitest-reporters", "~> 1.3.6"
29
29
 
30
30
  spec.add_runtime_dependency "activesupport", ">= 4.0", "< 6.0"
31
- spec.add_runtime_dependency "strong_json", "~> 1.0.0"
31
+ spec.add_runtime_dependency "strong_json", "~> 1.0.1"
32
32
  spec.add_runtime_dependency "rainbow", "~> 3.0.0"
33
33
  spec.add_runtime_dependency "httpclient", "~> 2.8.3"
34
34
  end
@@ -23,36 +23,24 @@ module Goodcheck
23
23
  end
24
24
 
25
25
  def run
26
- issue_reported = false
26
+ handle_config_errors(stderr) do
27
+ issue_reported = false
27
28
 
28
- reporter.analysis do
29
- load_config!(force_download: force_download, cache_path: cache_dir_path)
30
- each_check do |buffer, rule|
31
- reporter.rule(rule) do
32
- analyzer = Analyzer.new(rule: rule, buffer: buffer)
33
- analyzer.scan do |issue|
34
- issue_reported = true
35
- reporter.issue(issue)
29
+ reporter.analysis do
30
+ load_config!(force_download: force_download, cache_path: cache_dir_path)
31
+ each_check do |buffer, rule|
32
+ reporter.rule(rule) do
33
+ analyzer = Analyzer.new(rule: rule, buffer: buffer)
34
+ analyzer.scan do |issue|
35
+ issue_reported = true
36
+ reporter.issue(issue)
37
+ end
36
38
  end
37
39
  end
38
40
  end
39
- end
40
41
 
41
- issue_reported ? 2 : 0
42
- rescue Psych::Exception => exn
43
- stderr.puts "Unexpected error happens while loading YAML file: #{exn.inspect}"
44
- exn.backtrace.each do |trace_loc|
45
- stderr.puts " #{trace_loc}"
42
+ issue_reported ? 2 : 0
46
43
  end
47
- 1
48
- rescue StrongJSON::Type::TypeError, StrongJSON::Type::UnexpectedAttributeError => exn
49
- stderr.puts "Invalid config: #{exn.message}"
50
- stderr.puts StrongJSON::ErrorReporter.new(path: exn.path).to_s
51
-
52
- 1
53
- rescue Errno::ENOENT => exn
54
- stderr.puts "#{exn}"
55
- 1
56
44
  end
57
45
 
58
46
  def each_check
@@ -9,6 +9,26 @@ module Goodcheck
9
9
  loader = ConfigLoader.new(path: config_path, content: content, stderr: stderr, import_loader: import_loader)
10
10
  @config = loader.load
11
11
  end
12
+
13
+ def handle_config_errors(stderr)
14
+ begin
15
+ yield
16
+
17
+ rescue Psych::Exception => exn
18
+ stderr.puts "Unexpected error happens while loading YAML file: #{exn.inspect}"
19
+ exn.backtrace.each do |trace_loc|
20
+ stderr.puts " #{trace_loc}"
21
+ end
22
+ 1
23
+ rescue StrongJSON::Type::TypeError, StrongJSON::Type::UnexpectedAttributeError => exn
24
+ stderr.puts "Invalid config: #{exn.message}"
25
+ stderr.puts StrongJSON::ErrorReporter.new(path: exn.path).to_s
26
+ 1
27
+ rescue Errno::ENOENT => exn
28
+ stderr.puts "#{exn}"
29
+ 1
30
+ end
31
+ end
12
32
  end
13
33
  end
14
34
  end
@@ -19,12 +19,14 @@ module Goodcheck
19
19
  end
20
20
 
21
21
  def run
22
- load_config!(cache_path: cache_dir_path, force_download: force_download)
22
+ handle_config_errors stderr do
23
+ load_config!(cache_path: cache_dir_path, force_download: force_download)
23
24
 
24
- validate_rule_uniqueness or return 1
25
- validate_rules or return 1
25
+ validate_rule_uniqueness or return 1
26
+ validate_rules or return 1
26
27
 
27
- 0
28
+ 0
29
+ end
28
30
  end
29
31
 
30
32
  def validate_rule_uniqueness
@@ -1,3 +1,3 @@
1
1
  module Goodcheck
2
- VERSION = "1.7.0"
2
+ VERSION = "1.7.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: goodcheck
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.7.0
4
+ version: 1.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Soutaro Matsumoto
@@ -92,14 +92,14 @@ dependencies:
92
92
  requirements:
93
93
  - - "~>"
94
94
  - !ruby/object:Gem::Version
95
- version: 1.0.0
95
+ version: 1.0.1
96
96
  type: :runtime
97
97
  prerelease: false
98
98
  version_requirements: !ruby/object:Gem::Requirement
99
99
  requirements:
100
100
  - - "~>"
101
101
  - !ruby/object:Gem::Version
102
- version: 1.0.0
102
+ version: 1.0.1
103
103
  - !ruby/object:Gem::Dependency
104
104
  name: rainbow
105
105
  requirement: !ruby/object:Gem::Requirement
@@ -195,8 +195,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
195
  - !ruby/object:Gem::Version
196
196
  version: '0'
197
197
  requirements: []
198
- rubyforge_project:
199
- rubygems_version: 2.6.14.1
198
+ rubygems_version: 3.0.3
200
199
  signing_key:
201
200
  specification_version: 4
202
201
  summary: Regexp based customizable linter