codeclimate-yaml 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cc/yaml/nodes/mapping.rb +2 -14
- data/lib/cc/yaml/parser/psych.rb +9 -1
- data/lib/cc/yaml/version.rb +1 -1
- 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: d688aa913be9902d9b855c6f770a55128c220989
|
4
|
+
data.tar.gz: 1006cb799006206bbc404fd20e872a590368b1ad
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 318e6a4f8496e5335e80441679813abff30ddb8f0eb4aeff4e35179aeb25f7c060ede8e4f072dd1638167d2736014e56428533888cf6266f839e5288700fdcc9
|
7
|
+
data.tar.gz: e828e0c1119b3d5f13990f84a9a2806c88f21d49bcbdca8ecb49e79dc3f1ec98c24312e2f2fd2095b9c2c5180d9ce0759367e13a6d056fcc2fe8ef54001e2ff1
|
@@ -1,7 +1,7 @@
|
|
1
1
|
module CC::Yaml
|
2
2
|
module Nodes
|
3
3
|
class Mapping < Node
|
4
|
-
INCOMPATIBLE_KEYS_WARNING = "
|
4
|
+
INCOMPATIBLE_KEYS_WARNING = "Use either a Languages key or an Engines key, but not both. They are mutually exclusive.".freeze
|
5
5
|
|
6
6
|
def self.mapping
|
7
7
|
@mapping ||= superclass.respond_to?(:mapping) ? superclass.mapping.dup : {}
|
@@ -187,19 +187,7 @@ module CC::Yaml
|
|
187
187
|
|
188
188
|
def check_incompatibility(key)
|
189
189
|
if creates_incompatibility?(key)
|
190
|
-
warning(
|
191
|
-
end
|
192
|
-
end
|
193
|
-
|
194
|
-
def incompatibility_message(key)
|
195
|
-
"#{extant_engines_or_languages_key} key already found, dropping key: #{key}. #{INCOMPATIBLE_KEYS_WARNING}"
|
196
|
-
end
|
197
|
-
|
198
|
-
def extant_engines_or_languages_key
|
199
|
-
if self["engines"]
|
200
|
-
"engines"
|
201
|
-
elsif self["languages"]
|
202
|
-
"languages"
|
190
|
+
warning(INCOMPATIBLE_KEYS_WARNING, key)
|
203
191
|
end
|
204
192
|
end
|
205
193
|
|
data/lib/cc/yaml/parser/psych.rb
CHANGED
@@ -4,6 +4,8 @@ require 'delegate'
|
|
4
4
|
module CC::Yaml
|
5
5
|
module Parser
|
6
6
|
class Psych
|
7
|
+
WARNING_NO_ANALYSIS_KEY_FOUND = "No languages or engines key found. Must have analysis key.".freeze
|
8
|
+
|
7
9
|
class SetNode < DelegateClass(::Psych::Nodes::Mapping)
|
8
10
|
def children
|
9
11
|
super.select.with_index { |_,i| i.even? }
|
@@ -79,12 +81,18 @@ module CC::Yaml
|
|
79
81
|
parsed = @value if @value.is_a? ::Psych::Nodes::Node
|
80
82
|
parsed ||= ::Psych.parse(@value)
|
81
83
|
accept(root, parsed)
|
84
|
+
check_for_analysis_key(root)
|
82
85
|
root
|
83
86
|
rescue ::Psych::SyntaxError => error
|
84
87
|
root.verify
|
85
88
|
root.warnings.clear
|
86
89
|
root.error("syntax error: %s", error.message)
|
87
|
-
|
90
|
+
end
|
91
|
+
|
92
|
+
def check_for_analysis_key(root)
|
93
|
+
unless root.engines? || root.languages?
|
94
|
+
root.warnings << WARNING_NO_ANALYSIS_KEY_FOUND
|
95
|
+
end
|
88
96
|
end
|
89
97
|
|
90
98
|
def accept(node, value)
|
data/lib/cc/yaml/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: codeclimate-yaml
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
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-07-
|
11
|
+
date: 2015-07-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: secure_string
|