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: 4528e23b9efcaa3ba1a21367a4e54c14c2a2aca8
4
- data.tar.gz: 4eb78af7211badb530710c2e936d4c2a7c6b45ff
3
+ metadata.gz: a91aff3c2a51b66db807699b59e7cc700a239a5b
4
+ data.tar.gz: e1d217beae733167aeedda26a7f2208a4e8d7a32
5
5
  SHA512:
6
- metadata.gz: ade22d5d2d64138ab9902b2e7901f96a6c042c14ce140bb3ae67efa97a36ea4868052a0d0c689732734c8ae1d72a9dc3c9fe137ec7db1ddd5259668261d97af5
7
- data.tar.gz: 9a84d4f719a0fc8ade947606be1cbb607c4bb9742ce359795791f8c08684d7d224656fcc26d7987c2bec41d8a8766a360b43ac98e7acfcd5503022f4ca94fd66
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://datatracker.ietf.org/doc/draft-knodel-terminology/13/>
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 =~ /\b(master|slave)\b/ && line !~ URI::DEFAULT_PARSER.make_regexp
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 =~ /\b(blacklist|whitelist)\b/ && line !~ URI::DEFAULT_PARSER.make_regexp
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
- let(:code) { '# Some URL example.com/master/' }
59
- let(:msg) { 'url testing' }
118
+ let(:code) { '# Some URL example.com/master/' }
119
+ let(:msg) { 'url testing' }
60
120
 
61
- it 'should not create a warning' do
62
- expect(problems).not_to contain_warning
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
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  require 'puppet-lint'
2
4
 
3
5
  PuppetLint::Plugins.load_spec_helper
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.2
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-06-09 00:00:00.000000000 Z
11
+ date: 2023-07-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: puppet-lint