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 +5 -5
- data/CHANGELOG.md +5 -0
- data/goodcheck.gemspec +1 -1
- data/lib/goodcheck/commands/check.rb +12 -24
- data/lib/goodcheck/commands/config_loading.rb +20 -0
- data/lib/goodcheck/commands/test.rb +6 -4
- data/lib/goodcheck/version.rb +1 -1
- metadata +4 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d857a24ca9b2ca50fe761dad0fa03fbeab34a7bf2c2d34eb6cdbeb349f31f53f
|
4
|
+
data.tar.gz: d50e1f2b04239b282eaa1a89eb8965f68de2ff681b1ba814d6695f0491cd497f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f64e084cb6b268d3d3febf63a37b811830b3ef77318e73e0f049fb4fbae2c8bec97b8e339562042b2e8029f1035bb20a86ba03086366ac8caaa57bc418521061
|
7
|
+
data.tar.gz: 7b8c73bd327db455afd2a61c74f0b4b6589e4c71c4c0205f60a71f3be37666f826832b608f4f0b0016fa6cdd905a62a90ab08814aa490d5e21de44a9543eee00
|
data/CHANGELOG.md
CHANGED
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.
|
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
|
-
|
26
|
+
handle_config_errors(stderr) do
|
27
|
+
issue_reported = false
|
27
28
|
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
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
|
-
|
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
|
-
|
22
|
+
handle_config_errors stderr do
|
23
|
+
load_config!(cache_path: cache_dir_path, force_download: force_download)
|
23
24
|
|
24
|
-
|
25
|
-
|
25
|
+
validate_rule_uniqueness or return 1
|
26
|
+
validate_rules or return 1
|
26
27
|
|
27
|
-
|
28
|
+
0
|
29
|
+
end
|
28
30
|
end
|
29
31
|
|
30
32
|
def validate_rule_uniqueness
|
data/lib/goodcheck/version.rb
CHANGED
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.
|
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.
|
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.
|
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
|
-
|
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
|