Skip to content

Commit d0ac458

Browse files
committed
(MAINT) Rubocop Corrections
- Layout/ClosingParenthesisIndentation - RSpec/NamedSubject - Style/Documentation
1 parent 4f9bb59 commit d0ac458

File tree

6 files changed

+16
-21
lines changed

6 files changed

+16
-21
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,6 @@
66
# Note that changes in the inspected code, or installation of new
77
# versions of RuboCop, may require this file to be generated again.
88

9-
# Offense count: 8
10-
# Configuration parameters: EnforcedStyle, IgnoreSharedExamples.
11-
# SupportedStyles: always, named_only
12-
RSpec/NamedSubject:
13-
Exclude:
14-
- 'spec/classes/certificates_spec.rb'
15-
- 'spec/classes/redact_spec.rb'
16-
179
# Offense count: 1
1810
# This cop supports unsafe autocorrection (--autocorrect-all).
1911
# Configuration parameters: EnforcedStyle.

Gemfile

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -99,8 +99,6 @@ extra_gemfiles = [
9999
extra_gemfiles.each do |gemfile|
100100
next unless File.file?(gemfile) && File.readable?(gemfile)
101101

102-
# rubocop:disable Security/Eval
103-
eval(File.read(gemfile), binding)
104-
# rubocop:enable Security/Eval
102+
eval(File.read(gemfile), binding) # rubocop:disable Security/Eval
105103
end
106104
# vim: syntax=ruby

lib/puppet/parser/functions/node_encrypt.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
This function simply encrypts the String or Sensitive passed to it using the certificate
99
belonging to the client the catalog is being compiled for.
1010
DOC
11-
) do |args|
11+
) do |args|
1212
content = args.first
1313
content = content.unwrap if defined?(Puppet::Pops::Types::PSensitiveType::Sensitive) && content.is_a?(Puppet::Pops::Types::PSensitiveType::Sensitive)
1414

lib/puppet_x/node_encrypt.rb

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
# frozen_string_literal: true
22

33
module PuppetX
4-
class NodeEncrypt # rubocop:disable Style/Documentation
4+
# Helper class for encrypting and decrypting data for nodes
5+
class NodeEncrypt
56
def self.encrypted?(data)
67
raise ArgumentError, 'Only strings can be encrypted' unless data.instance_of?(String)
78

spec/classes/certificates_spec.rb

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
require 'puppet_x/node_encrypt'
55

66
describe 'node_encrypt::certificates' do
7+
subject(:node_encrypt_certificates) { catalogue }
8+
79
before(:each) do
810
Puppet[:ca_server] = 'ca.example.com'
911
Puppet[:confdir] = '/etc/puppetlabs/puppet'
@@ -23,7 +25,7 @@
2325
end
2426

2527
it {
26-
expect(subject).to contain_ini_setting('public certificates mountpoint path').with(
28+
expect(node_encrypt_certificates).to contain_ini_setting('public certificates mountpoint path').with(
2729
{
2830
ensure: 'present',
2931
path: '/etc/puppetlabs/puppet/fileserver.conf',
@@ -33,7 +35,7 @@
3335
}
3436

3537
it {
36-
expect(subject).to contain_puppet_authorization__rule('public certificates mountpoint whitelist').with(
38+
expect(node_encrypt_certificates).to contain_puppet_authorization__rule('public certificates mountpoint whitelist').with(
3739
{
3840
match_request_path: '^/puppet/v3/file_(metadata|content)s?/public_certificates',
3941
match_request_type: 'regex',
@@ -60,7 +62,7 @@
6062
it { is_expected.not_to contain_ini_setting('public certificates mountpoint whitelist') }
6163

6264
it {
63-
expect(subject).to contain_file('/etc/puppetlabs/puppet/ssl/certs').with(
65+
expect(node_encrypt_certificates).to contain_file('/etc/puppetlabs/puppet/ssl/certs').with(
6466
{
6567
ensure: 'directory',
6668
source: 'puppet://ca.example.com/public_certificates/'

spec/classes/redact_spec.rb

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
require 'spec_helper'
44

55
describe 'redact' do
6+
subject(:function_redact) { catalogue }
7+
68
let(:node) { 'test.example.com' }
79
let(:facts) do
810
{
@@ -18,7 +20,7 @@
1820
end
1921

2022
it {
21-
expect(subject).to contain_class('redact').with(
23+
expect(function_redact).to contain_class('redact').with(
2224
{
2325
param: 'a param',
2426
redacted: '<<redacted>>',
@@ -28,7 +30,7 @@
2830
}
2931

3032
it {
31-
expect(subject).to contain_redact__thing('one').with(
33+
expect(function_redact).to contain_redact__thing('one').with(
3234
{
3335
param: 'a param',
3436
redacted: '<<redacted>>',
@@ -38,7 +40,7 @@
3840
}
3941

4042
it {
41-
expect(subject).to contain_redact__thing('two').with(
43+
expect(function_redact).to contain_redact__thing('two').with(
4244
{
4345
param: 'a param',
4446
redacted: '<<redacted>>',
@@ -48,7 +50,7 @@
4850
}
4951

5052
it {
51-
expect(subject).to contain_redact__thing('three').with(
53+
expect(function_redact).to contain_redact__thing('three').with(
5254
{
5355
param: 'a param',
5456
redacted: '<<redacted>>',
@@ -58,7 +60,7 @@
5860
}
5961

6062
it {
61-
expect(subject).to contain_redact__thing('four').with(
63+
expect(function_redact).to contain_redact__thing('four').with(
6264
{
6365
param: 'a param',
6466
redacted: '<<redacted>>',

0 commit comments

Comments
 (0)