codeclimate-yaml 0.0.3 → 0.0.4

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: 2e53c3cfeac47e6e8e5ee14f71e1a07f8cbed24c
4
- data.tar.gz: f6c1730f9692f01d37def2b7a6b1783179498d1a
3
+ metadata.gz: c87debedccaa398765218009e2510a9af9c7a65f
4
+ data.tar.gz: 5763001c96f55a2abc81863aa2a33e90cfd8eceb
5
5
  SHA512:
6
- metadata.gz: b5f55e36440282ca832b6170d1e06b78c404e951c5f24469626abe653ec2c3bfbbc47f91edcf38678080c35d99479487eb69ded3c4908d2d042f85395d9cfbca
7
- data.tar.gz: cd21c9de593060ac4d33667a86ddb8a51aee385adcdd1374747d5368e2168341e3d1ef9a8d04c978860ae3574b300da0fc10130bf34e2bee736164b6f1f98bb3
6
+ metadata.gz: 40c5ecec68e59edfb2c518678a0cae4107e26844160f8823e2925d422aa1c7e7d586f0eb4fc7814e5eb903597b9fd9e696f06259b031d8e596fbf5bbcda5b883
7
+ data.tar.gz: b47ae770a431cf9a20c7274d7ae3a9392ab10d53a970bfbd841433db5660a479e2e37d4a23ae831d8eb173aee372d2eca7bfb7bc734536194671e00c44c3a013
@@ -51,16 +51,33 @@ module CC::Yaml
51
51
 
52
52
  def visit_pair(visitor, key, value)
53
53
  key = visitor.generate_key(self, key)
54
- visit_key_value(visitor, key, value)
54
+ if get_warnings(key)
55
+ get_warnings(key)
56
+ else
57
+ visit_key_value(visitor, key, value)
58
+ end
55
59
  end
56
60
 
57
61
  def visit_key_value(visitor, key, value)
58
- return warning("unexpected key %p, dropping", key) unless node = subnode_for(key)
59
- warning("has multiple %p entries, keeping last entry", key) if self[key]
62
+ node = subnode_for(key)
60
63
  self[key] = node
61
64
  visitor.accept(node, value)
62
65
  end
63
66
 
67
+ def get_warnings(key)
68
+ if subnode_for(key)
69
+ check_duplicates(key)
70
+ elsif key == "languages"
71
+ warning("analysis by language not available via CLI. Use engines configuration instead.")
72
+ else
73
+ warning("unexpected key %p, dropping", key)
74
+ end
75
+ end
76
+
77
+ def check_duplicates(key)
78
+ warning("has multiple %p entries, keeping last entry", key) if self[key]
79
+ end
80
+
64
81
  def []=(key, value)
65
82
  if mapped_key = mapped_key(key)
66
83
  unless value.is_a? Node
@@ -1,5 +1,5 @@
1
1
  module CC
2
2
  module Yaml
3
- VERSION = "0.0.3".freeze
3
+ VERSION = "0.0.4".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.3
4
+ version: 0.0.4
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-06-15 00:00:00.000000000 Z
11
+ date: 2015-06-29 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: secure_string