Skip to content

Commit a460982

Browse files
committed
(CONT-773) Rubocop Auto Fixes 1-5
- Layout/ClosingHeredocIndentation - Layout/EmptyLineAfterGuardClause - Layout/HashAlignment - Layout/HeredocIndentation - Layout/SpaceAroundMethodCallOperator
1 parent 5fede72 commit a460982

18 files changed

+113
-158
lines changed

.rubocop_todo.yml

-50
Original file line numberDiff line numberDiff line change
@@ -6,56 +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: 32
10-
# This cop supports safe autocorrection (--autocorrect).
11-
Layout/ClosingHeredocIndentation:
12-
Exclude:
13-
- 'spec/acceptance/apt_key_provider_spec.rb'
14-
- 'spec/acceptance/apt_spec.rb'
15-
- 'spec/spec_helper_acceptance_local.rb'
16-
- 'spec/unit/puppet/provider/apt_key_spec.rb'
17-
18-
# Offense count: 5
19-
# This cop supports safe autocorrection (--autocorrect).
20-
Layout/EmptyLineAfterGuardClause:
21-
Exclude:
22-
- 'lib/facter/apt_updates.rb'
23-
- 'lib/puppet/provider/apt_key/apt_key.rb'
24-
- 'lib/puppet/type/apt_key.rb'
25-
- 'spec/spec_helper_acceptance_local.rb'
26-
- 'tasks/init.rb'
27-
28-
# Offense count: 57
29-
# This cop supports safe autocorrection (--autocorrect).
30-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
31-
# SupportedHashRocketStyles: key, separator, table
32-
# SupportedColonStyles: key, separator, table
33-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
34-
Layout/HashAlignment:
35-
Exclude:
36-
- 'spec/classes/apt_spec.rb'
37-
- 'spec/classes/apt_update_spec.rb'
38-
- 'spec/defines/conf_spec.rb'
39-
- 'spec/defines/pin_spec.rb'
40-
- 'spec/defines/source_compat_spec.rb'
41-
- 'spec/defines/source_spec.rb'
42-
- 'spec/unit/puppet/provider/apt_key_spec.rb'
43-
- 'spec/unit/puppet/type/apt_key_spec.rb'
44-
45-
# Offense count: 2
46-
# This cop supports safe autocorrection (--autocorrect).
47-
Layout/HeredocIndentation:
48-
Exclude:
49-
- 'spec/spec_helper_acceptance_local.rb'
50-
- 'spec/unit/puppet/provider/apt_key_spec.rb'
51-
52-
# Offense count: 6
53-
# This cop supports safe autocorrection (--autocorrect).
54-
Layout/SpaceAroundMethodCallOperator:
55-
Exclude:
56-
- 'spec/defines/key_compat_spec.rb'
57-
- 'spec/defines/key_spec.rb'
58-
599
# Offense count: 1
6010
# This cop supports unsafe autocorrection (--autocorrect-all).
6111
Lint/BooleanSymbol:

lib/facter/apt_updates.rb

+1
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ def get_updates(upgrade_option)
1414
apt_updates = [[], []]
1515
apt_get_result.each_line do |line|
1616
next unless %r{^Inst\s}.match?(line)
17+
1718
package = line.gsub(%r{^Inst\s([^\s]+)\s.*}, '\1').strip
1819
apt_updates[0].push(package)
1920
security_matches = [

lib/puppet/provider/apt_key/apt_key.rb

+1
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ def source_to_file(value)
120120
parsed_value = URI.parse(value)
121121
if parsed_value.scheme.nil?
122122
raise(_('The file %{_value} does not exist') % { _value: value }) unless File.exist?(value)
123+
123124
# Because the tempfile method has to return a live object to prevent GC
124125
# of the underlying file from occuring too early, we also have to return
125126
# a file object here. The caller can still call the #path method on the

lib/puppet/type/apt_key.rb

+1
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
if self[:content] && self[:source]
3232
raise(_('The properties content and source are mutually exclusive.'))
3333
end
34+
3435
if self[:id].length < 40
3536
warning(_('The id should be a full fingerprint (40 characters), see README.'))
3637
end

spec/acceptance/apt_key_provider_spec.rb

+29-29
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ def apply_manifest_twice(manifest_pp)
111111
=cXcR
112112
-----END PGP PUBLIC KEY BLOCK-----'
113113
}
114-
MANIFEST
114+
MANIFEST
115115

