Skip to content

Commit d9b9a3c

Browse files
committed
(PUP-11993) Style/RedundantPercentQ
This commit enables the Style/RedundantPercentQ cop and fixes 12 autocorrectable offenses.
1 parent 1899f97 commit d9b9a3c

File tree

10 files changed

+13
-26
lines changed

10 files changed

+13
-26
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -668,19 +668,6 @@ Style/RedundantFetchBlock:
668668
Style/RedundantInterpolation:
669669
Enabled: false
670670

671-
# This cop supports safe auto-correction (--auto-correct).
672-
Style/RedundantPercentQ:
673-
Exclude:
674-
- 'lib/puppet/defaults.rb'
675-
- 'lib/puppet/indirector/catalog/store_configs.rb'
676-
- 'lib/puppet/indirector/facts/store_configs.rb'
677-
- 'lib/puppet/indirector/node/store_configs.rb'
678-
- 'lib/puppet/indirector/resource/store_configs.rb'
679-
- 'lib/puppet/provider/package/dpkg.rb'
680-
- 'lib/puppet/provider/package/rpm.rb'
681-
- 'lib/puppet/type.rb'
682-
- 'lib/puppet/util/at_fork/solaris.rb'
683-
684671
# This cop supports safe auto-correction (--auto-correct).
685672
Style/RedundantRegexpCharacterClass:
686673
Exclude:

lib/puppet/defaults.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def self.default_vendormoduledir
7777
# see the docs for Settings.define_settings
7878
############################################################################################
7979

80-
AS_DURATION = %q{This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).}
80+
AS_DURATION = 'This setting can be a time interval in seconds (30 or 30s), minutes (30m), hours (6h), days (2d), or years (5y).'
8181

8282
# @api public
8383
# @param args [Puppet::Settings] the settings object to define default settings for

lib/puppet/indirector/catalog/store_configs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
require_relative '../../../puppet/resource/catalog'
55

66
class Puppet::Resource::Catalog::StoreConfigs < Puppet::Indirector::StoreConfigs
7-
desc %q(Part of the "storeconfigs" feature. Should not be directly set by end users.)
7+
desc 'Part of the "storeconfigs" feature. Should not be directly set by end users.'
88
end

lib/puppet/indirector/facts/store_configs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require_relative '../../../puppet/indirector/store_configs'
55

66
class Puppet::Node::Facts::StoreConfigs < Puppet::Indirector::StoreConfigs
7-
desc %q(Part of the "storeconfigs" feature. Should not be directly set by end users.)
7+
desc 'Part of the "storeconfigs" feature. Should not be directly set by end users.'
88

99
def allow_remote_requests?
1010
false

lib/puppet/indirector/node/store_configs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,5 @@
44
require_relative '../../../puppet/node'
55

66
class Puppet::Node::StoreConfigs < Puppet::Indirector::StoreConfigs
7-
desc %q(Part of the "storeconfigs" feature. Should not be directly set by end users.)
7+
desc 'Part of the "storeconfigs" feature. Should not be directly set by end users.'
88
end

lib/puppet/indirector/resource/store_configs.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
class Puppet::Resource::StoreConfigs < Puppet::Indirector::StoreConfigs
77
include Puppet::Resource::Validator
88

9-
desc %q(Part of the "storeconfigs" feature. Should not be directly set by end users.)
9+
desc 'Part of the "storeconfigs" feature. Should not be directly set by end users.'
1010

1111
def allow_remote_requests?
1212
false

lib/puppet/provider/package/dpkg.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ def self.instances
4545

4646
# Note: self:: is required here to keep these constants in the context of what will
4747
# eventually become this Puppet::Type::Package::ProviderDpkg class.
48-
self::DPKG_QUERY_FORMAT_STRING = %q('${Status} ${Package} ${Version}\\n')
49-
self::DPKG_QUERY_PROVIDES_FORMAT_STRING = %q('${Status} ${Package} ${Version} [${Provides}]\\n')
48+
self::DPKG_QUERY_FORMAT_STRING = "'${Status} ${Package} ${Version}\\n'"
49+
self::DPKG_QUERY_PROVIDES_FORMAT_STRING = "'${Status} ${Package} ${Version} [${Provides}]\\n'"
5050
self::FIELDS_REGEX = %r{^'?(\S+) +(\S+) +(\S+) (\S+) (\S*)$}
5151
self::FIELDS_REGEX_WITH_PROVIDES = %r{^'?(\S+) +(\S+) +(\S+) (\S+) (\S*) \[.*\]$}
5252
self::FIELDS = [:desired, :error, :status, :name, :ensure]

lib/puppet/provider/package/rpm.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
# Note: self:: is required here to keep these constants in the context of what will
2525
# eventually become this Puppet::Type::Package::ProviderRpm class.
2626
# The query format by which we identify installed packages
27-
self::NEVRA_FORMAT = %q(%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n)
27+
self::NEVRA_FORMAT = '%{NAME} %|EPOCH?{%{EPOCH}}:{0}| %{VERSION} %{RELEASE} %{ARCH}\\n'
2828
self::NEVRA_REGEX = %r{^'?(\S+) (\S+) (\S+) (\S+) (\S+)$}
2929
self::NEVRA_FIELDS = [:name, :epoch, :version, :release, :arch]
3030
self::MULTIVERSION_SEPARATOR = "; "

lib/puppet/type.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1375,7 +1375,7 @@ def properties_to_audit(list)
13751375
end
13761376

13771377
newmetaparam(:alias) do
1378-
desc %q{Creates an alias for the resource. Puppet uses this internally when you
1378+
desc "Creates an alias for the resource. Puppet uses this internally when you
13791379
provide a symbolic title and an explicit namevar value:
13801380
13811381
file { 'sshdconfig':
@@ -1411,7 +1411,7 @@ def properties_to_audit(list)
14111411
There's no way here for the Puppet parser to know that these two stanzas
14121412
should be affecting the same file.
14131413
1414-
}
1414+
"
14151415

14161416
munge do |aliases|
14171417
aliases = [aliases] unless aliases.is_a?(Array)

lib/puppet/util/at_fork/solaris.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ class Puppet::Util::AtFork::Solaris
4747
end
4848

4949
CTFS_PR_ROOT = File.join('', %w[system contract process])
50-
CTFS_PR_TEMPLATE = File.join(CTFS_PR_ROOT, %q(template))
51-
CTFS_PR_LATEST = File.join(CTFS_PR_ROOT, %q(latest))
50+
CTFS_PR_TEMPLATE = File.join(CTFS_PR_ROOT, 'template')
51+
CTFS_PR_LATEST = File.join(CTFS_PR_ROOT, 'latest')
5252

5353
CT_PR_PGRPONLY = 0x4
5454
CT_PR_EV_HWERR = 0x20
@@ -129,7 +129,7 @@ def abandon_latest_child_contract
129129
return if ctid.nil?
130130

131131
begin
132-
ctl = File.new(File.join(CTFS_PR_ROOT, ctid.to_s, %q(ctl)), File::WRONLY)
132+
ctl = File.new(File.join(CTFS_PR_ROOT, ctid.to_s, 'ctl'), File::WRONLY)
133133

134134
begin
135135
raise_if_error { ct_ctl_abandon(ctl.fileno) }

0 commit comments

Comments
 (0)