codeclimate 0.27.2 → 0.28.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f582069a08ebb7ca6e05607655a50f904fbf05a3
4
- data.tar.gz: 42fa3047ddf3ef4482d9fadee67cdbd8401c2fba
3
+ metadata.gz: d2383762ad9de2dfb5b6bad6152082075b9cdb4e
4
+ data.tar.gz: 2553df0ff143a062ef3f87c4c79c96f37ff51882
5
5
  SHA512:
6
- metadata.gz: 1a416bbab46e2fc8f2e9cc163c9224200b5150703c48717c684d5a8c82296cf02ad3e03413b4a100a2a81f7d5d8103897eeafe6f0e296de1553a10837ca66753
7
- data.tar.gz: 4cd663133cf8bf2ee9f1044fe7ea49af4cf9a0c6219bb264d11c5985f2bbbc935538959f9ea44010ed108a15e810e7861b685be3c3d22618a9f34ec4f59cf093
6
+ metadata.gz: c581b0595d8930894e7b5d5ebd90a157fa2d4ddb4484b2acc187324b6562523b14edfa16c82a4c248e74b0f9c02965cbf36eefb42a42ab219ac087baa93f6b62
7
+ data.tar.gz: 9eac879bdbbe3ee3a08b1ff2ef6c664578b265dc2f8c9ee9c518c36d3e2a13fe3ced1bb0970fd43a0f2a0e3b757abdb35ad03ae649e7b5c302afa2eb026e3ada
@@ -1,16 +1,27 @@
1
+ require "pathname"
2
+
1
3
  module CC
2
4
  module Analyzer
3
5
  class IssueRelativePathValidation < Validation
4
6
  def valid?
5
- path && !path.start_with?("/")
7
+ path &&
8
+ !path.start_with?("/") &&
9
+ relative_to?(MountedPath.code.container_path)
6
10
  end
7
11
 
8
12
  def message
9
- "Path must be relative"
13
+ "Path must be relative to the project directory"
10
14
  end
11
15
 
12
16
  private
13
17
 
18
+ def relative_to?(directory)
19
+ expanded_base = Pathname.new(directory).expand_path.to_s
20
+ expanded_path = Pathname.new(path).expand_path.to_s
21
+
22
+ expanded_path.start_with?(expanded_base)
23
+ end
24
+
14
25
  def path
15
26
  object.fetch("location", {})["path"]
16
27
  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.27.2
4
+ version: 0.28.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-05-06 00:00:00.000000000 Z
11
+ date: 2016-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport