puppet-lint-legacy_facts-check 0.0.6 → 1.0.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
  SHA256:
3
- metadata.gz: 9a7f2391ddc2702af498700ea0b6d0b8ba497c4a2e4ec5fe1c4435ccbf8bace9
4
- data.tar.gz: f8d7e0285d707ff2573c5ab3c192d2ef0091471a00c889a0fa767acd22e4299a
3
+ metadata.gz: cd3cb8032b34bedd7b911d90349ee7e0b921e09c72759da6333830975d060f6f
4
+ data.tar.gz: 6ab5ba872068cb338625ea655bb696d5f9d3d46599dfc7260f35aa745a2c0e40
5
5
  SHA512:
6
- metadata.gz: 20e2f8fe27fb5040a4de485946553c0c40571a3852f0f7b47ca88c7ee0e336a1c1aecf60b13abec13d79cf69d235e21168c0d85f3516a4aee6efa82f77ebd8e7
7
- data.tar.gz: e52f2ab36c8181c51abc12adba813e364a13798291226b3c1750d6e4ca2dbd1388848feab44c8d9e96a5ded608b43fe472b43760f8a8f853e5caf5f914e50bfd
6
+ metadata.gz: 357229fe8dd7417ebc38053ec7eeb174cefac881651dff55d47be03af62f04c6f936059f98499cf33cc9eb7e314c31d842b61b308b263322b3c89ae8dd04cbe8
7
+ data.tar.gz: 459f5115df04d1f6c682076a82ad8e3377d7786fb85b301f57d72baee2052ced015dfbf704b24477da6e6e875577124650137bfea40a14ed125d68843843266a
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  [![Build Status](https://travis-ci.org/mmckinst/puppet-lint-legacy_facts-check.svg?branch=master)](https://travis-ci.org/mmckinst/puppet-lint-legacy_facts-check)
2
2
  [![Gem](https://img.shields.io/gem/v/puppet-lint-legacy_facts-check.svg?maxAge=2592000)](https://rubygems.org/gems/puppet-lint-legacy_facts-check)
3
+ ![](https://img.shields.io/gem/dtv/puppet-lint-legacy_facts-check.svg?style=flat)
4
+ ![](https://img.shields.io/gem/dt/puppet-lint-legacy_facts-check.svg?style=flat)
3
5
 
4
6
  ## Overview
5
7
 
@@ -1,4 +1,5 @@
1
1
  PuppetLint.new_check(:legacy_facts) do
2
+ VAR_TYPES = Set[:VARIABLE, :UNENC_VARIABLE]
2
3
 
3
4
  # These facts that can't be converted to new facts for reasons documented at
4
5
  # https://github.com/mmckinst/puppet-lint-legacy_facts-check#limitations
@@ -96,7 +97,7 @@ PuppetLint.new_check(:legacy_facts) do
96
97
  'zonename' => "facts['solaris_zones']['current']",
97
98
  }
98
99
  def check
99
- tokens.select { |x| x.type == :VARIABLE}.each do |token|
100
+ tokens.select { |x| VAR_TYPES.include?(x.type) }.each do |token|
100
101
  fact_name = ''
101
102
 
102
103
  # Get rid of the top scope before we do our work. We don't need to
@@ -22,7 +22,7 @@ describe 'legacy_facts' do
22
22
  context "fact variable using legacy $osfamily" do
23
23
  let(:code) { "$osfamily" }
24
24
 
25
- it 'should only detect a single problem' do
25
+ it 'should not detect any problems' do
26
26
  expect(problems).to have(0).problem
27
27
  end
28
28
  end
@@ -98,6 +98,14 @@ describe 'legacy_facts' do
98
98
  expect(problems).to have(1).problem
99
99
  end
100
100
  end
101
+
102
+ context "fact variable using legacy variable in double quotes \"$::osfamily\"" do
103
+ let(:code) { "\"$::osfamily\"" }
104
+
105
+ it 'should only detect a single problem' do
106
+ expect(problems).to have(1).problem
107
+ end
108
+ end
101
109
  end
102
110
 
103
111
 
@@ -129,9 +137,10 @@ describe 'legacy_facts' do
129
137
  context "fact variable using legacy $osfamily" do
130
138
  let(:code) { "$osfamily" }
131
139
 
132
- it 'should only detect a single problem' do
140
+ it 'should not detect any problems' do
133
141
  expect(problems).to have(0).problem
134
142
  end
143
+
135
144
  end
136
145
 
137
146
  context "fact variable using legacy $facts['osfamily']" do
@@ -271,5 +280,17 @@ describe 'legacy_facts' do
271
280
  expect(manifest).to eq('"start '"${facts['os']['family']}"' end"')
272
281
  end
273
282
  end
283
+
284
+ context "fact variable using legacy variable in double quotes \"$::osfamily\"" do
285
+ let(:code) { "\"$::osfamily\"" }
286
+
287
+ it 'should only detect a single problem' do
288
+ expect(problems).to have(1).problem
289
+ end
290
+
291
+ it 'should use the facts hash' do
292
+ expect(manifest).to eq("\"$facts['os']['family']\"")
293
+ end
294
+ end
274
295
  end
275
296
  end
@@ -1,3 +1,7 @@
1
1
  require 'puppet-lint'
2
2
 
3
3
  PuppetLint::Plugins.load_spec_helper
4
+
5
+ RSpec.configure do |config|
6
+ config.formatter = :documentation
7
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puppet-lint-legacy_facts-check
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mark McKinstry
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-01-10 00:00:00.000000000 Z
11
+ date: 2019-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint
@@ -141,7 +141,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
141
141
  - !ruby/object:Gem::Version
142
142
  version: '0'
143
143
  requirements: []
144
- rubygems_version: 3.0.2
144
+ rubygems_version: 3.0.3
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: A puppet-lint plugin to check you are not using legacy facts like $::operatingsystem