puppet-lint-resource_reference_syntax 1.0.14 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/CHANGELOG.md +112 -0
- data/README.md +28 -3
- data/lib/puppet-lint/plugins/resource_reference_with_unquoted_title.rb +39 -0
- data/lib/puppet-lint/plugins/resource_reference_without_title_capital.rb +0 -6
- data/spec/puppet-lint/plugins/resource_reference_with_unquoted_title_spec.rb +207 -0
- data/spec/puppet-lint/plugins/resource_reference_without_title_capital_spec.rb +0 -13
- data/spec/spec_helper.rb +26 -0
- metadata +18 -15
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
|
-
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
2
|
+
SHA256:
|
|
3
|
+
metadata.gz: 9c9a6ebde35f12d98df1cce4eca6e732f53066211bd1206b8bbc936abe80d901
|
|
4
|
+
data.tar.gz: 20a5912273e3c6b3721b0c0a0e080d542bf7b3fc9d4175a33345fd1c8a5a50f0
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: f99e959beb3b512758423243365efe2fa0006c573595111bca0bebc67c652e699e007ba372931cecd2b277dae4f32a16f4c0ba4e2bf6b36a4be806fbc9cff566
|
|
7
|
+
data.tar.gz: 0f5030dc3ecf4aaba141da1656b4a90feff01721954e8114d28e3bda4ad90f989cb46e60c055daec36e8de8ab0dc27aee978a1d87745ac011d92d3d40629fc76
|
data/CHANGELOG.md
ADDED
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project will be documented in this file.
|
|
4
|
+
|
|
5
|
+
## [1.2.0](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.2.0) (2022-11-29)
|
|
6
|
+
|
|
7
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.1.0...1.2.0)
|
|
8
|
+
|
|
9
|
+
**Implemented enhancements:**
|
|
10
|
+
|
|
11
|
+
- puppet-lint: Allow 3.x [\#24](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/24) ([bastelfreak](https://github.com/bastelfreak))
|
|
12
|
+
|
|
13
|
+
**Merged pull requests:**
|
|
14
|
+
|
|
15
|
+
- cleanup README.md/gemspec [\#21](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/21) ([bastelfreak](https://github.com/bastelfreak))
|
|
16
|
+
|
|
17
|
+
## [1.1.0](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.1.0) (2020-04-14)
|
|
18
|
+
|
|
19
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.14...1.1.0)
|
|
20
|
+
|
|
21
|
+
**Implemented enhancements:**
|
|
22
|
+
|
|
23
|
+
- Break out quoted refs check and add fix [\#16](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/16) ([danzilio](https://github.com/danzilio))
|
|
24
|
+
|
|
25
|
+
**Closed issues:**
|
|
26
|
+
|
|
27
|
+
- Doesn't detect spaces when using chaining arrows syntax \("Class \['A'\] -\> Class \['B'\]"\) [\#14](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/14)
|
|
28
|
+
|
|
29
|
+
**Merged pull requests:**
|
|
30
|
+
|
|
31
|
+
- Remove ruby 1.9 from testing, add ruby 2.5 [\#17](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/17) ([tuxmea](https://github.com/tuxmea))
|
|
32
|
+
|
|
33
|
+
## [1.0.14](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.14) (2018-01-04)
|
|
34
|
+
|
|
35
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.13...1.0.14)
|
|
36
|
+
|
|
37
|
+
## [1.0.13](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.13) (2018-01-03)
|
|
38
|
+
|
|
39
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.12...1.0.13)
|
|
40
|
+
|
|
41
|
+
## [1.0.12](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.12) (2018-01-03)
|
|
42
|
+
|
|
43
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.11...1.0.12)
|
|
44
|
+
|
|
45
|
+
**Closed issues:**
|
|
46
|
+
|
|
47
|
+
- false resource\_reference\_without\_whitespace on resource collection [\#15](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/15)
|
|
48
|
+
- resource\_reference\_without\_whitespace error on resource collection [\#9](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/9)
|
|
49
|
+
|
|
50
|
+
## [1.0.11](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.11) (2017-12-30)
|
|
51
|
+
|
|
52
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.10...1.0.11)
|
|
53
|
+
|
|
54
|
+
**Merged pull requests:**
|
|
55
|
+
|
|
56
|
+
- release 1.0.10 [\#13](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/13) ([tuxmea](https://github.com/tuxmea))
|
|
57
|
+
|
|
58
|
+
## [1.0.10](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.10) (2016-11-17)
|
|
59
|
+
|
|
60
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.8...1.0.10)
|
|
61
|
+
|
|
62
|
+
**Closed issues:**
|
|
63
|
+
|
|
64
|
+
- False positive for require [\#10](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/10)
|
|
65
|
+
|
|
66
|
+
**Merged pull requests:**
|
|
67
|
+
|
|
68
|
+
- Restrict checking to the matched parameter only [\#12](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/12) ([cbowman0](https://github.com/cbowman0))
|
|
69
|
+
- Improve message for resources missing quotes [\#11](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/11) ([domcleal](https://github.com/domcleal))
|
|
70
|
+
- add travis with voxpupili key [\#8](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/8) ([tuxmea](https://github.com/tuxmea))
|
|
71
|
+
- Release 1.0.9 [\#7](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/7) ([bastelfreak](https://github.com/bastelfreak))
|
|
72
|
+
|
|
73
|
+
## [1.0.8](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.8) (2016-03-17)
|
|
74
|
+
|
|
75
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.7...1.0.8)
|
|
76
|
+
|
|
77
|
+
**Closed issues:**
|
|
78
|
+
|
|
79
|
+
- False warning: resource reference with title with capital letter [\#4](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/4)
|
|
80
|
+
- False warning: whitespce between reference type and title [\#3](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/3)
|
|
81
|
+
|
|
82
|
+
## [1.0.7](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.7) (2016-03-16)
|
|
83
|
+
|
|
84
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.6...1.0.7)
|
|
85
|
+
|
|
86
|
+
**Merged pull requests:**
|
|
87
|
+
|
|
88
|
+
- iterate over resource reference arrays [\#5](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/5) ([tuxmea](https://github.com/tuxmea))
|
|
89
|
+
|
|
90
|
+
## [1.0.6](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.6) (2016-01-25)
|
|
91
|
+
|
|
92
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.5...1.0.6)
|
|
93
|
+
|
|
94
|
+
**Closed issues:**
|
|
95
|
+
|
|
96
|
+
- Wrong match when a variable is in the title [\#1](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/issues/1)
|
|
97
|
+
|
|
98
|
+
**Merged pull requests:**
|
|
99
|
+
|
|
100
|
+
- Fix wrong match on titles with variables \(fixes \#1\) [\#2](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/pull/2) ([vStone](https://github.com/vStone))
|
|
101
|
+
|
|
102
|
+
## [1.0.5](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.5) (2015-11-26)
|
|
103
|
+
|
|
104
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/1.0.4...1.0.5)
|
|
105
|
+
|
|
106
|
+
## [1.0.4](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/tree/1.0.4) (2015-10-18)
|
|
107
|
+
|
|
108
|
+
[Full Changelog](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/compare/5ef5832a944246df5d3e7c781085e3a76357b641...1.0.4)
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
|
data/README.md
CHANGED
|
@@ -1,7 +1,13 @@
|
|
|
1
1
|
# puppet-lint plugin resource reference check
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
[](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/blob/master/LICENSE)
|
|
4
|
+
[](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/actions/workflows/test.yml)
|
|
5
|
+
[](https://github.com/voxpupuli/puppet-lint-resource_reference_syntax/actions/workflows/release.yml)
|
|
6
|
+
[](https://rubygems.org/gems/puppet-lint-resource_reference_syntax)
|
|
7
|
+
[](https://rubygems.org/gems/puppet-lint-resource_reference_syntax)
|
|
8
|
+
[](#transfer-notice)
|
|
9
|
+
|
|
10
|
+
**Note, this plugin will check for Puppet resource reference syntax which will no longer work with Puppet 4.x.**
|
|
5
11
|
|
|
6
12
|
## Installation
|
|
7
13
|
|
|
@@ -55,7 +61,26 @@ The following references are good code for Puppet 4:
|
|
|
55
61
|
|
|
56
62
|
```
|
|
57
63
|
require => Service['apache'],
|
|
58
|
-
require => Service['apache', 'mysql'],
|
|
64
|
+
require => Service['apache', 'mysql'],
|
|
59
65
|
require => [ Service['apache'], Service['mysql'] ],
|
|
60
66
|
```
|
|
61
67
|
|
|
68
|
+
## Transfer Notice
|
|
69
|
+
|
|
70
|
+
This plugin was originally authored by [example42](https://example42.de).
|
|
71
|
+
The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
|
|
72
|
+
Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Camptocamp.
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
This gem is licensed under the Apache-2 license.
|
|
77
|
+
|
|
78
|
+
## Release information
|
|
79
|
+
|
|
80
|
+
To make a new release, please do:
|
|
81
|
+
* update the version in the gemspec file
|
|
82
|
+
* Install gems with `bundle install --with release --path .vendor`
|
|
83
|
+
* generate the changelog with `bundle exec rake changelog`
|
|
84
|
+
* Check if the new version matches the closed issues/PRs in the changelog
|
|
85
|
+
* Create a PR with it
|
|
86
|
+
* After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
PuppetLint.new_check(:resource_reference_with_unquoted_title) do
|
|
2
|
+
def check
|
|
3
|
+
resource_indexes.each do |resource|
|
|
4
|
+
resource[:param_tokens].select { |param_token|
|
|
5
|
+
['require', 'subscribe', 'notify', 'before', 'consume', 'export'].include? param_token.value
|
|
6
|
+
}.each do |param_token|
|
|
7
|
+
value_token = param_token.next_code_token
|
|
8
|
+
check = value_token.next_token
|
|
9
|
+
until resource[:param_tokens].include? check or not resource[:tokens].include? check or check.nil?
|
|
10
|
+
case value_token.next_token.type
|
|
11
|
+
when :CLASSREF
|
|
12
|
+
begin
|
|
13
|
+
if value_token.next_token.next_token.type == :LBRACK
|
|
14
|
+
check_token = value_token.next_token.next_token.next_token
|
|
15
|
+
if check_token.type == :NAME
|
|
16
|
+
notify :error, {
|
|
17
|
+
:message => 'unquoted title in resource reference',
|
|
18
|
+
:line => check_token.line,
|
|
19
|
+
:column => check_token.column,
|
|
20
|
+
:token => check_token,
|
|
21
|
+
}
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
value_token = value_token.next_token
|
|
25
|
+
check = value_token.next_token
|
|
26
|
+
end
|
|
27
|
+
else
|
|
28
|
+
value_token = value_token.next_token
|
|
29
|
+
check = value_token.next_token
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def fix(problem)
|
|
37
|
+
problem[:token].type = :SSTRING
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -18,12 +18,6 @@ PuppetLint.new_check(:resource_reference_without_title_capital) do
|
|
|
18
18
|
:line => check_token.line,
|
|
19
19
|
:column => check_token.column
|
|
20
20
|
}
|
|
21
|
-
elsif check_token.type == :NAME
|
|
22
|
-
notify :error, {
|
|
23
|
-
:message => 'resource reference with title with missing quotes',
|
|
24
|
-
:line => check_token.line,
|
|
25
|
-
:column => check_token.column
|
|
26
|
-
}
|
|
27
21
|
end
|
|
28
22
|
end
|
|
29
23
|
value_token = value_token.next_token
|
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe 'resource_reference_with_unquoted_title' do
|
|
4
|
+
let(:msg) { 'unquoted title in resource reference' }
|
|
5
|
+
|
|
6
|
+
context 'with fix disabled' do
|
|
7
|
+
context 'quoted resource ref on single line resource' do
|
|
8
|
+
let(:code) { "file { 'foo': require => File['bar'] }" }
|
|
9
|
+
|
|
10
|
+
it 'should not detect any problems' do
|
|
11
|
+
expect(problems).to have(0).problems
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
context 'unquoted resource ref on single line resource' do
|
|
16
|
+
let(:code) { "file { 'foo': require => File[bar] }" }
|
|
17
|
+
|
|
18
|
+
it 'should only detect a single problem' do
|
|
19
|
+
expect(problems).to have(1).problem
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
it 'should raise an error' do
|
|
23
|
+
expect(problems).to contain_error(msg).on_line(1).in_column(31)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
context 'quoted resource ref on multi line resource' do
|
|
29
|
+
let(:code) do
|
|
30
|
+
<<-END
|
|
31
|
+
file { 'foo':
|
|
32
|
+
require => File['bar'],
|
|
33
|
+
}
|
|
34
|
+
END
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
it 'should not detect any problems' do
|
|
38
|
+
expect(problems).to have(0).problems
|
|
39
|
+
end
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
context 'unquoted resource ref on multi line resource' do
|
|
43
|
+
let(:code) do
|
|
44
|
+
<<-END
|
|
45
|
+
file { 'foo':
|
|
46
|
+
require => File[bar]
|
|
47
|
+
}
|
|
48
|
+
END
|
|
49
|
+
end
|
|
50
|
+
|
|
51
|
+
it 'should only detect a single problem' do
|
|
52
|
+
expect(problems).to have(1).problem
|
|
53
|
+
end
|
|
54
|
+
|
|
55
|
+
it 'should raise an error' do
|
|
56
|
+
expect(problems).to contain_error(msg).on_line(2).in_column(29)
|
|
57
|
+
end
|
|
58
|
+
end
|
|
59
|
+
|
|
60
|
+
context 'condensed resources with quoted refs' do
|
|
61
|
+
let(:code) do
|
|
62
|
+
<<-END
|
|
63
|
+
file {
|
|
64
|
+
'foo':
|
|
65
|
+
require => File['bar'];
|
|
66
|
+
'bar':
|
|
67
|
+
require => File['baz'];
|
|
68
|
+
}
|
|
69
|
+
END
|
|
70
|
+
end
|
|
71
|
+
|
|
72
|
+
it 'should not detect any problems' do
|
|
73
|
+
expect(problems).to have(0).problems
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
context 'condensed resources with an unquoted ref' do
|
|
78
|
+
let(:code) do
|
|
79
|
+
<<-END
|
|
80
|
+
file {
|
|
81
|
+
'foo':
|
|
82
|
+
require => File[bar];
|
|
83
|
+
'bar':
|
|
84
|
+
require => File['baz'];
|
|
85
|
+
}
|
|
86
|
+
END
|
|
87
|
+
end
|
|
88
|
+
|
|
89
|
+
it 'should only detect a single problem' do
|
|
90
|
+
expect(problems).to have(1).problem
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
it 'should raise an error' do
|
|
94
|
+
expect(problems).to contain_error(msg).on_line(3).in_column(31)
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
context 'resource refs with interpolated variables' do
|
|
99
|
+
let(:code) do
|
|
100
|
+
<<-END
|
|
101
|
+
$file = 'bar'
|
|
102
|
+
|
|
103
|
+
file { 'foo':
|
|
104
|
+
require => File[$file]
|
|
105
|
+
}
|
|
106
|
+
END
|
|
107
|
+
end
|
|
108
|
+
|
|
109
|
+
it 'should not detect any problems' do
|
|
110
|
+
expect(problems).to have(0).problems
|
|
111
|
+
end
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
end
|
|
115
|
+
|
|
116
|
+
context 'with fix enabled' do
|
|
117
|
+
before do
|
|
118
|
+
PuppetLint.configuration.fix = true
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
after do
|
|
122
|
+
PuppetLint.configuration.fix = false
|
|
123
|
+
end
|
|
124
|
+
|
|
125
|
+
context 'unquoted resource ref on single line resource' do
|
|
126
|
+
let(:code) { "file { 'foo': require => File[bar] }" }
|
|
127
|
+
|
|
128
|
+
it 'should only detect a single problem' do
|
|
129
|
+
expect(problems).to have(1).problem
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
it 'should fix the manifest' do
|
|
133
|
+
expect(problems).to contain_fixed(msg).on_line(1).in_column(31)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
it 'should single quote the resource title' do
|
|
137
|
+
expect(manifest).to eq("file { 'foo': require => File['bar'] }")
|
|
138
|
+
end
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
context 'unquoted resource ref on multi line resource' do
|
|
142
|
+
let(:code) do
|
|
143
|
+
<<-END
|
|
144
|
+
file { 'foo':
|
|
145
|
+
require => File[bar]
|
|
146
|
+
}
|
|
147
|
+
END
|
|
148
|
+
end
|
|
149
|
+
|
|
150
|
+
let(:fixed) do
|
|
151
|
+
<<-END
|
|
152
|
+
file { 'foo':
|
|
153
|
+
require => File['bar']
|
|
154
|
+
}
|
|
155
|
+
END
|
|
156
|
+
end
|
|
157
|
+
|
|
158
|
+
it 'should only detect a single problem' do
|
|
159
|
+
expect(problems).to have(1).problem
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
it 'should fix the manifest' do
|
|
163
|
+
expect(problems).to contain_fixed(msg).on_line(2).in_column(29)
|
|
164
|
+
end
|
|
165
|
+
|
|
166
|
+
it 'should single quote the resource ref' do
|
|
167
|
+
expect(manifest).to eq(fixed)
|
|
168
|
+
end
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
context 'condensed resources with an unquoted ref' do
|
|
172
|
+
let(:code) do
|
|
173
|
+
<<-END
|
|
174
|
+
file {
|
|
175
|
+
'foo':
|
|
176
|
+
require => File[bar];
|
|
177
|
+
'bar':
|
|
178
|
+
require => File['baz'];
|
|
179
|
+
}
|
|
180
|
+
END
|
|
181
|
+
end
|
|
182
|
+
|
|
183
|
+
let(:fixed) do
|
|
184
|
+
<<-END
|
|
185
|
+
file {
|
|
186
|
+
'foo':
|
|
187
|
+
require => File['bar'];
|
|
188
|
+
'bar':
|
|
189
|
+
require => File['baz'];
|
|
190
|
+
}
|
|
191
|
+
END
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
it 'should only detect a single problem' do
|
|
195
|
+
expect(problems).to have(1).problem
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
it 'should fix the manifest' do
|
|
199
|
+
expect(problems).to contain_fixed(msg).on_line(3).in_column(31)
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
it 'should single quote the resource title' do
|
|
203
|
+
expect(manifest).to eq(fixed)
|
|
204
|
+
end
|
|
205
|
+
end
|
|
206
|
+
end
|
|
207
|
+
end
|
|
@@ -99,19 +99,6 @@ describe 'resource_reference_without_title_capital' do
|
|
|
99
99
|
end
|
|
100
100
|
end
|
|
101
101
|
|
|
102
|
-
context 'resource reference with title without quotes' do
|
|
103
|
-
let(:msg) { 'resource reference with title with missing quotes' }
|
|
104
|
-
let(:code) { "file { 'foo': ensure => file, notify => Title[one],}" }
|
|
105
|
-
|
|
106
|
-
it 'should only detect a single problem' do
|
|
107
|
-
expect(problems).to have(1).problem
|
|
108
|
-
end
|
|
109
|
-
|
|
110
|
-
it 'should create an error' do
|
|
111
|
-
expect(problems).to contain_error(msg).on_line(1)
|
|
112
|
-
end
|
|
113
|
-
end
|
|
114
|
-
|
|
115
102
|
context 'stay within the parameter context' do
|
|
116
103
|
let(:code) { "file { 'foo': ensure => file, notify => Title['One'],} $var = [ Exec[runsomething] ]" }
|
|
117
104
|
|
data/spec/spec_helper.rb
CHANGED
|
@@ -1,3 +1,29 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
begin
|
|
4
|
+
require 'simplecov'
|
|
5
|
+
require 'simplecov-console'
|
|
6
|
+
require 'codecov'
|
|
7
|
+
rescue LoadError
|
|
8
|
+
else
|
|
9
|
+
SimpleCov.start do
|
|
10
|
+
track_files 'lib/**/*.rb'
|
|
11
|
+
|
|
12
|
+
add_filter '/spec'
|
|
13
|
+
|
|
14
|
+
enable_coverage :branch
|
|
15
|
+
|
|
16
|
+
# do not track vendored files
|
|
17
|
+
add_filter '/vendor'
|
|
18
|
+
add_filter '/.vendor'
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
SimpleCov.formatters = [
|
|
22
|
+
SimpleCov::Formatter::Console,
|
|
23
|
+
SimpleCov::Formatter::Codecov,
|
|
24
|
+
]
|
|
25
|
+
end
|
|
26
|
+
|
|
1
27
|
require 'puppet-lint'
|
|
2
28
|
|
|
3
29
|
PuppetLint::Plugins.load_spec_helper
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: puppet-lint-resource_reference_syntax
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 1.0
|
|
4
|
+
version: 1.2.0
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
|
-
-
|
|
7
|
+
- Vox Pupuli
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date:
|
|
11
|
+
date: 2022-11-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: puppet-lint
|
|
@@ -19,7 +19,7 @@ dependencies:
|
|
|
19
19
|
version: '1.0'
|
|
20
20
|
- - "<"
|
|
21
21
|
- !ruby/object:Gem::Version
|
|
22
|
-
version: '
|
|
22
|
+
version: '4'
|
|
23
23
|
type: :runtime
|
|
24
24
|
prerelease: false
|
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
|
@@ -29,7 +29,7 @@ dependencies:
|
|
|
29
29
|
version: '1.0'
|
|
30
30
|
- - "<"
|
|
31
31
|
- !ruby/object:Gem::Version
|
|
32
|
-
version: '
|
|
32
|
+
version: '4'
|
|
33
33
|
- !ruby/object:Gem::Dependency
|
|
34
34
|
name: rspec
|
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -76,50 +76,53 @@ dependencies:
|
|
|
76
76
|
name: rake
|
|
77
77
|
requirement: !ruby/object:Gem::Requirement
|
|
78
78
|
requirements:
|
|
79
|
-
- - "
|
|
79
|
+
- - ">="
|
|
80
80
|
- !ruby/object:Gem::Version
|
|
81
81
|
version: '0'
|
|
82
82
|
type: :development
|
|
83
83
|
prerelease: false
|
|
84
84
|
version_requirements: !ruby/object:Gem::Requirement
|
|
85
85
|
requirements:
|
|
86
|
-
- - "
|
|
86
|
+
- - ">="
|
|
87
87
|
- !ruby/object:Gem::Version
|
|
88
88
|
version: '0'
|
|
89
89
|
- !ruby/object:Gem::Dependency
|
|
90
90
|
name: simplecov
|
|
91
91
|
requirement: !ruby/object:Gem::Requirement
|
|
92
92
|
requirements:
|
|
93
|
-
- - "
|
|
93
|
+
- - ">="
|
|
94
94
|
- !ruby/object:Gem::Version
|
|
95
95
|
version: '0'
|
|
96
96
|
type: :development
|
|
97
97
|
prerelease: false
|
|
98
98
|
version_requirements: !ruby/object:Gem::Requirement
|
|
99
99
|
requirements:
|
|
100
|
-
- - "
|
|
100
|
+
- - ">="
|
|
101
101
|
- !ruby/object:Gem::Version
|
|
102
102
|
version: '0'
|
|
103
|
-
description:
|
|
104
|
-
|
|
105
|
-
email:
|
|
103
|
+
description: " Extends puppet-lint to ensure that the reference syntax follows
|
|
104
|
+
Puppet 4 style\n"
|
|
105
|
+
email: voxpupuli@groups.io
|
|
106
106
|
executables: []
|
|
107
107
|
extensions: []
|
|
108
108
|
extra_rdoc_files: []
|
|
109
109
|
files:
|
|
110
110
|
- ".rspec"
|
|
111
|
+
- CHANGELOG.md
|
|
111
112
|
- LICENSE
|
|
112
113
|
- README.md
|
|
113
114
|
- lib/puppet-lint/plugins/resource_reference_chain_without_whitespace.rb
|
|
115
|
+
- lib/puppet-lint/plugins/resource_reference_with_unquoted_title.rb
|
|
114
116
|
- lib/puppet-lint/plugins/resource_reference_without_title_capital.rb
|
|
115
117
|
- lib/puppet-lint/plugins/resource_reference_without_whitespace.rb
|
|
116
118
|
- spec/puppet-lint/plugins/resource_reference_chain_without_whitespace_spec.rb
|
|
119
|
+
- spec/puppet-lint/plugins/resource_reference_with_unquoted_title_spec.rb
|
|
117
120
|
- spec/puppet-lint/plugins/resource_reference_without_title_capital_spec.rb
|
|
118
121
|
- spec/puppet-lint/plugins/resource_reference_without_whitespace_spec.rb
|
|
119
122
|
- spec/spec_helper.rb
|
|
120
123
|
homepage: https://github.com/voxpupuli/puppet-lint-resource_reference_syntax
|
|
121
124
|
licenses:
|
|
122
|
-
-
|
|
125
|
+
- Apache-2.0
|
|
123
126
|
metadata: {}
|
|
124
127
|
post_install_message:
|
|
125
128
|
rdoc_options: []
|
|
@@ -136,13 +139,13 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
136
139
|
- !ruby/object:Gem::Version
|
|
137
140
|
version: '0'
|
|
138
141
|
requirements: []
|
|
139
|
-
|
|
140
|
-
rubygems_version: 2.4.8
|
|
142
|
+
rubygems_version: 3.2.33
|
|
141
143
|
signing_key:
|
|
142
144
|
specification_version: 4
|
|
143
145
|
summary: puppet-lint reference_syntax check
|
|
144
146
|
test_files:
|
|
145
147
|
- spec/puppet-lint/plugins/resource_reference_chain_without_whitespace_spec.rb
|
|
148
|
+
- spec/puppet-lint/plugins/resource_reference_with_unquoted_title_spec.rb
|
|
146
149
|
- spec/puppet-lint/plugins/resource_reference_without_title_capital_spec.rb
|
|
147
150
|
- spec/puppet-lint/plugins/resource_reference_without_whitespace_spec.rb
|
|
148
151
|
- spec/spec_helper.rb
|