puppet-lint-racism_terminology-check 1.0.2 → 1.0.3
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
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a91aff3c2a51b66db807699b59e7cc700a239a5b
|
4
|
+
data.tar.gz: e1d217beae733167aeedda26a7f2208a4e8d7a32
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 763979051f930ebaf4b858b665dddbfc5ce9bc4b0114c744d92c2383289b625ce83d1e6e0b86ab5941aaed986e4e1d37e92044e59b98c9e0b78c2f390042d743
|
7
|
+
data.tar.gz: c405ef5bbdc89398bb110a142f90a2f0d169a7d18079a99f32b86200fcc4ef330e067b77e2ed4b55f8846bffae49c852c86cb2598b0657a081e4f1b9dfcbe7b0
|
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
|
3
3
|
A puppet-lint extension that offers warnings when you include words that
|
4
4
|
have a racist history: 'master/slave', 'whitelist/blacklist', for
|
5
|
-
starters. See: <https://
|
5
|
+
starters. See: <https://www.ietf.org/archive/id/draft-knodel-terminology-13.txt>
|
6
6
|
|
7
7
|
This check will not match against URL's. This is by design to not flag
|
8
8
|
for every comment that may contain a github link to a repo using
|
@@ -1,8 +1,10 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
PuppetLint.new_check(:racism_terminology) do
|
2
4
|
# rubocop:disable Style/Next
|
3
5
|
def check
|
4
6
|
manifest_lines.each_with_index do |line, idx|
|
5
|
-
if line =~
|
7
|
+
if line =~ /(\b|-|_)(master|slave)(\b|-|_)/ && line !~ %r{http(s)?://}
|
6
8
|
notify(
|
7
9
|
:warning,
|
8
10
|
message: 'master/slave terminology, perhaps leader/follower?',
|
@@ -11,7 +13,7 @@ PuppetLint.new_check(:racism_terminology) do
|
|
11
13
|
)
|
12
14
|
end
|
13
15
|
|
14
|
-
if line =~
|
16
|
+
if line =~ /(\b|-|_)(blacklist|whitelist)(\b|-|_)/ && line !~ %r{http(s)?://}
|
15
17
|
notify(
|
16
18
|
:warning,
|
17
19
|
message: 'blacklist/whitelist terminology, perhaps blocklist/approvelist?',
|
@@ -1,3 +1,5 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
1
3
|
require 'spec_helper'
|
2
4
|
|
3
5
|
describe 'racism_terminology' do
|
@@ -27,6 +29,48 @@ describe 'racism_terminology' do
|
|
27
29
|
end
|
28
30
|
end
|
29
31
|
|
32
|
+
context 'slave in code as param' do
|
33
|
+
let(:code) do
|
34
|
+
<<-PP
|
35
|
+
redis::instance { $redis_server_name:
|
36
|
+
cluster_slave_validity_factor => 1,
|
37
|
+
hash => {
|
38
|
+
'slave' => true,
|
39
|
+
}
|
40
|
+
}
|
41
|
+
PP
|
42
|
+
end
|
43
|
+
let(:msg) { 'master/slave terminology, perhaps leader/follower?' }
|
44
|
+
|
45
|
+
it 'should create a warning' do
|
46
|
+
expect(problems).to contain_warning(msg).on_line(2)
|
47
|
+
expect(problems).to contain_warning(msg).on_line(4)
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
context 'slave in code comments' do
|
52
|
+
let(:code) do
|
53
|
+
<<-PP
|
54
|
+
# @summary this is slave code
|
55
|
+
file { 'foo': ensure => 'present' }
|
56
|
+
PP
|
57
|
+
end
|
58
|
+
let(:msg) { 'master/slave terminology, perhaps leader/follower?' }
|
59
|
+
|
60
|
+
it 'should create a warning' do
|
61
|
+
expect(problems).to contain_warning(msg).on_line(1)
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
context 'slave in code' do
|
66
|
+
let(:code) { 'include slave' }
|
67
|
+
let(:msg) { 'master/slave terminology, perhaps leader/follower?' }
|
68
|
+
|
69
|
+
it 'should create a warning' do
|
70
|
+
expect(problems).to contain_warning(msg).on_line(1)
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
30
74
|
context 'slave' do
|
31
75
|
let(:code) { "file { '/tmp/slave': }" }
|
32
76
|
let(:msg) { 'master/slave terminology, perhaps leader/follower?' }
|
@@ -54,12 +98,28 @@ describe 'racism_terminology' do
|
|
54
98
|
end
|
55
99
|
end
|
56
100
|
|
101
|
+
context 'master in code as param' do
|
102
|
+
let(:code) do
|
103
|
+
<<-PP
|
104
|
+
selinux::permissive { 'allow-postfix_master_t':
|
105
|
+
seltype => 'postfix_master_t',
|
106
|
+
}
|
107
|
+
PP
|
108
|
+
end
|
109
|
+
let(:msg) { 'master/slave terminology, perhaps leader/follower?' }
|
110
|
+
|
111
|
+
it 'should create a warning' do
|
112
|
+
expect(problems).to contain_warning(msg).on_line(1)
|
113
|
+
expect(problems).to contain_warning(msg).on_line(2)
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
57
117
|
context 'master in a URL' do
|
58
|
-
|
59
|
-
|
118
|
+
let(:code) { '# Some URL example.com/master/' }
|
119
|
+
let(:msg) { 'url testing' }
|
60
120
|
|
61
|
-
|
62
|
-
|
63
|
-
end
|
121
|
+
it 'should not create a warning' do
|
122
|
+
expect(problems).not_to contain_warning
|
64
123
|
end
|
124
|
+
end
|
65
125
|
end
|
data/spec/spec_helper.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: puppet-lint-racism_terminology-check
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tim Skirvin
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-07-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: puppet-lint
|