codeclimate 0.59.0 → 0.59.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/config/engines.yml +0 -1
- data/lib/cc/analyzer/engines_config_builder.rb +1 -4
- data/lib/cc/cli.rb +1 -0
- data/lib/cc/cli/config_generator.rb +0 -12
- data/lib/cc/cli/init.rb +0 -16
- data/lib/cc/cli/prepare/quality.rb +64 -0
- metadata +16 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 47373962a6c4b9694dd53ff15e5763eea2c4bf3e
|
4
|
+
data.tar.gz: 78c315602436913d641dbc942394dd73a6e03fe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4659c57c484a151e32740689d8d6e4fa4ff1cb18ce63f7c928445461a5a6950554b4f85b24cdf88b320627ccbe5e44cbbd1d0833fbc362fa50f17754c4ff1428
|
7
|
+
data.tar.gz: 3533af922af47f089a30f0cc4116af36973da0b1a3b099170443a33034264cd3dceab07c86503c22d65d582d034bddb4d3aa7660d33db733af361b59e43b38f2
|
data/config/engines.yml
CHANGED
@@ -12,10 +12,7 @@ module CC
|
|
12
12
|
# handling.
|
13
13
|
def fetch(name, channel)
|
14
14
|
metadata = self[name]
|
15
|
-
metadata.merge(
|
16
|
-
"image" => metadata["channels"][channel.to_s],
|
17
|
-
"code_climate_check" => metadata.fetch("code_climate_check", false),
|
18
|
-
)
|
15
|
+
metadata.merge("image" => metadata["channels"][channel.to_s])
|
19
16
|
end
|
20
17
|
end
|
21
18
|
|
data/lib/cc/cli.rb
CHANGED
@@ -37,14 +37,6 @@ module CC
|
|
37
37
|
end
|
38
38
|
end
|
39
39
|
|
40
|
-
def codeclimate_checks
|
41
|
-
@codeclimate_checks ||= engine_registry.list.each_with_object({}) do |(name, config), result|
|
42
|
-
if code_climate_check?(config)
|
43
|
-
result[name] = config
|
44
|
-
end
|
45
|
-
end
|
46
|
-
end
|
47
|
-
|
48
40
|
def errors
|
49
41
|
[]
|
50
42
|
end
|
@@ -74,10 +66,6 @@ module CC
|
|
74
66
|
files_exist?(engine)
|
75
67
|
end
|
76
68
|
|
77
|
-
def code_climate_check?(engine)
|
78
|
-
engine["code_climate_check"] && ENV["RUN_CODECLIMATE_CHECKS"] == "true"
|
79
|
-
end
|
80
|
-
|
81
69
|
def files_exist?(engine)
|
82
70
|
workspace_files.any? do |path|
|
83
71
|
engine["enable_regexps"].any? { |re| Regexp.new(re).match(path) }
|
data/lib/cc/cli/init.rb
CHANGED
@@ -19,11 +19,9 @@ module CC
|
|
19
19
|
create_default_engine_configs if engines_enabled?
|
20
20
|
elsif upgrade? && engines_enabled?
|
21
21
|
warn "Config file .codeclimate.yml already configured for the Platform.\nTry running 'validate-config' to check configuration."
|
22
|
-
create_codeclimate_checks
|
23
22
|
create_default_engine_configs
|
24
23
|
else
|
25
24
|
generate_all_config
|
26
|
-
create_codeclimate_checks
|
27
25
|
end
|
28
26
|
end
|
29
27
|
|
@@ -58,20 +56,6 @@ module CC
|
|
58
56
|
filesystem.write_path(CODECLIMATE_YAML, config.to_yaml)
|
59
57
|
end
|
60
58
|
|
61
|
-
def create_codeclimate_checks
|
62
|
-
if ENV["RUN_CODECLIMATE_CHECKS"] == "true"
|
63
|
-
say "Generating codeclimate checks..."
|
64
|
-
plain_config_hash = JSON.parse(CC::Yaml::Serializer::Json.serialize(existing_cc_config))
|
65
|
-
config = CC::CLI::Config.new(plain_config_hash)
|
66
|
-
|
67
|
-
config_generator.codeclimate_checks.each do |(engine_name, engine_config)|
|
68
|
-
config.add_engine(engine_name, engine_config)
|
69
|
-
end
|
70
|
-
|
71
|
-
filesystem.write_path(CODECLIMATE_YAML, config.to_yaml)
|
72
|
-
end
|
73
|
-
end
|
74
|
-
|
75
59
|
def create_default_engine_configs
|
76
60
|
say "Generating default configuration for engines..."
|
77
61
|
available_engine_configs.each do |(engine_name, config_paths)|
|
@@ -0,0 +1,64 @@
|
|
1
|
+
require "safe_yaml/load"
|
2
|
+
|
3
|
+
module CC
|
4
|
+
module CLI
|
5
|
+
class Prepare
|
6
|
+
class Quality < Command
|
7
|
+
ENGINES_CONFIG = {
|
8
|
+
"complexity-ruby" => {
|
9
|
+
"enabled" => true,
|
10
|
+
"channel" => "beta",
|
11
|
+
},
|
12
|
+
"duplication" => {
|
13
|
+
"enabled" => true,
|
14
|
+
"channel" => "cronopio",
|
15
|
+
"config" => {
|
16
|
+
"languages" => [
|
17
|
+
"ruby",
|
18
|
+
],
|
19
|
+
},
|
20
|
+
},
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
def execute
|
24
|
+
Dir.chdir(CC::Analyzer::MountedPath.code.container_path) do
|
25
|
+
content =
|
26
|
+
if (existing_contents = read_codeclimate_yml)
|
27
|
+
modify(existing_contents)
|
28
|
+
else
|
29
|
+
{ "engines" => ENGINES_CONFIG }
|
30
|
+
end
|
31
|
+
|
32
|
+
write_codeclimate_yml(content)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
private
|
37
|
+
|
38
|
+
def modify(content)
|
39
|
+
content.delete("ratings")
|
40
|
+
content["engines"] ||= {}
|
41
|
+
content["engines"].merge!(ENGINES_CONFIG)
|
42
|
+
content
|
43
|
+
end
|
44
|
+
|
45
|
+
def read_codeclimate_yml
|
46
|
+
SafeYAML.load_file(CODECLIMATE_YAML)
|
47
|
+
rescue Errno::ENOENT
|
48
|
+
CLI.debug("No .codeclimate.yml present")
|
49
|
+
rescue => ex
|
50
|
+
message = "Error reading existing #{CODECLIMATE_YAML}, overwriting."
|
51
|
+
$stderr.puts(colorize("WARNING: #{message}", :yellow))
|
52
|
+
CLI.debug("error: #{ex.class} - #{ex.message}")
|
53
|
+
end
|
54
|
+
|
55
|
+
def write_codeclimate_yml(content)
|
56
|
+
yaml = YAML.dump(content)
|
57
|
+
CLI.debug("Writing .codeclimate.yml")
|
58
|
+
CLI.debug(yaml)
|
59
|
+
File.write(CODECLIMATE_YAML, yaml)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.59.
|
4
|
+
version: 0.59.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Climate
|
@@ -160,6 +160,20 @@ dependencies:
|
|
160
160
|
- - "~>"
|
161
161
|
- !ruby/object:Gem::Version
|
162
162
|
version: '2.3'
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: safe_yaml
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '1.0'
|
170
|
+
type: :runtime
|
171
|
+
prerelease: false
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - "~>"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '1.0'
|
163
177
|
description: Code Climate command line tool
|
164
178
|
email: hello@codeclimate.com
|
165
179
|
executables:
|
@@ -241,6 +255,7 @@ files:
|
|
241
255
|
- lib/cc/cli/init.rb
|
242
256
|
- lib/cc/cli/output.rb
|
243
257
|
- lib/cc/cli/prepare.rb
|
258
|
+
- lib/cc/cli/prepare/quality.rb
|
244
259
|
- lib/cc/cli/runner.rb
|
245
260
|
- lib/cc/cli/test.rb
|
246
261
|
- lib/cc/cli/upgrade_config_generator.rb
|