codeclimate 0.0.7 → 0.0.9

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b59e9d71e49d6e177c2512ae42cf123b10c4ca30
4
- data.tar.gz: 66b26592ba9f700a23ea935586edfd2a4a8f84d4
3
+ metadata.gz: 65981b2dfc7ede257b220d224cfc49f6352da814
4
+ data.tar.gz: 6b6cc3ce039b2dd94895bdd8b255d9c1ef5cdd52
5
5
  SHA512:
6
- metadata.gz: 21b1b0021bd31dcdb917e30127e864a9b9ef6f21a693677c3e39f32af57566ee1a8b635ddb10c098e95b48068e212988d3b8e0af67e7b7a76f97b6ff89c9bbd2
7
- data.tar.gz: d2c6c18403a16f979b09597d43bc102c41f2a0f8afd5e8e4a562a6d3cc5f5c1dc2fbeed5bd85f58d1b12619f201025940ea04000a078fe368e26c95600d234c1
6
+ metadata.gz: 5da27414b23c279d27935d8f8e0ba6f02200ec0ab7672751cfcad094c15835965bd24a16d5cd7eb9aac7b967f2a8ddb5a41b8d9f4cf7fb15e2fcf75971735801
7
+ data.tar.gz: 11832434ababa225981ec922058898adaa3240a538cb675651e3a867aa6cbcaf059d01958a4b93676a3318b0a6bf22bc901b2cb68cd4cc06c34aaa1db8b14fad
@@ -19,6 +19,7 @@ module CC
19
19
  def run(stdout_io, stderr_io = StringIO.new)
20
20
  pid, _, out, err = POSIX::Spawn.popen4(*docker_run_command)
21
21
  engine_running = true
22
+ Analyzer.statsd.increment("cli.engines.started")
22
23
 
23
24
  t_out = Thread.new do
24
25
  out.each_line("\0") do |chunk|
@@ -41,6 +42,10 @@ module CC
41
42
  Thread.current.abort_on_exception = true
42
43
  run_command("docker kill #{container_name}")
43
44
 
45
+ Analyzer.statsd.increment("cli.engines.result.error")
46
+ Analyzer.statsd.increment("cli.engines.result.error.timeout")
47
+ Analyzer.statsd.increment("cli.engines.names.#{name}.result.error")
48
+ Analyzer.statsd.increment("cli.engines.names.#{name}.result.error.timeout")
44
49
  raise EngineTimeout, "engine #{name} ran past #{TIMEOUT} seconds and was killed"
45
50
  end
46
51
  end
@@ -18,18 +18,13 @@ module CC
18
18
  File.read(path_for(path))
19
19
  end
20
20
 
21
- def file_paths
22
- Dir.chdir(@root) do
23
- Dir["**/*.*"].select { |path| File.file?(path) }.sort
24
- end
25
- end
26
-
27
- def all
28
- @files ||= Dir.chdir(@root) { Dir.glob("**/*") }
21
+ def write_path(path, content)
22
+ File.write(path_for(path), content)
23
+ File.chown(root_uid, root_gid, path_for(path))
29
24
  end
30
25
 
31
26
  def any?(&block)
32
- all.any?(&block)
27
+ file_paths.any?(&block)
33
28
  end
34
29
 
35
30
  def files_matching(globs)
@@ -40,9 +35,31 @@ module CC
40
35
  end
41
36
  end
42
37
 
38
+ private
39
+
40
+ def file_paths
41
+ @file_paths ||= Dir.chdir(@root) do
42
+ `find . -type f -print0`.strip.split("\0").map do |path|
43
+ path.sub(/^\.\//, "")
44
+ end
45
+ end
46
+ end
47
+
43
48
  def path_for(path)
44
49
  File.join(@root, path)
45
50
  end
51
+
52
+ def root_uid
53
+ root_stat.uid
54
+ end
55
+
56
+ def root_gid
57
+ root_stat.gid
58
+ end
59
+
60
+ def root_stat
61
+ @root_stat ||= File.stat(@root)
62
+ end
46
63
  end
47
64
  end
48
65
  end
@@ -17,13 +17,11 @@ module CC
17
17
  end
18
18
 
19
19
  def yaml_content
20
- File.read(filesystem.path_for(CODECLIMATE_YAML)).freeze
20
+ filesystem.read_path(CODECLIMATE_YAML).freeze
21
21
  end
22
22
 
23
23
  def update_yaml
24
- File.open(filesystem.path_for(CODECLIMATE_YAML), "w") do |f|
25
- f.write(parsed_yaml.to_yaml)
26
- end
24
+ filesystem.write_path(CODECLIMATE_YAML, parsed_yaml.to_yaml)
27
25
  end
28
26
 
29
27
  def engine_present_in_yaml?
data/lib/cc/cli/init.rb CHANGED
@@ -30,7 +30,7 @@ module CC
30
30
 
31
31
  config["exclude_paths"] = exclude_paths(AUTO_EXCLUDE_PATHS)
32
32
 
33
- File.write(filesystem.path_for(CODECLIMATE_YAML), config.to_yaml)
33
+ filesystem.write_path(CODECLIMATE_YAML, config.to_yaml)
34
34
  end
35
35
 
36
36
  def exclude_paths(paths)
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.0.7
4
+ version: 0.0.9
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-06-22 00:00:00.000000000 Z
11
+ date: 2015-06-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport