codeclimate 0.14.1 → 0.14.2
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/config/engines.yml +10 -4
- data/lib/cc/analyzer/container.rb +48 -6
- data/lib/cc/analyzer/include_paths_builder.rb +2 -2
- data/lib/cc/cli/config_generator.rb +1 -1
- 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: 72cddaaaf2d406b672e5dcf23810a2c3c12d5bf1
|
4
|
+
data.tar.gz: 8d59b60cd8907a9ac2f797c355aaf74cc8c28e1e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dcae9739365b050502e5dbeded10610040236b0f9c8ca84b5a5559955f28c34101be489363874bd469748ec61218365f8cfd4fa0b89e6f67dfba122ae72b6609
|
7
|
+
data.tar.gz: ffa9d0a75f6fdd2e615e5c1dc02b156c03f35e3f723d40845b9063f4016dbc4d09435fb0c43603cbeaf7cd9905378106bca83fb28409e0b630d8204a0c45ebb0
|
data/config/engines.yml
CHANGED
@@ -12,9 +12,11 @@
|
|
12
12
|
brakeman:
|
13
13
|
image: codeclimate/codeclimate-brakeman
|
14
14
|
description: Static analysis tool which checks Ruby on Rails applications for security vulnerabilities.
|
15
|
-
community:
|
15
|
+
community: false
|
16
|
+
upgrade_languages:
|
17
|
+
- Ruby
|
16
18
|
enable_regexps:
|
17
|
-
-
|
19
|
+
- ^script\/rails$
|
18
20
|
default_ratings_paths:
|
19
21
|
- "app/**"
|
20
22
|
- "**.rb"
|
@@ -114,7 +116,9 @@ nodesecurity:
|
|
114
116
|
pep8:
|
115
117
|
image: codeclimate/codeclimate-pep8
|
116
118
|
description: Static analysis tool to check Python code against the style conventions outlined in PEP-8.
|
117
|
-
community:
|
119
|
+
community: false
|
120
|
+
upgrade_languages:
|
121
|
+
- Python
|
118
122
|
enable_regexps:
|
119
123
|
- \.py$
|
120
124
|
default_ratings_paths:
|
@@ -150,7 +154,9 @@ phpmd:
|
|
150
154
|
radon:
|
151
155
|
image: codeclimate/codeclimate-radon
|
152
156
|
description: Python tool used to compute Cyclomatic Complexity.
|
153
|
-
community:
|
157
|
+
community: false
|
158
|
+
upgrade_languages:
|
159
|
+
- Python
|
154
160
|
enable_regexps:
|
155
161
|
- \.py$
|
156
162
|
default_ratings_paths:
|
@@ -1,4 +1,5 @@
|
|
1
1
|
require "posix/spawn"
|
2
|
+
require "thread"
|
2
3
|
|
3
4
|
module CC
|
4
5
|
module Analyzer
|
@@ -11,9 +12,17 @@ module CC
|
|
11
12
|
:stderr, # stderr, for a finished event
|
12
13
|
)
|
13
14
|
ImageRequired = Class.new(StandardError)
|
14
|
-
Result = Struct.new(
|
15
|
+
Result = Struct.new(
|
16
|
+
:exit_status,
|
17
|
+
:timed_out?,
|
18
|
+
:duration,
|
19
|
+
:maximum_output_exceeded?,
|
20
|
+
:output_byte_count,
|
21
|
+
:stderr,
|
22
|
+
)
|
15
23
|
|
16
24
|
DEFAULT_TIMEOUT = 15 * 60 # 15m
|
25
|
+
DEFAULT_MAXIMUM_OUTPUT_BYTES = 500_000_000
|
17
26
|
|
18
27
|
def initialize(image:, name:, command: nil, listener: ContainerListener.new)
|
19
28
|
raise ImageRequired if image.blank?
|
@@ -24,7 +33,10 @@ module CC
|
|
24
33
|
@output_delimeter = "\n"
|
25
34
|
@on_output = ->(*) {}
|
26
35
|
@timed_out = false
|
36
|
+
@maximum_output_exceeded = false
|
27
37
|
@stderr_io = StringIO.new
|
38
|
+
@output_byte_count = 0
|
39
|
+
@counter_mutex = Mutex.new
|
28
40
|
end
|
29
41
|
|
30
42
|
def on_output(delimeter = "\n", &block)
|
@@ -43,14 +55,23 @@ module CC
|
|
43
55
|
t_timeout = timeout_thread
|
44
56
|
|
45
57
|
_, status = Process.waitpid2(pid)
|
58
|
+
|
46
59
|
if @timed_out
|
47
|
-
|
48
|
-
|
60
|
+
duration = timeout
|
61
|
+
@listener.timed_out(container_data(duration: duration))
|
49
62
|
else
|
50
63
|
duration = ((Time.now - started) * 1000).round
|
51
64
|
@listener.finished(container_data(duration: duration, status: status))
|
52
|
-
Result.new(status.exitstatus, false, duration, @stderr_io.string)
|
53
65
|
end
|
66
|
+
|
67
|
+
Result.new(
|
68
|
+
status.exitstatus,
|
69
|
+
@timed_out,
|
70
|
+
duration,
|
71
|
+
@maximum_output_exceeded,
|
72
|
+
output_byte_count,
|
73
|
+
@stderr_io.string,
|
74
|
+
)
|
54
75
|
ensure
|
55
76
|
t_timeout.kill if t_timeout
|
56
77
|
if @timed_out
|
@@ -71,6 +92,8 @@ module CC
|
|
71
92
|
|
72
93
|
private
|
73
94
|
|
95
|
+
attr_reader :output_byte_count, :counter_mutex
|
96
|
+
|
74
97
|
def docker_run_command(options)
|
75
98
|
[
|
76
99
|
"docker", "run",
|
@@ -88,13 +111,17 @@ module CC
|
|
88
111
|
output = chunk.chomp(@output_delimeter)
|
89
112
|
|
90
113
|
@on_output.call(output)
|
114
|
+
check_output_bytes(output.bytesize)
|
91
115
|
end
|
92
116
|
end
|
93
117
|
end
|
94
118
|
|
95
119
|
def read_stderr(err)
|
96
120
|
Thread.new do
|
97
|
-
err.each_line
|
121
|
+
err.each_line do |line|
|
122
|
+
@stderr_io.write(line)
|
123
|
+
check_output_bytes(line.bytesize)
|
124
|
+
end
|
98
125
|
end
|
99
126
|
end
|
100
127
|
|
@@ -106,6 +133,17 @@ module CC
|
|
106
133
|
end
|
107
134
|
end
|
108
135
|
|
136
|
+
def check_output_bytes(last_read_byte_count)
|
137
|
+
counter_mutex.synchronize do
|
138
|
+
@output_byte_count += last_read_byte_count
|
139
|
+
end
|
140
|
+
|
141
|
+
if output_byte_count > maximum_output_bytes
|
142
|
+
@maximum_output_exceeded = true
|
143
|
+
stop
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
109
147
|
def container_data(duration: nil, status: nil)
|
110
148
|
ContainerData.new(@image, @name, duration, status, @stderr_io.string)
|
111
149
|
end
|
@@ -116,7 +154,11 @@ module CC
|
|
116
154
|
end
|
117
155
|
|
118
156
|
def timeout
|
119
|
-
(
|
157
|
+
ENV.fetch("CONTAINER_TIMEOUT_SECONDS", DEFAULT_TIMEOUT).to_i
|
158
|
+
end
|
159
|
+
|
160
|
+
def maximum_output_bytes
|
161
|
+
ENV.fetch("CONTAINER_MAXIMUM_OUTPUT_BYTES", DEFAULT_MAXIMUM_OUTPUT_BYTES).to_i
|
120
162
|
end
|
121
163
|
end
|
122
164
|
end
|
@@ -49,8 +49,8 @@ module CC
|
|
49
49
|
tmp.write(File.read(".gitignore")) if File.file?(".gitignore")
|
50
50
|
tmp << @cc_exclude_paths.join("\n")
|
51
51
|
tmp.close
|
52
|
-
tracked_and_ignored = `git ls-files -zi -X #{tmp.path}`.split("\0")
|
53
|
-
untracked_and_ignored = `git ls-files -zio -X #{tmp.path}`.split("\0")
|
52
|
+
tracked_and_ignored = `git ls-files -zi -X #{tmp.path} 2>/dev/null`.split("\0")
|
53
|
+
untracked_and_ignored = `git ls-files -zio -X #{tmp.path} 2>/dev/null`.split("\0")
|
54
54
|
tracked_and_ignored + untracked_and_ignored
|
55
55
|
end
|
56
56
|
end
|
@@ -2,7 +2,7 @@ module CC
|
|
2
2
|
module CLI
|
3
3
|
class ConfigGenerator
|
4
4
|
CODECLIMATE_YAML = Command::CODECLIMATE_YAML
|
5
|
-
AUTO_EXCLUDE_PATHS = %w(config/ db/ features/ node_modules/ script/ spec/ test/ vendor/).freeze
|
5
|
+
AUTO_EXCLUDE_PATHS = %w(config/ db/ features/ node_modules/ script/ spec/ test/ tests/ vendor/).freeze
|
6
6
|
|
7
7
|
def self.for(filesystem, engine_registry, upgrade_requested)
|
8
8
|
if upgrade_requested && upgrade_needed?(filesystem)
|
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.14.
|
4
|
+
version: 0.14.2
|
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-
|
11
|
+
date: 2015-11-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|