codeclimate 0.21.4 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/bin/codeclimate +0 -3
- data/bin/codeclimate-init +0 -2
- data/bin/release +1 -0
- data/lib/cc/analyzer.rb +1 -0
- data/lib/cc/analyzer/engine.rb +5 -6
- data/lib/cc/analyzer/mounted_path.rb +80 -0
- data/lib/cc/cli/analyze.rb +2 -2
- data/lib/cc/cli/command.rb +3 -1
- data/lib/cc/cli/config_generator.rb +1 -1
- data/lib/cc/cli/test.rb +7 -23
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 14dc3c071f79797549bcd4f338e36c83985288ce
|
4
|
+
data.tar.gz: 5730c60a8f84089a56c6f9ccf714a74201a10a20
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 088c6804de298c0f39ea06b0455ece2dd4d1d36260b02813958b5c3fc5c86da4646478e3069b315639bcd753640925c42c0e80493322c99c52c8b4b698692637
|
7
|
+
data.tar.gz: 47ebfa3e91348de4a1da2a4c4b55dbbe8120e47dd644d1e456657665e5f0c53c2f5ed31f05a16c7e5ff4d5756b1e306a3b9814ebb8c37940dc87e4a63334bf95
|
data/bin/codeclimate
CHANGED
data/bin/codeclimate-init
CHANGED
data/bin/release
CHANGED
@@ -23,6 +23,7 @@ docker tag codeclimate/codeclimate "codeclimate/codeclimate:$version"
|
|
23
23
|
docker push "codeclimate/codeclimate:$version"
|
24
24
|
|
25
25
|
(cd ../homebrew-formulae/ && bin/release "$version")
|
26
|
+
(cd ../marketingsite/ && bin/set-cli-version "$version" && bin/deploy)
|
26
27
|
|
27
28
|
echo "Be sure to update release notes:"
|
28
29
|
echo ""
|
data/lib/cc/analyzer.rb
CHANGED
@@ -16,6 +16,7 @@ module CC
|
|
16
16
|
autoload :IssueSorter, "cc/analyzer/issue_sorter"
|
17
17
|
autoload :LocationDescription, "cc/analyzer/location_description"
|
18
18
|
autoload :LoggingContainerListener, "cc/analyzer/logging_container_listener"
|
19
|
+
autoload :MountedPath, "cc/analyzer/mounted_path"
|
19
20
|
autoload :RaisingContainerListener, "cc/analyzer/raising_container_listener"
|
20
21
|
autoload :SourceBuffer, "cc/analyzer/source_buffer"
|
21
22
|
autoload :StatsdContainerListener, "cc/analyzer/statsd_container_listener"
|
data/lib/cc/analyzer/engine.rb
CHANGED
@@ -43,7 +43,7 @@ module CC
|
|
43
43
|
end
|
44
44
|
|
45
45
|
write_config_file
|
46
|
-
CLI.debug "engine config: #{
|
46
|
+
CLI.debug "engine config: #{config_file.read.inspect}"
|
47
47
|
container.run(container_options)
|
48
48
|
ensure
|
49
49
|
delete_config_file
|
@@ -60,7 +60,7 @@ module CC
|
|
60
60
|
"--net", "none",
|
61
61
|
"--rm",
|
62
62
|
"--volume", "#{@code_path}:/code:ro",
|
63
|
-
"--volume", "#{config_file}:/config.json:ro",
|
63
|
+
"--volume", "#{config_file.host_path}:/config.json:ro",
|
64
64
|
"--user", "9000:9000"
|
65
65
|
]
|
66
66
|
end
|
@@ -70,16 +70,15 @@ module CC
|
|
70
70
|
end
|
71
71
|
|
72
72
|
def write_config_file
|
73
|
-
|
74
|
-
File.write(config_file, @config.to_json)
|
73
|
+
config_file.write(@config.to_json)
|
75
74
|
end
|
76
75
|
|
77
76
|
def delete_config_file
|
78
|
-
|
77
|
+
config_file.delete if config_file.file?
|
79
78
|
end
|
80
79
|
|
81
80
|
def config_file
|
82
|
-
@config_file ||=
|
81
|
+
@config_file ||= MountedPath.tmp.join(SecureRandom.uuid)
|
83
82
|
end
|
84
83
|
|
85
84
|
def output_filter
|
@@ -0,0 +1,80 @@
|
|
1
|
+
module CC
|
2
|
+
module Analyzer
|
3
|
+
class MountedPath
|
4
|
+
DEFAULT_CODECLIMATE_TMP = "/tmp/cc".freeze
|
5
|
+
|
6
|
+
def self.code
|
7
|
+
host_prefix = ENV["CODECLIMATE_CODE"]
|
8
|
+
host_prefix ||= ENV["CODE_PATH"] # deprecated
|
9
|
+
|
10
|
+
if ENV["CODECLIMATE_DOCKER"]
|
11
|
+
new(host_prefix, "/code")
|
12
|
+
else
|
13
|
+
host_prefix ||= Dir.pwd
|
14
|
+
|
15
|
+
new(host_prefix, host_prefix)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def self.tmp
|
20
|
+
host_prefix = ENV["CODECLIMATE_TMP"]
|
21
|
+
host_prefix ||= DEFAULT_CODECLIMATE_TMP
|
22
|
+
|
23
|
+
if ENV["CODECLIMATE_DOCKER"]
|
24
|
+
new(host_prefix, "/tmp/cc")
|
25
|
+
else
|
26
|
+
new(host_prefix, host_prefix)
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
def initialize(host_prefix, container_prefix, path = nil)
|
31
|
+
@host_prefix = host_prefix
|
32
|
+
@container_prefix = container_prefix
|
33
|
+
@path = path
|
34
|
+
end
|
35
|
+
|
36
|
+
def host_path
|
37
|
+
if path
|
38
|
+
File.join(host_prefix, path)
|
39
|
+
else
|
40
|
+
host_prefix
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
def container_path
|
45
|
+
if path
|
46
|
+
File.join(container_prefix, path)
|
47
|
+
else
|
48
|
+
container_prefix
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
def join(path)
|
53
|
+
@path = path
|
54
|
+
|
55
|
+
self
|
56
|
+
end
|
57
|
+
|
58
|
+
def file?
|
59
|
+
File.file?(container_path)
|
60
|
+
end
|
61
|
+
|
62
|
+
def read
|
63
|
+
File.read(container_path)
|
64
|
+
end
|
65
|
+
|
66
|
+
def write(content)
|
67
|
+
FileUtils.mkdir_p(File.dirname(container_path))
|
68
|
+
File.write(container_path, content)
|
69
|
+
end
|
70
|
+
|
71
|
+
def delete
|
72
|
+
File.delete(container_path)
|
73
|
+
end
|
74
|
+
|
75
|
+
private
|
76
|
+
|
77
|
+
attr_reader :host_prefix, :container_prefix, :path
|
78
|
+
end
|
79
|
+
end
|
80
|
+
end
|
data/lib/cc/cli/analyze.rb
CHANGED
@@ -15,7 +15,7 @@ module CC
|
|
15
15
|
def run
|
16
16
|
require_codeclimate_yml
|
17
17
|
|
18
|
-
Dir.chdir(
|
18
|
+
Dir.chdir(MountedPath.code.container_path) do
|
19
19
|
runner = EnginesRunner.new(registry, formatter, source_dir, config, path_options)
|
20
20
|
runner.run
|
21
21
|
end
|
@@ -57,7 +57,7 @@ module CC
|
|
57
57
|
end
|
58
58
|
|
59
59
|
def source_dir
|
60
|
-
|
60
|
+
MountedPath.code.host_path
|
61
61
|
end
|
62
62
|
|
63
63
|
def config
|
data/lib/cc/cli/command.rb
CHANGED
@@ -73,7 +73,7 @@ module CC
|
|
73
73
|
@non_excluded_paths ||= begin
|
74
74
|
excludes = exclude_paths.map { |path| path.chomp("/") }
|
75
75
|
filesystem.ls.reject do |path|
|
76
|
-
path.starts_with?(".") || excludes.include?(path)
|
76
|
+
path.starts_with?("-") || path.starts_with?(".") || excludes.include?(path)
|
77
77
|
end
|
78
78
|
end
|
79
79
|
end
|
data/lib/cc/cli/test.rb
CHANGED
@@ -1,4 +1,3 @@
|
|
1
|
-
require "shellwords"
|
2
1
|
require "cc/yaml"
|
3
2
|
|
4
3
|
module CC
|
@@ -89,14 +88,8 @@ module CC
|
|
89
88
|
remove_null_container
|
90
89
|
end
|
91
90
|
|
92
|
-
def within_tempdir
|
93
|
-
|
94
|
-
|
95
|
-
Dir.chdir(tmpdir) do
|
96
|
-
yield
|
97
|
-
end
|
98
|
-
ensure
|
99
|
-
FileUtils.rm_rf(tmpdir)
|
91
|
+
def within_tempdir(&block)
|
92
|
+
Dir.mktmpdir { |tmp| Dir.chdir(tmp, &block) }
|
100
93
|
end
|
101
94
|
|
102
95
|
def unpack_tests
|
@@ -187,15 +180,12 @@ module CC
|
|
187
180
|
def codeclimate_analyze(relative_path)
|
188
181
|
codeclimate_path = File.expand_path(File.join(File.dirname(__FILE__), "../../../bin/codeclimate"))
|
189
182
|
|
190
|
-
system(
|
191
|
-
|
192
|
-
"
|
193
|
-
Shellwords.escape(codeclimate_path),
|
194
|
-
"analyze",
|
195
|
-
"--engine", Shellwords.escape(@engine_name),
|
183
|
+
system(
|
184
|
+
codeclimate_path, "analyze",
|
185
|
+
"--engine", @engine_name,
|
196
186
|
"-f", "json",
|
197
|
-
|
198
|
-
|
187
|
+
relative_path
|
188
|
+
)
|
199
189
|
end
|
200
190
|
|
201
191
|
def prepare_working_dir
|
@@ -221,12 +211,6 @@ module CC
|
|
221
211
|
end
|
222
212
|
end
|
223
213
|
|
224
|
-
def create_tmpdir
|
225
|
-
tmpdir = File.join("/tmp/cc", SecureRandom.uuid)
|
226
|
-
FileUtils.mkdir_p(tmpdir)
|
227
|
-
tmpdir
|
228
|
-
end
|
229
|
-
|
230
214
|
def unpack(path)
|
231
215
|
system("docker cp #{null_container_id}:#{path} .")
|
232
216
|
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.
|
4
|
+
version: 0.22.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: 2016-03-
|
11
|
+
date: 2016-03-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -192,6 +192,7 @@ files:
|
|
192
192
|
- lib/cc/analyzer/issue_sorter.rb
|
193
193
|
- lib/cc/analyzer/location_description.rb
|
194
194
|
- lib/cc/analyzer/logging_container_listener.rb
|
195
|
+
- lib/cc/analyzer/mounted_path.rb
|
195
196
|
- lib/cc/analyzer/raising_container_listener.rb
|
196
197
|
- lib/cc/analyzer/source_buffer.rb
|
197
198
|
- lib/cc/analyzer/statsd_container_listener.rb
|