codeclimate 0.10.1 → 0.11.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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/cc/analyzer/container.rb +8 -11
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3d60c51cbc56c8fea593971fb4c55ecd4dc2336e
4
- data.tar.gz: 1735452e5abfebd7f64ff4e2022829f275bc71c8
3
+ metadata.gz: 9516f4110843547b299db402d54230e61bb63b80
4
+ data.tar.gz: 3fc082327dd10c49850935b9a7f2cdf3d446ec0b
5
5
  SHA512:
6
- metadata.gz: c10e1fbe60a9d4704985a6710134cbd3954710d4de8a962e63c0a00b18e0347a004415a51f17a7960468e783e3f0606875ada6ff727dc8726fe482bed987070a
7
- data.tar.gz: c9b367eb7384d62a29e0dedb36bd360365b967443866fcd125830355d7f6693eec6b1a7ef6b715aafb17db23f139e5f91837c7abf7fbe1893df2669cb36a3bb5
6
+ metadata.gz: e890e440bccebf48ea429e7cd542b1a2108edba0211b221cc10e91f91e03de92b5619097c8e2154c9a2009b71c24637d2c159dcdf4eb08670ed885fd9cc328a3
7
+ data.tar.gz: a9a276927f30546b55d24ed7c3e79737a444c946f22b2aae940975f6531e3536747a3b305a89d2ccdae177d23076d336b6e2ecb25319a89859d154386ca41cdb
@@ -15,19 +15,12 @@ module CC
15
15
 
16
16
  DEFAULT_TIMEOUT = 15 * 60 # 15m
17
17
 
18
- def initialize(
19
- image:,
20
- name:,
21
- command: nil,
22
- listener: ContainerListener.new,
23
- timeout: DEFAULT_TIMEOUT
24
- )
18
+ def initialize(image:, name:, command: nil, listener: ContainerListener.new)
25
19
  raise ImageRequired if image.blank?
26
20
  @image = image
27
21
  @name = name
28
22
  @command = command
29
23
  @listener = listener
30
- @timeout = timeout
31
24
  @output_delimeter = "\n"
32
25
  @on_output = ->(*) {}
33
26
  @timed_out = false
@@ -51,8 +44,8 @@ module CC
51
44
 
52
45
  _, status = Process.waitpid2(pid)
53
46
  if @timed_out
54
- @listener.timed_out(container_data(duration: @timeout))
55
- Result.new(status.exitstatus, true, @timeout, @stderr_io.string)
47
+ @listener.timed_out(container_data(duration: timeout))
48
+ Result.new(status.exitstatus, true, timeout, @stderr_io.string)
56
49
  else
57
50
  duration = ((Time.now - started) * 1000).round
58
51
  @listener.finished(container_data(duration: duration, status: status))
@@ -107,7 +100,7 @@ module CC
107
100
 
108
101
  def timeout_thread
109
102
  Thread.new do
110
- sleep @timeout
103
+ sleep timeout
111
104
  @timed_out = true
112
105
  reap_running_container
113
106
  end
@@ -121,6 +114,10 @@ module CC
121
114
  Analyzer.logger.warn("killing container name=#{@name}")
122
115
  POSIX::Spawn::Child.new("docker", "kill", @name)
123
116
  end
117
+
118
+ def timeout
119
+ (ENV["CONTAINER_TIMEOUT_SECONDS"] || DEFAULT_TIMEOUT).to_i
120
+ end
124
121
  end
125
122
  end
126
123
  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.10.1
4
+ version: 0.11.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
@@ -261,7 +261,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
261
261
  version: '0'
262
262
  requirements: []
263
263
  rubyforge_project:
264
- rubygems_version: 2.4.8
264
+ rubygems_version: 2.4.5
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: Code Climate CLI