puppet-lint-appends-check 0.1.0 → 1.0.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f62c77be82687d0a9a49e899bd31cdfacebd3db4f0e5dc276ca1feb481d8e6f1
|
4
|
+
data.tar.gz: 0cd4da8f8d531d577db73529c80c539c9e2075deb6901b7f5b5c8bbe6e146469
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a588d8a9b4c90dc53979dadddf167d30d400f1a085dbea99c76fb6378e182fd105d66b5c5b3ffbca185c14f3fdbdb21a3703b636643b9582795b7e420371624e
|
7
|
+
data.tar.gz: '09c9e52488e0b572f962adfe218276d259347604ac9218b232a62610b9bbe5c25074c8195b5af7a300c5a9a252d36f0daebeb36cdf699c8bf43446cacda10811'
|
data/README.md
CHANGED
@@ -1,11 +1,13 @@
|
|
1
1
|
puppet-lint-appends-check
|
2
2
|
====================================
|
3
3
|
|
4
|
-
[](https://github.com/voxpupuli/puppet-lint-appends-check/blob/master/LICENSE)
|
5
|
+
[](https://github.com/voxpupuli/puppet-lint-appends-check/actions/workflows/test.yml)
|
6
|
+
[](https://github.com/voxpupuli/puppet-lint-appends-check/actions/workflows/release.yml)
|
7
|
+
[](https://rubygems.org/gems/puppet-lint-appends-check)
|
8
|
+
[](https://rubygems.org/gems/puppet-lint-appends-check)
|
9
|
+
[](#transfer-notice)
|
10
|
+
A puppet-lint plugin to check that the append (+=) operator is unused.
|
9
11
|
|
10
12
|
## Installing
|
11
13
|
|
@@ -23,9 +25,9 @@ gem 'puppet-lint-appends-check', :require => false
|
|
23
25
|
|
24
26
|
## Checks
|
25
27
|
|
26
|
-
###
|
28
|
+
### Append operator use
|
27
29
|
|
28
|
-
|
30
|
+
Use of the append operator can lead to unexpected behavior.
|
29
31
|
|
30
32
|
#### What you have done
|
31
33
|
|
@@ -46,6 +48,11 @@ $ssh_users = ['myself', 'someone', 'someone_else']
|
|
46
48
|
$ssh_users = hiera('ssh_users')
|
47
49
|
```
|
48
50
|
|
51
|
+
#### Auto fixing
|
52
|
+
|
53
|
+
There is not one way to properly fix this type of style error, so
|
54
|
+
running puppet-lint's fix feature will not have any effect.
|
55
|
+
|
49
56
|
#### Disabling the check
|
50
57
|
|
51
58
|
To disable this check, you can add `--no-appends-check` to your puppet-lint command line.
|
@@ -59,4 +66,22 @@ Alternatively, if you’re calling puppet-lint via the Rake task, you should ins
|
|
59
66
|
```ruby
|
60
67
|
PuppetLint.configuration.send('disable_appends')
|
61
68
|
```
|
69
|
+
## Transfer Notice
|
70
|
+
|
71
|
+
This plugin was originally authored by [Puppet Inc](http://puppet.com).
|
72
|
+
The maintainer preferred that Puppet Community take ownership of the module for future improvement and maintenance.
|
73
|
+
Existing pull requests and issues were transferred over, please fork and continue to contribute here instead of Puppet Inc.
|
74
|
+
|
75
|
+
## License
|
76
|
+
|
77
|
+
This gem is licensed under the Apache-2 license.
|
78
|
+
|
79
|
+
## Release information
|
62
80
|
|
81
|
+
To make a new release, please do:
|
82
|
+
* update the version in the gemspec file
|
83
|
+
* Install gems with `bundle install --with release --path .vendor`
|
84
|
+
* generate the changelog with `bundle exec rake changelog`
|
85
|
+
* Check if the new version matches the closed issues/PRs in the changelog
|
86
|
+
* Create a PR with it
|
87
|
+
* After it got merged, push a tag. GitHub actions will do the actual release to rubygems and GitHub Packages
|
@@ -0,0 +1,105 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'appends' do
|
4
|
+
let(:msg) { 'The appends (+=) operator was used.' }
|
5
|
+
|
6
|
+
context 'with fix disabled' do
|
7
|
+
context 'when the appends operator is not used' do
|
8
|
+
let(:code) do
|
9
|
+
<<-EOS
|
10
|
+
$foo = ['bar', 'baz']
|
11
|
+
$gary = 'is loud'
|
12
|
+
$people = {
|
13
|
+
'tim' => 'is beardy',
|
14
|
+
'nigel' => "isn't so much"
|
15
|
+
}
|
16
|
+
EOS
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should not detect any problems' do
|
20
|
+
expect(problems).to have(0).problems
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context 'when the appends operator is used' do
|
25
|
+
let(:code) do
|
26
|
+
<<-EOS
|
27
|
+
$foo += ['bar', 'baz']
|
28
|
+
$gary += 'is loud'
|
29
|
+
$people += {
|
30
|
+
'tim' => 'is beardy',
|
31
|
+
'nigel' => "isn't so much"
|
32
|
+
}
|
33
|
+
EOS
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should detect 3 problems' do
|
37
|
+
expect(problems).to have(3).problems
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should create warnings' do
|
41
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(17)
|
42
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(17)
|
43
|
+
expect(problems).to contain_warning(msg).on_line(3).in_column(17)
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
context 'with fix enabled' do
|
49
|
+
before do
|
50
|
+
PuppetLint.configuration.fix = true
|
51
|
+
end
|
52
|
+
|
53
|
+
after do
|
54
|
+
PuppetLint.configuration.fix = false
|
55
|
+
end
|
56
|
+
|
57
|
+
context 'when the appends operator is not used' do
|
58
|
+
let(:code) do
|
59
|
+
<<-EOS
|
60
|
+
$foo = ['bar', 'baz']
|
61
|
+
$gary = 'is loud'
|
62
|
+
$people = {
|
63
|
+
'tim' => 'is beardy',
|
64
|
+
'nigel' => "isn't so much"
|
65
|
+
}
|
66
|
+
EOS
|
67
|
+
end
|
68
|
+
|
69
|
+
it 'should not detect any problems' do
|
70
|
+
expect(problems).to have(0).problems
|
71
|
+
end
|
72
|
+
|
73
|
+
it 'should not modify the manifest' do
|
74
|
+
expect(manifest).to eq(code)
|
75
|
+
end
|
76
|
+
end
|
77
|
+
|
78
|
+
context 'when the appends operator is used' do
|
79
|
+
let(:code) do
|
80
|
+
<<-EOS
|
81
|
+
$foo += ['bar', 'baz']
|
82
|
+
$gary += 'is loud'
|
83
|
+
$people += {
|
84
|
+
'tim' => 'is beardy',
|
85
|
+
'nigel' => "isn't so much"
|
86
|
+
}
|
87
|
+
EOS
|
88
|
+
end
|
89
|
+
|
90
|
+
it 'should detect 3 problems' do
|
91
|
+
expect(problems).to have(3).problems
|
92
|
+
end
|
93
|
+
|
94
|
+
it 'should create warnings' do
|
95
|
+
expect(problems).to contain_warning(msg).on_line(1).in_column(17)
|
96
|
+
expect(problems).to contain_warning(msg).on_line(2).in_column(17)
|
97
|
+
expect(problems).to contain_warning(msg).on_line(3).in_column(17)
|
98
|
+
end
|
99
|
+
|
100
|
+
it 'should not fix the ensure parameter because that is not implemented' do
|
101
|
+
expect(manifest).to eq(code)
|
102
|
+
end
|
103
|
+
end
|
104
|
+
end
|
105
|
+
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,126 +1,132 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-appends-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 1.0.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: 2021-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '3.0'
|
20
23
|
type: :runtime
|
21
24
|
prerelease: false
|
22
25
|
version_requirements: !ruby/object:Gem::Requirement
|
23
26
|
requirements:
|
24
|
-
- -
|
27
|
+
- - ">="
|
25
28
|
- !ruby/object:Gem::Version
|
26
29
|
version: '1.0'
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '3.0'
|
27
33
|
- !ruby/object:Gem::Dependency
|
28
34
|
name: rspec
|
29
35
|
requirement: !ruby/object:Gem::Requirement
|
30
36
|
requirements:
|
31
|
-
- - ~>
|
37
|
+
- - "~>"
|
32
38
|
- !ruby/object:Gem::Version
|
33
39
|
version: '3.0'
|
34
40
|
type: :development
|
35
41
|
prerelease: false
|
36
42
|
version_requirements: !ruby/object:Gem::Requirement
|
37
43
|
requirements:
|
38
|
-
- - ~>
|
44
|
+
- - "~>"
|
39
45
|
- !ruby/object:Gem::Version
|
40
46
|
version: '3.0'
|
41
47
|
- !ruby/object:Gem::Dependency
|
42
48
|
name: rspec-its
|
43
49
|
requirement: !ruby/object:Gem::Requirement
|
44
50
|
requirements:
|
45
|
-
- - ~>
|
51
|
+
- - "~>"
|
46
52
|
- !ruby/object:Gem::Version
|
47
53
|
version: '1.0'
|
48
54
|
type: :development
|
49
55
|
prerelease: false
|
50
56
|
version_requirements: !ruby/object:Gem::Requirement
|
51
57
|
requirements:
|
52
|
-
- - ~>
|
58
|
+
- - "~>"
|
53
59
|
- !ruby/object:Gem::Version
|
54
60
|
version: '1.0'
|
55
61
|
- !ruby/object:Gem::Dependency
|
56
62
|
name: rspec-collection_matchers
|
57
63
|
requirement: !ruby/object:Gem::Requirement
|
58
64
|
requirements:
|
59
|
-
- - ~>
|
65
|
+
- - "~>"
|
60
66
|
- !ruby/object:Gem::Version
|
61
67
|
version: '1.0'
|
62
68
|
type: :development
|
63
69
|
prerelease: false
|
64
70
|
version_requirements: !ruby/object:Gem::Requirement
|
65
71
|
requirements:
|
66
|
-
- - ~>
|
72
|
+
- - "~>"
|
67
73
|
- !ruby/object:Gem::Version
|
68
74
|
version: '1.0'
|
69
75
|
- !ruby/object:Gem::Dependency
|
70
76
|
name: mime-types
|
71
77
|
requirement: !ruby/object:Gem::Requirement
|
72
78
|
requirements:
|
73
|
-
- -
|
79
|
+
- - ">="
|
74
80
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
81
|
+
version: '0'
|
76
82
|
type: :development
|
77
83
|
prerelease: false
|
78
84
|
version_requirements: !ruby/object:Gem::Requirement
|
79
85
|
requirements:
|
80
|
-
- -
|
86
|
+
- - ">="
|
81
87
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
88
|
+
version: '0'
|
83
89
|
- !ruby/object:Gem::Dependency
|
84
|
-
name:
|
90
|
+
name: rake
|
85
91
|
requirement: !ruby/object:Gem::Requirement
|
86
92
|
requirements:
|
87
|
-
- -
|
93
|
+
- - ">="
|
88
94
|
- !ruby/object:Gem::Version
|
89
|
-
version: '0
|
95
|
+
version: '0'
|
90
96
|
type: :development
|
91
97
|
prerelease: false
|
92
98
|
version_requirements: !ruby/object:Gem::Requirement
|
93
99
|
requirements:
|
94
|
-
- -
|
100
|
+
- - ">="
|
95
101
|
- !ruby/object:Gem::Version
|
96
|
-
version: '0
|
102
|
+
version: '0'
|
97
103
|
- !ruby/object:Gem::Dependency
|
98
|
-
name:
|
104
|
+
name: simplecov
|
99
105
|
requirement: !ruby/object:Gem::Requirement
|
100
106
|
requirements:
|
101
|
-
- -
|
107
|
+
- - ">="
|
102
108
|
- !ruby/object:Gem::Version
|
103
109
|
version: '0'
|
104
110
|
type: :development
|
105
111
|
prerelease: false
|
106
112
|
version_requirements: !ruby/object:Gem::Requirement
|
107
113
|
requirements:
|
108
|
-
- -
|
114
|
+
- - ">="
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: '0'
|
111
|
-
description:
|
112
|
-
|
113
|
-
email:
|
117
|
+
description: " A puppet-lint plugin to check that the appends operator (+=) is
|
118
|
+
not used (removed in Puppet 4.0.0).\n"
|
119
|
+
email: voxpupuli@groups.io
|
114
120
|
executables: []
|
115
121
|
extensions: []
|
116
122
|
extra_rdoc_files: []
|
117
123
|
files:
|
118
|
-
- README.md
|
119
124
|
- LICENSE
|
125
|
+
- README.md
|
120
126
|
- lib/puppet-lint/plugins/check_appends.rb
|
121
|
-
- spec/puppet-lint/plugins/
|
127
|
+
- spec/puppet-lint/plugins/check_appends/appends_spec.rb
|
122
128
|
- spec/spec_helper.rb
|
123
|
-
homepage: https://github.com/
|
129
|
+
homepage: https://github.com/voxpupuli/puppet-lint-appends-check
|
124
130
|
licenses:
|
125
131
|
- Apache-2.0
|
126
132
|
metadata: {}
|
@@ -130,21 +136,20 @@ require_paths:
|
|
130
136
|
- lib
|
131
137
|
required_ruby_version: !ruby/object:Gem::Requirement
|
132
138
|
requirements:
|
133
|
-
- -
|
139
|
+
- - ">="
|
134
140
|
- !ruby/object:Gem::Version
|
135
141
|
version: '0'
|
136
142
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
143
|
requirements:
|
138
|
-
- -
|
144
|
+
- - ">="
|
139
145
|
- !ruby/object:Gem::Version
|
140
146
|
version: '0'
|
141
147
|
requirements: []
|
142
|
-
|
143
|
-
rubygems_version: 2.0.14
|
148
|
+
rubygems_version: 3.2.15
|
144
149
|
signing_key:
|
145
150
|
specification_version: 4
|
146
151
|
summary: A puppet-lint plugin to check that the appends operator (+=) is not used
|
147
152
|
(removed in Puppet 4.0.0).
|
148
153
|
test_files:
|
149
|
-
- spec/puppet-lint/plugins/
|
154
|
+
- spec/puppet-lint/plugins/check_appends/appends_spec.rb
|
150
155
|
- spec/spec_helper.rb
|
@@ -1,113 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe 'relative_classname_inclusion' do
|
4
|
-
let(:msg) { 'class included by relative name' }
|
5
|
-
|
6
|
-
context 'with fix disabled' do
|
7
|
-
context 'when absolute names are used' do
|
8
|
-
let(:code) do
|
9
|
-
<<-EOS
|
10
|
-
include ::foobar
|
11
|
-
include('::foobar')
|
12
|
-
include(foobar(baz))
|
13
|
-
include(foobar('baz'))
|
14
|
-
|
15
|
-
include ::foo, ::bar
|
16
|
-
include('::foo', '::bar')
|
17
|
-
|
18
|
-
class { '::foobar': }
|
19
|
-
|
20
|
-
class foobar {
|
21
|
-
}
|
22
|
-
EOS
|
23
|
-
end
|
24
|
-
|
25
|
-
it 'should not detect any problems' do
|
26
|
-
expect(problems).to have(0).problems
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
context 'when relative names are used' do
|
31
|
-
let(:code) do
|
32
|
-
<<-EOS
|
33
|
-
include foobar
|
34
|
-
include(foobar)
|
35
|
-
class { 'foobar': }
|
36
|
-
EOS
|
37
|
-
end
|
38
|
-
|
39
|
-
it 'should detect 3 problems' do
|
40
|
-
expect(problems).to have(3).problems
|
41
|
-
end
|
42
|
-
|
43
|
-
it 'should create warnings' do
|
44
|
-
expect(problems).to contain_warning(msg).on_line(1).in_column(17)
|
45
|
-
expect(problems).to contain_warning(msg).on_line(2).in_column(17)
|
46
|
-
expect(problems).to contain_warning(msg).on_line(3).in_column(17)
|
47
|
-
end
|
48
|
-
end
|
49
|
-
end
|
50
|
-
|
51
|
-
context 'with fix enabled' do
|
52
|
-
before do
|
53
|
-
PuppetLint.configuration.fix = true
|
54
|
-
end
|
55
|
-
|
56
|
-
after do
|
57
|
-
PuppetLint.configuration.fix = false
|
58
|
-
end
|
59
|
-
|
60
|
-
context 'when absolute names are used' do
|
61
|
-
let(:code) do
|
62
|
-
<<-EOS
|
63
|
-
include ::foobar
|
64
|
-
include('::foobar')
|
65
|
-
include(foobar(baz))
|
66
|
-
include(foobar('baz'))
|
67
|
-
|
68
|
-
include ::foo, ::bar
|
69
|
-
include('::foo', '::bar')
|
70
|
-
|
71
|
-
class { '::foobar': }
|
72
|
-
|
73
|
-
class foobar {
|
74
|
-
}
|
75
|
-
EOS
|
76
|
-
end
|
77
|
-
|
78
|
-
it 'should not detect any problems' do
|
79
|
-
expect(problems).to have(0).problems
|
80
|
-
end
|
81
|
-
end
|
82
|
-
|
83
|
-
context 'when relative names are used' do
|
84
|
-
let(:code) do
|
85
|
-
<<-EOS
|
86
|
-
include foobar
|
87
|
-
include(foobar)
|
88
|
-
class { 'foobar': }
|
89
|
-
EOS
|
90
|
-
end
|
91
|
-
|
92
|
-
it 'should detect 3 problems' do
|
93
|
-
expect(problems).to have(3).problems
|
94
|
-
end
|
95
|
-
|
96
|
-
it 'should fix the problems' do
|
97
|
-
expect(problems).to contain_fixed(msg).on_line(1).in_column(17)
|
98
|
-
expect(problems).to contain_fixed(msg).on_line(2).in_column(17)
|
99
|
-
expect(problems).to contain_fixed(msg).on_line(3).in_column(17)
|
100
|
-
end
|
101
|
-
|
102
|
-
it 'should should add colons' do
|
103
|
-
expect(manifest).to eq(
|
104
|
-
<<-EOS
|
105
|
-
include ::foobar
|
106
|
-
include(::foobar)
|
107
|
-
class { '::foobar': }
|
108
|
-
EOS
|
109
|
-
)
|
110
|
-
end
|
111
|
-
end
|
112
|
-
end
|
113
|
-
end
|