116116
gpg_key_pp = <<-MANIFEST
117117
apt_key { 'puppetlabs':
@@ -170,7 +170,7 @@ def apply_manifest_twice(manifest_pp)
170170
=mMjt
171171
-----END PGP PUBLIC KEY BLOCK-----",
172172
}
173-
MANIFEST
173+
MANIFEST
174174

175175
multiple_keys_pp = <<-MANIFEST
176176
apt_key { 'puppetlabs':
@@ -423,23 +423,23 @@ def apply_manifest_twice(manifest_pp)
423423
=TREp
424424
-----END PGP PUBLIC KEY BLOCK----- ",
425425
}
426-
MANIFEST
426+
MANIFEST
427427

428428
bogus_key_pp = <<-MANIFEST
429429
apt_key { 'puppetlabs':
430430
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
431431
ensure => 'present',
432432
content => 'For posterity: such content, much bogus, wow',
433433
}
434-
MANIFEST
434+
MANIFEST
435435

436436
hkp_pool_pp = <<-MANIFEST
437437
apt_key { 'puppetlabs':
438438
id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}',
439439
ensure => 'present',
440440
server => 'hkp://keyserver.ubuntu.com:80',
441441
}
442-
MANIFEST
442+
MANIFEST
443443

444444
hkps_protocol_supported = host_inventory['facter']['os']['family'] =~ %r{Ubuntu}i && \
445445
host_inventory['facter']['os']['release']['major'] =~ %r{^18\.04}
@@ -451,7 +451,7 @@ def apply_manifest_twice(manifest_pp)
451451
ensure => 'present',
452452
server => 'hkps://keyserver.ubuntu.com',
453453
}
454-
MANIFEST
454+
MANIFEST
455455
end
456456

457457
nonexistant_key_server_pp = <<-MANIFEST
@@ -460,79 +460,79 @@ def apply_manifest_twice(manifest_pp)
460460
ensure => 'present',
461461
server => 'nonexistant.key.server',
462462
}
463-
MANIFEST
463+
MANIFEST
464464

465465
dot_server_pp = <<-MANIFEST
466466
apt_key { 'puppetlabs':
467467
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
468468
ensure => 'present',
469469
server => '.pgp.key.server',
470470
}
471-
MANIFEST
471+
MANIFEST
472472

473473
http_works_pp = <<-MANIFEST
474474
apt_key { 'puppetlabs':
475475
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
476476
ensure => 'present',
477477
source => 'http://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
478478
}
479-
MANIFEST
479+
MANIFEST
480480

481481
http_works_userinfo_pp = <<-MANIFEST
482482
apt_key { 'puppetlabs':
483483
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
484484
ensure => 'present',
485485
source => 'http://dummyuser:dummypassword@#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
486486
}
487-
MANIFEST
487+
MANIFEST
488488

489489
four_oh_four_pp = <<-MANIFEST
490490
apt_key { 'puppetlabs':
491491
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
492492
ensure => 'present',
493493
source => 'http://#{PUPPETLABS_APT_URL}/herpderp.gpg',
494494
}
495-
MANIFEST
495+
MANIFEST
496496

497497
socket_error_pp = <<-MANIFEST
498498
apt_key { 'puppetlabs':
499499
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
500500
ensure => 'present',
501501
source => 'http://apt.puppetlabss.com/herpderp.gpg',
502502
}
503-
MANIFEST
503+
MANIFEST
504504

