codeclimate 0.48.0 → 0.49.0
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 +11 -0
- data/lib/cc/analyzer/engines_config_builder.rb +4 -1
- data/lib/cc/cli/config.rb +17 -5
- data/lib/cc/cli/config_generator.rb +12 -0
- data/lib/cc/cli/init.rb +16 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7863d2ef3f7a9805635ba13b7bb648f47fbe5b6
|
4
|
+
data.tar.gz: 8d3f00ddbe28b9098d9fcf4030587dbab8d84e0f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed426bd99d8af69a9b91eee69a3068133cfedb93800547e22c7d40a82c074fce9c84da0063c4b48822515d5c474076c6e90392111fa88d890c6df6acc2453fce
|
7
|
+
data.tar.gz: 8dbd6db4150ee985807b14e0162b45dcbf0fd356812368f7a26338b509303cd5fe9a1f0067b9db963ed3a5a4758df6eefe0c41261022b6ec399f9fa1f04ed7e3
|
data/config/engines.yml
CHANGED
@@ -50,6 +50,17 @@ checkstyle:
|
|
50
50
|
- \.java$
|
51
51
|
default_ratings_paths:
|
52
52
|
- "**.java"
|
53
|
+
complexity-ruby:
|
54
|
+
channels:
|
55
|
+
beta: codeclimate/codeclimate-complexity-ruby:b44
|
56
|
+
description: Code Climate Complexity Checks for Ruby
|
57
|
+
community: false
|
58
|
+
code_climate_check: true
|
59
|
+
default_ratings_paths:
|
60
|
+
- "**.rb"
|
61
|
+
default_config:
|
62
|
+
languages:
|
63
|
+
- ruby
|
53
64
|
csslint:
|
54
65
|
channels:
|
55
66
|
stable: codeclimate/codeclimate-csslint
|
@@ -12,7 +12,10 @@ module CC
|
|
12
12
|
# handling.
|
13
13
|
def fetch(name, channel)
|
14
14
|
metadata = self[name]
|
15
|
-
metadata.merge(
|
15
|
+
metadata.merge(
|
16
|
+
"image" => metadata["channels"][channel.to_s],
|
17
|
+
"code_climate_check" => metadata.fetch("code_climate_check", false),
|
18
|
+
)
|
16
19
|
end
|
17
20
|
end
|
18
21
|
|
data/lib/cc/cli/config.rb
CHANGED
@@ -2,11 +2,9 @@ module CC
|
|
2
2
|
module CLI
|
3
3
|
class Config
|
4
4
|
delegate :to_yaml, to: :config
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
"ratings" => { "paths" => [] },
|
9
|
-
}
|
5
|
+
|
6
|
+
def initialize(config = {})
|
7
|
+
@config = default_config.merge(config)
|
10
8
|
end
|
11
9
|
|
12
10
|
def add_engine(engine_name, engine_config)
|
@@ -16,6 +14,13 @@ module CC
|
|
16
14
|
config["engines"][engine_name]["config"] = engine_config["default_config"]
|
17
15
|
end
|
18
16
|
|
17
|
+
# we may not want this code in the general case.
|
18
|
+
# for now, we need it to test one of our own Maintainability engines
|
19
|
+
# which is in the 'beta' channel
|
20
|
+
if engine_config.key?("channels") && !engine_config["channels"].include?("stable")
|
21
|
+
config["engines"][engine_name]["channel"] = engine_config["channels"].first.first
|
22
|
+
end
|
23
|
+
|
19
24
|
config["ratings"]["paths"] |= engine_config["default_ratings_paths"]
|
20
25
|
end
|
21
26
|
|
@@ -27,6 +32,13 @@ module CC
|
|
27
32
|
private
|
28
33
|
|
29
34
|
attr_reader :config
|
35
|
+
|
36
|
+
def default_config
|
37
|
+
{
|
38
|
+
"engines" => {},
|
39
|
+
"ratings" => { "paths" => [] },
|
40
|
+
}
|
41
|
+
end
|
30
42
|
end
|
31
43
|
end
|
32
44
|
end
|
@@ -37,6 +37,14 @@ 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
|
+
|
40
48
|
def errors
|
41
49
|
[]
|
42
50
|
end
|
@@ -63,6 +71,10 @@ module CC
|
|
63
71
|
!engine["community"] && engine["enable_regexps"].present? && files_exist?(engine)
|
64
72
|
end
|
65
73
|
|
74
|
+
def code_climate_check?(engine)
|
75
|
+
engine["code_climate_check"] && ENV["RUN_CODECLIMATE_CHECKS"] == "true"
|
76
|
+
end
|
77
|
+
|
66
78
|
def files_exist?(engine)
|
67
79
|
workspace_files.any? do |path|
|
68
80
|
engine["enable_regexps"].any? { |re| Regexp.new(re).match(path) }
|
data/lib/cc/cli/init.rb
CHANGED
@@ -19,9 +19,11 @@ 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
|
22
23
|
create_default_engine_configs
|
23
24
|
else
|
24
25
|
generate_all_config
|
26
|
+
create_codeclimate_checks
|
25
27
|
end
|
26
28
|
end
|
27
29
|
|
@@ -56,6 +58,20 @@ module CC
|
|
56
58
|
filesystem.write_path(CODECLIMATE_YAML, config.to_yaml)
|
57
59
|
end
|
58
60
|
|
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
|
+
|
59
75
|
def create_default_engine_configs
|
60
76
|
say "Generating default configuration for engines..."
|
61
77
|
available_engine_configs.each do |config_path|
|
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.
|
4
|
+
version: 0.49.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Climate
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-02-
|
11
|
+
date: 2017-02-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -253,7 +253,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
253
253
|
version: '0'
|
254
254
|
requirements: []
|
255
255
|
rubyforge_project:
|
256
|
-
rubygems_version: 2.5
|
256
|
+
rubygems_version: 2.4.5
|
257
257
|
signing_key:
|
258
258
|
specification_version: 4
|
259
259
|
summary: Code Climate CLI
|