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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ae155d660630ed6c713004789de2769e17b3b945
4
- data.tar.gz: 608a2c96b26ba25431cdd1af2494e456a0e05511
3
+ metadata.gz: d688aa913be9902d9b855c6f770a55128c220989
4
+ data.tar.gz: 1006cb799006206bbc404fd20e872a590368b1ad
5
5
  SHA512:
6
- metadata.gz: 1b8867df04a24d83ca590a9cce5ab200d3eae130a56f29e5629e102bfa133e94135d37be004eb86416f940e2d54285100bf0259ad293a1273f13be11c1d234d8
7
- data.tar.gz: ff48f6a029744d085a9caaffc29847facef02316327cd66d81da69faf1595919f387cf84a4080a4121208253ee5bfcdf9a6448889fa33712d076032efae9795f
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 = "Analysis settings for Languages and Engines are both valid but mutually exclusive. Note: command line analysis requires an Engines configuration.".freeze
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(incompatibility_message(key), key)
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
 
@@ -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
- root
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)
@@ -1,5 +1,5 @@
1
1
  module CC
2
2
  module Yaml
3
- VERSION = "0.0.7".freeze
3
+ VERSION = "0.0.8".freeze
4
4
  end
5
5
  end
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.7
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-13 00:00:00.000000000 Z
11
+ date: 2015-07-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: secure_string