505505
ftp_works_pp = <<-MANIFEST
506506
apt_key { 'CentOS 6':
507507
id => '#{CENTOS_GPG_KEY_LONG_ID}',
508508
ensure => 'present',
509509
source => 'ftp://#{CENTOS_REPO_URL}/#{CENTOS_GPG_KEY_FILE}',
510510
}
511-
MANIFEST
511+
MANIFEST
512512

513513
ftp_550_pp = <<-MANIFEST
514514
apt_key { 'CentOS 6':
515515
id => '#{SHOULD_NEVER_EXIST_ID}',
516516
ensure => 'present',
517517
source => 'ftp://#{CENTOS_REPO_URL}/herpderp.gpg',
518518
}
519-
MANIFEST
519+
MANIFEST
520520

521521
ftp_socket_error_pp = <<-MANIFEST
522522
apt_key { 'puppetlabs':
523523
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
524524
ensure => 'present',
525525
source => 'ftp://apt.puppetlabss.com/herpderp.gpg',
526526
}
527-
MANIFEST
527+
MANIFEST
528528

529529
https_works_pp = <<-MANIFEST
530530
apt_key { 'puppetlabs':
531531
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
532532
ensure => 'present',
533533
source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
534534
}
535-
MANIFEST
535+
MANIFEST
536536

537537
https_with_weak_ssl_works_pp = <<-MANIFEST
538538
apt_key { 'puppetlabs':
@@ -541,87 +541,87 @@ def apply_manifest_twice(manifest_pp)
541541
source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
542542
weak_ssl => true,
543543
}
544-
MANIFEST
544+
MANIFEST
545545

546546
https_userinfo_pp = <<-MANIFEST
547547
apt_key { 'puppetlabs':
548548
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
549549
ensure => 'present',
550550
source => 'https://dummyuser:dummypassword@#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
551551
}
552-
MANIFEST
552+
MANIFEST
553553

554554
https_404_pp = <<-MANIFEST
555555
apt_key { 'puppetlabs':
556556
id => '#{SHOULD_NEVER_EXIST_ID}',
557557
ensure => 'present',
558558
source => 'https://#{PUPPETLABS_APT_URL}/herpderp.gpg',
559559
}
560-
MANIFEST
560+
MANIFEST
561561

562562
https_socket_error_pp = <<-MANIFEST
563563
apt_key { 'puppetlabs':
564564
id => '#{SHOULD_NEVER_EXIST_ID}',
565565
ensure => 'present',
566566
source => 'https://apt.puppetlabss.com/herpderp.gpg',
567567
}
568-
MANIFEST
568+
MANIFEST
569569

570570
path_exists_pp = <<-MANIFEST
571571
apt_key { 'puppetlabs':
572572
id => 'EF8D349F',
573573
ensure => 'present',
574574
source => '/tmp/puppetlabs-pubkey.gpg',
575575
}
576-
MANIFEST
576+
MANIFEST
577577

578578
path_does_not_exist_pp = <<-MANIFEST
579579
apt_key { 'puppetlabs':
580580
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
581581
ensure => 'present',
582582
source => '/tmp/totally_bogus.file',
583583
}
584-
MANIFEST
584+
MANIFEST
585585

586586
path_bogus_content_pp = <<-MANIFEST
587587
apt_key { 'puppetlabs':
588588
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
589589
ensure => 'present',
590590
source => '/tmp/fake-key.gpg',
591591
}
592-
MANIFEST
592+
MANIFEST
593593

594594
debug_works_pp = <<-MANIFEST
595595
apt_key { 'puppetlabs':
596596
id => '#{PUPPETLABS_GPG_KEY_LONG_ID}',
597597
ensure => 'present',
598598
options => 'debug',
599599
}
600-
MANIFEST
600+
MANIFEST
601601

