codeclimate 0.25.1 → 0.26.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9d43c699da6eae6069acb8272502c1f14f21314b
|
4
|
+
data.tar.gz: 831177029f49803b8196bc87ae215825856833af
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 011ea2bf09e8c6f49439546fe49cf18b55473163ba2b9b62b676b3054411db336870d9ccafa5387cb7cf25820de4a770f80ab722c2f7c6148effbb6e296fe7ed
|
7
|
+
data.tar.gz: 37f30fe06ba2ac1c65874837fef499effe1f9eab80a7522f65061e0294428afce0b9101125afaa7d97172184544e8571e29a23c6b8f8d461e95b0ed54b45ebf3
|
data/lib/cc/analyzer.rb
CHANGED
@@ -18,6 +18,8 @@ module CC
|
|
18
18
|
autoload :IssueCategoryValidation, "cc/analyzer/issue_category_validation"
|
19
19
|
autoload :IssueCheckNamePresenceValidation, "cc/analyzer/issue_check_name_presence_validation"
|
20
20
|
autoload :IssueDescriptionPresenceValidation, "cc/analyzer/issue_description_presence_validation"
|
21
|
+
autoload :IssueLocationFormatValidation, "cc/analyzer/issue_location_format_validation"
|
22
|
+
autoload :IssueOtherLocationsFormatValidation, "cc/analyzer/issue_other_locations_format_validation"
|
21
23
|
autoload :IssuePathExistenceValidation, "cc/analyzer/issue_path_existence_validation"
|
22
24
|
autoload :IssuePathPresenceValidation, "cc/analyzer/issue_path_presence_validation"
|
23
25
|
autoload :IssueRelativePathValidation, "cc/analyzer/issue_relative_path_validation"
|
@@ -0,0 +1,43 @@
|
|
1
|
+
module CC
|
2
|
+
module Analyzer
|
3
|
+
class IssueLocationFormatValidation < Validation
|
4
|
+
def valid?
|
5
|
+
if location["lines"]
|
6
|
+
valid_lines?(location["lines"])
|
7
|
+
elsif location["positions"]
|
8
|
+
valid_positions?(location["positions"])
|
9
|
+
else
|
10
|
+
false
|
11
|
+
end
|
12
|
+
end
|
13
|
+
|
14
|
+
def message
|
15
|
+
"Location is not formatted correctly"
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def location
|
21
|
+
@location ||= object.fetch("location", {})
|
22
|
+
end
|
23
|
+
|
24
|
+
def valid_positions?(positions)
|
25
|
+
positions.is_a?(Hash) &&
|
26
|
+
valid_position?(positions["begin"]) &&
|
27
|
+
valid_position?(positions["end"])
|
28
|
+
end
|
29
|
+
|
30
|
+
def valid_position?(position)
|
31
|
+
position &&
|
32
|
+
(
|
33
|
+
(position["line"] && position["column"]) ||
|
34
|
+
position["offset"]
|
35
|
+
)
|
36
|
+
end
|
37
|
+
|
38
|
+
def valid_lines?(lines)
|
39
|
+
lines.is_a?(Hash) && lines.key?("begin") && lines.key?("end")
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module CC
|
2
|
+
module Analyzer
|
3
|
+
class IssueOtherLocationsFormatValidation < Validation
|
4
|
+
CHECKS = [
|
5
|
+
IssueLocationFormatValidation,
|
6
|
+
IssuePathExistenceValidation,
|
7
|
+
IssuePathPresenceValidation,
|
8
|
+
IssueRelativePathValidation,
|
9
|
+
].freeze
|
10
|
+
|
11
|
+
def valid?
|
12
|
+
if object["other_locations"]
|
13
|
+
object["other_locations"].is_a?(Array) &&
|
14
|
+
object["other_locations"].all?(&method(:other_location_valid?))
|
15
|
+
else
|
16
|
+
true
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def message
|
21
|
+
"Other locations are not formatted correctly"
|
22
|
+
end
|
23
|
+
|
24
|
+
private
|
25
|
+
|
26
|
+
def other_location_valid?(location)
|
27
|
+
CHECKS.all? do |klass|
|
28
|
+
klass.new("location" => location).valid?
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -5,6 +5,8 @@ module CC
|
|
5
5
|
IssueCategoryValidation,
|
6
6
|
IssueCheckNamePresenceValidation,
|
7
7
|
IssueDescriptionPresenceValidation,
|
8
|
+
IssueLocationFormatValidation,
|
9
|
+
IssueOtherLocationsFormatValidation,
|
8
10
|
IssuePathExistenceValidation,
|
9
11
|
IssuePathPresenceValidation,
|
10
12
|
IssueRelativePathValidation,
|
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.
|
4
|
+
version: 0.26.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Code Climate
|
@@ -171,6 +171,8 @@ files:
|
|
171
171
|
- lib/cc/analyzer/issue_category_validation.rb
|
172
172
|
- lib/cc/analyzer/issue_check_name_presence_validation.rb
|
173
173
|
- lib/cc/analyzer/issue_description_presence_validation.rb
|
174
|
+
- lib/cc/analyzer/issue_location_format_validation.rb
|
175
|
+
- lib/cc/analyzer/issue_other_locations_format_validation.rb
|
174
176
|
- lib/cc/analyzer/issue_path_existence_validation.rb
|
175
177
|
- lib/cc/analyzer/issue_path_presence_validation.rb
|
176
178
|
- lib/cc/analyzer/issue_relative_path_validation.rb
|