codeclimate 0.2.4 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cc/analyzer/engine_registry.rb +5 -0
- data/lib/cc/cli/analyze.rb +4 -2
- data/lib/cc/cli/command.rb +4 -0
- data/lib/cc/cli/console.rb +0 -2
- data/lib/cc/cli/engines/engine_command.rb +3 -3
- data/lib/cc/cli/engines/install.rb +2 -8
- data/lib/cc/cli/engines/list.rb +1 -1
- data/lib/cc/cli/init.rb +1 -1
- data/lib/cc/cli/validate_config.rb +26 -5
- 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: 5d22f3f348dc789674ada7a4873bcde294a7b278
|
4
|
+
data.tar.gz: 65f5b34f666a35b6fcf9e69968e7597c3ae0318a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6fbe2daeb6327989f76ef44b242633107fcad116433fdf21f58cdc0d338e8a77c5b4c4adbe8736cc53b0965d813f56edf11e5bc5391eec48e6d8e2a472bade75
|
7
|
+
data.tar.gz: 517de74c052b220eab45ebd736623da94d5523b223deebb0a8108c8320df0543960c74c75529f816f2ee9ce05c4cd5dd18588ee7850a3141f5e4f85a49a5f3e1
|
data/lib/cc/cli/analyze.rb
CHANGED
@@ -12,8 +12,10 @@ module CC
|
|
12
12
|
def run
|
13
13
|
require_codeclimate_yml
|
14
14
|
|
15
|
-
|
16
|
-
|
15
|
+
Dir.chdir(ENV['FILESYSTEM_DIR']) do
|
16
|
+
runner = EnginesRunner.new(registry, formatter, source_dir, config)
|
17
|
+
runner.run
|
18
|
+
end
|
17
19
|
|
18
20
|
rescue EnginesRunner::InvalidEngineName => ex
|
19
21
|
fatal(ex.message)
|
data/lib/cc/cli/command.rb
CHANGED
data/lib/cc/cli/console.rb
CHANGED
@@ -33,11 +33,11 @@ module CC
|
|
33
33
|
end
|
34
34
|
|
35
35
|
def engine_exists?
|
36
|
-
|
36
|
+
engine_registry.exists?(engine_name)
|
37
37
|
end
|
38
38
|
|
39
|
-
def
|
40
|
-
|
39
|
+
def engine_registry_list
|
40
|
+
engine_registry.list
|
41
41
|
end
|
42
42
|
end
|
43
43
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require "cc/analyzer"
|
2
|
-
|
3
1
|
module CC
|
4
2
|
module CLI
|
5
3
|
module Engines
|
@@ -17,7 +15,7 @@ module CC
|
|
17
15
|
|
18
16
|
def pull_docker_images
|
19
17
|
engine_names.each do |name|
|
20
|
-
if
|
18
|
+
if engine_registry.exists?(name)
|
21
19
|
image = engine_image(name)
|
22
20
|
pull_engine_image(image)
|
23
21
|
else
|
@@ -30,12 +28,8 @@ module CC
|
|
30
28
|
@engine_names ||= parsed_yaml.engine_names
|
31
29
|
end
|
32
30
|
|
33
|
-
def engine_exists?(engine_name)
|
34
|
-
engines_registry_list.keys.include?(engine_name)
|
35
|
-
end
|
36
|
-
|
37
31
|
def engine_image(engine_name)
|
38
|
-
|
32
|
+
engine_registry_list[engine_name]["image"]
|
39
33
|
end
|
40
34
|
|
41
35
|
def pull_engine_image(engine_image)
|
data/lib/cc/cli/engines/list.rb
CHANGED
@@ -4,7 +4,7 @@ module CC
|
|
4
4
|
class List < EngineCommand
|
5
5
|
def run
|
6
6
|
say "Available engines:"
|
7
|
-
|
7
|
+
engine_registry_list.sort_by { |name, _| name }.each do |name, attributes|
|
8
8
|
say "- #{name}: #{attributes["description"]}"
|
9
9
|
end
|
10
10
|
end
|
data/lib/cc/cli/init.rb
CHANGED
@@ -52,7 +52,7 @@ module CC
|
|
52
52
|
end
|
53
53
|
|
54
54
|
def eligible_engines
|
55
|
-
|
55
|
+
engine_registry.list.each_with_object({}) do |(engine_name, config), result|
|
56
56
|
if engine_eligible?(config)
|
57
57
|
result[engine_name] = config
|
58
58
|
end
|
@@ -6,6 +6,8 @@ module CC
|
|
6
6
|
include CC::Analyzer
|
7
7
|
include CC::Yaml
|
8
8
|
|
9
|
+
VALID_CONFIG_MESSAGE = "No errors or warnings found in .codeclimate.yml file.".freeze
|
10
|
+
|
9
11
|
def run
|
10
12
|
require_codeclimate_yml
|
11
13
|
verify_yaml
|
@@ -17,12 +19,12 @@ module CC
|
|
17
19
|
if any_issues?
|
18
20
|
display_issues
|
19
21
|
else
|
20
|
-
puts colorize(
|
22
|
+
puts colorize(VALID_CONFIG_MESSAGE, :green)
|
21
23
|
end
|
22
24
|
end
|
23
25
|
|
24
26
|
def any_issues?
|
25
|
-
parsed_yaml.errors? || parsed_yaml.nested_warnings.any? || parsed_yaml.warnings?
|
27
|
+
parsed_yaml.errors? || parsed_yaml.nested_warnings.any? || parsed_yaml.warnings? || invalid_engines.any?
|
26
28
|
end
|
27
29
|
|
28
30
|
def yaml_content
|
@@ -48,28 +50,47 @@ module CC
|
|
48
50
|
def display_issues
|
49
51
|
display_errors
|
50
52
|
display_warnings
|
53
|
+
display_invalid_engines
|
51
54
|
display_nested_warnings
|
52
55
|
end
|
53
56
|
|
54
57
|
def display_errors
|
55
58
|
errors.each do |error|
|
56
|
-
puts colorize("ERROR: "
|
59
|
+
puts colorize("ERROR: #{error}", :red)
|
57
60
|
end
|
58
61
|
end
|
59
62
|
|
60
63
|
def display_nested_warnings
|
61
64
|
nested_warnings.each do |nested_warning|
|
62
65
|
if nested_warning[0][0]
|
63
|
-
puts colorize("WARNING in
|
66
|
+
puts colorize("WARNING in #{nested_warning[0][0]}: #{nested_warning[1]}", :red)
|
64
67
|
end
|
65
68
|
end
|
66
69
|
end
|
67
70
|
|
68
71
|
def display_warnings
|
69
72
|
warnings.each do |warning|
|
70
|
-
puts colorize("WARNING: "
|
73
|
+
puts colorize("WARNING: #{warning}", :red)
|
71
74
|
end
|
72
75
|
end
|
76
|
+
|
77
|
+
def display_invalid_engines
|
78
|
+
invalid_engines.each do |engine_name|
|
79
|
+
puts colorize("WARNING: unknown engine <#{engine_name}>", :red)
|
80
|
+
end
|
81
|
+
end
|
82
|
+
|
83
|
+
def invalid_engines
|
84
|
+
@invalid_engines ||= engine_names.reject { |engine_name| engine_registry.exists? engine_name }
|
85
|
+
end
|
86
|
+
|
87
|
+
def engine_names
|
88
|
+
@engine_names ||= engines.keys
|
89
|
+
end
|
90
|
+
|
91
|
+
def engines
|
92
|
+
@engines ||= parsed_yaml.engines || {}
|
93
|
+
end
|
73
94
|
end
|
74
95
|
end
|
75
96
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Climate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-08-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|