602602
fingerprint_match_pp = <<-MANIFEST
603603
apt_key { 'puppetlabs':
604604
id => '#{PUPPETLABS_GPG_KEY_FINGERPRINT}',
605605
ensure => 'present',
606606
source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
607607
}
608-
MANIFEST
608+
MANIFEST
609609

610610
fingerprint_does_not_match_pp = <<-MANIFEST
611611
apt_key { 'puppetlabs':
612612
id => '6F6B15509CF8E59E6E469F327F438280EF8D9999',
613613
ensure => 'present',
614614
source => 'https://#{PUPPETLABS_APT_URL}/#{PUPPETLABS_GPG_KEY_FILE}',
615615
}
616-
MANIFEST
616+
MANIFEST
617617

618618
refresh_true_pp = <<-MANIFEST
619619
apt_key { '#{PUPPETLABS_EXP_KEY_LONG_ID}':
620620
id => '#{PUPPETLABS_EXP_KEY_LONG_ID}',
621621
ensure => 'present',
622622
refresh => true,
623623
}
624-
MANIFEST
624+
MANIFEST
625625

626626
refresh_false_pp = <<-MANIFEST
627627
apt_key { '#{PUPPETLABS_EXP_KEY_LONG_ID}':
@@ -657,14 +657,14 @@ def apply_manifest_twice(manifest_pp)
657657
id => '#{CENTOS_GPG_KEY_LONG_ID}',
658658
ensure => 'present',
659659
}
660-
MANIFEST
660+
MANIFEST
661661

662662
ensure_absent_pp = <<-MANIFEST
663663
apt_key { 'centos':
664664
id => '#{CENTOS_GPG_KEY_LONG_ID}',
665665
ensure => 'absent',
666666
}
667-
MANIFEST
667+
MANIFEST
668668

669669
it 'add an apt_key resource' do
670670
apply_manifest_twice(ensure_present_pp)

spec/acceptance/apt_spec.rb

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class { 'apt':
2929
},
3030
sources => $sources,
3131
}
32-
MANIFEST
32+
MANIFEST
3333

3434
describe 'apt class' do
3535
context 'with reset' do

spec/classes/apt_spec.rb

+9-9
Original file line numberDiff line numberDiff line change
@@ -482,17 +482,17 @@
482482
let(:params) do
483483
{ sources: {
484484
'debian_unstable' => {
485-
'location' => 'http://debian.mirror.iweb.ca/debian/',
486-
'release' => 'unstable',
487-
'repos' => 'main contrib non-free',
488-
'key' => { 'id' => '150C8614919D8446E01E83AF9AA38DCD55BE302B', 'server' => 'subkeys.pgp.net' },
489-
'pin' => '-10',
490-
'include' => { 'src' => true },
485+
'location' => 'http://debian.mirror.iweb.ca/debian/',
486+
'release' => 'unstable',
487+
'repos' => 'main contrib non-free',
488+
'key' => { 'id' => '150C8614919D8446E01E83AF9AA38DCD55BE302B', 'server' => 'subkeys.pgp.net' },
489+
'pin' => '-10',
490+
'include' => { 'src' => true },
491491
},
492492
'puppetlabs' => {
493493
'location' => 'http://apt.puppetlabs.com',
494-
'repos' => 'main',
495-
'key' => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', 'server' => 'pgp.mit.edu' },
494+
'repos' => 'main',
495+
'key' => { 'id' => '6F6B15509CF8E59E6E469F327F438280EF8D349F', 'server' => 'pgp.mit.edu' },
496496
},
497497
} }
498498
end
@@ -661,7 +661,7 @@
661661
let(:params) do
662662
{ pins: {
663663
'stable' => { 'priority' => 600, 'order' => 50 },
664-
'testing' => { 'priority' => 700, 'order' => 100 },
664+
'testing' => { 'priority' => 700, 'order' => 100 },
665665
} }
666666
end
667667

0 commit comments

Comments
 (0)