codeclimate 0.10.0 → 0.10.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e7e316d10f1c30a533dd6bf12bec7489f950922a
4
- data.tar.gz: 86754e8553d9286b76ade07489d0a3561e979d2f
3
+ metadata.gz: 3d60c51cbc56c8fea593971fb4c55ecd4dc2336e
4
+ data.tar.gz: 1735452e5abfebd7f64ff4e2022829f275bc71c8
5
5
  SHA512:
6
- metadata.gz: e4a5711db9e980d5f061a40e207ae56d3882d1c540da778afc2cab5652e7fdd5c5ae217bae3f920e8f3095ee161976b0fd347598739e2db15babd899285ac5ad
7
- data.tar.gz: 88b6924d353f1c61ac3dc59aae914ad809e1fdccb9683a01d8fa4f47dd6b35cf7a0e9b6cde45b9febb304e01a37619b9eb700fdc2029601d571b9c6726682f15
6
+ metadata.gz: c10e1fbe60a9d4704985a6710134cbd3954710d4de8a962e63c0a00b18e0347a004415a51f17a7960468e783e3f0606875ada6ff727dc8726fe482bed987070a
7
+ data.tar.gz: c9b367eb7384d62a29e0dedb36bd360365b967443866fcd125830355d7f6693eec6b1a7ef6b715aafb17db23f139e5f91837c7abf7fbe1893df2669cb36a3bb5
data/lib/cc/analyzer.rb CHANGED
@@ -5,9 +5,9 @@ module CC
5
5
  autoload :Container, "cc/analyzer/container"
6
6
  autoload :ContainerListener, "cc/analyzer/container_listener"
7
7
  autoload :Engine, "cc/analyzer/engine"
8
- autoload :Engines, "cc/analyzer/engines"
9
8
  autoload :EngineOutputFilter, "cc/analyzer/engine_output_filter"
10
9
  autoload :EngineRegistry, "cc/analyzer/engine_registry"
10
+ autoload :EnginesBuilder, "cc/analyzer/engines_builder"
11
11
  autoload :EnginesRunner, "cc/analyzer/engines_runner"
12
12
  autoload :Filesystem, "cc/analyzer/filesystem"
13
13
  autoload :Formatters, "cc/analyzer/formatters"
@@ -11,6 +11,7 @@ module CC
11
11
  :stderr, # stderr, for a finished event
12
12
  )
13
13
  ImageRequired = Class.new(StandardError)
14
+ Result = Struct.new(:exit_status, :timed_out?, :duration, :stderr)
14
15
 
15
16
  DEFAULT_TIMEOUT = 15 * 60 # 15m
16
17
 
@@ -51,9 +52,11 @@ module CC
51
52
  _, status = Process.waitpid2(pid)
52
53
  if @timed_out
53
54
  @listener.timed_out(container_data(duration: @timeout))
55
+ Result.new(status.exitstatus, true, @timeout, @stderr_io.string)
54
56
  else
55
57
  duration = ((Time.now - started) * 1000).round
56
58
  @listener.finished(container_data(duration: duration, status: status))
59
+ Result.new(status.exitstatus, false, duration, @stderr_io.string)
57
60
  end
58
61
  ensure
59
62
  t_timeout.kill if t_timeout
@@ -2,25 +2,27 @@ require "securerandom"
2
2
 
3
3
  module CC
4
4
  module Analyzer
5
- class Engines < Array
5
+ class EnginesBuilder
6
6
  def initialize(registry:, config:, container_label:, source_dir:, requested_paths:)
7
- super()
8
7
  @registry = registry
9
8
  @config = config
10
9
  @container_label = container_label
11
10
  @requested_paths = requested_paths
12
11
  @source_dir = source_dir
13
- names_and_raw_engine_configs.each do |name, raw_engine_config|
14
- self << build_engine(name, raw_engine_config)
12
+ end
13
+
14
+ def run(engine_class = Analyzer::Engine)
15
+ names_and_raw_engine_configs.map do |name, raw_engine_config|
16
+ build_engine(engine_class, name, raw_engine_config)
15
17
  end
16
18
  end
17
19
 
18
20
  private
19
21
 
20
- def build_engine(name, raw_engine_config)
22
+ def build_engine(engine_class, name, raw_engine_config)
21
23
  label = @container_label || SecureRandom.uuid
22
24
  engine_config = engine_config(raw_engine_config)
23
- Engine.new(
25
+ engine_class.new(
24
26
  name, @registry[name], @source_dir, engine_config, label
25
27
  )
26
28
  end
@@ -32,13 +32,13 @@ module CC
32
32
  attr_reader :requested_paths
33
33
 
34
34
  def engines
35
- @engines ||= Engines.new(
35
+ @engines ||= EnginesBuilder.new(
36
36
  registry: @registry,
37
37
  config: @config,
38
38
  container_label: @container_label,
39
39
  source_dir: @source_dir,
40
40
  requested_paths: @requested_paths,
41
- )
41
+ ).run
42
42
  end
43
43
 
44
44
  def run_engine(engine, container_listener)
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.0
4
+ version: 0.10.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Code Climate
@@ -205,7 +205,7 @@ files:
205
205
  - lib/cc/analyzer/engine.rb
206
206
  - lib/cc/analyzer/engine_output_filter.rb
207
207
  - lib/cc/analyzer/engine_registry.rb
208
- - lib/cc/analyzer/engines.rb
208
+ - lib/cc/analyzer/engines_builder.rb
209
209
  - lib/cc/analyzer/engines_runner.rb
210
210
  - lib/cc/analyzer/filesystem.rb
211
211
  - lib/cc/analyzer/formatters.rb
@@ -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.5
264
+ rubygems_version: 2.4.8
265
265
  signing_key:
266
266
  specification_version: 4
267
267
  summary: Code Climate CLI