codeclimate 0.27.2 → 0.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cc/analyzer/issue_relative_path_validation.rb +13 -2
- 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: d2383762ad9de2dfb5b6bad6152082075b9cdb4e
|
4
|
+
data.tar.gz: 2553df0ff143a062ef3f87c4c79c96f37ff51882
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 &&
|
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.
|
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-
|
11
|
+
date: 2016-05-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|