Skip to content

Commit 64e9603

Browse files
committed
Layout/IndentationWidth
This commit enables the Rubocop Layout/IndentationWidth cop and addresses all offenses.
1 parent f322182 commit 64e9603

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

71 files changed

+1309
-1308
lines changed

.rubocop.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,12 @@ Layout/ElseAlignment:
3333
Exclude:
3434
- 'lib/puppet/provider/package/*.rb'
3535

36+
# We don't mind when module and class keywords are aligned.
37+
Layout/IndentationWidth:
38+
AllowedPatterns: ['^\s*module']
39+
Exclude:
40+
- 'lib/puppet/provider/package/*.rb'
41+
3642
# puppet uses symbol booleans in types and providers to work around long standing
3743
# bugs when trying to manage falsey pararameters and properties
3844
Lint/BooleanSymbol:

.rubocop_todo.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,11 +22,6 @@ I18n/GetText/DecorateStringFormattingUsingPercent:
2222
I18n/RailsI18n/DecorateString:
2323
Enabled: false
2424

25-
# This cop supports safe auto-correction (--auto-correct).
26-
# Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
27-
Layout/IndentationWidth:
28-
Enabled: false
29-
3025
# This cop supports safe auto-correction (--auto-correct).
3126
Layout/InitialIndentation:
3227
Exclude:

lib/puppet/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ def find(application_name)
261261
# @param [String] class_name the fully qualified name of the class to try to load
262262
# @return [Class] the Class instance, or nil? if it could not be loaded.
263263
def try_load_class(class_name)
264-
return self.const_defined?(class_name) ? const_get(class_name) : nil
264+
return self.const_defined?(class_name) ? const_get(class_name) : nil
265265
end
266266
private :try_load_class
267267

lib/puppet/application/device.rb

Lines changed: 140 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -85,146 +85,146 @@ def summary
8585
end
8686

8787
def help
88-
<<~HELP
89-
90-
puppet-device(8) -- #{summary}
91-
========
92-
93-
SYNOPSIS
94-
--------
95-
Retrieves catalogs from the Puppet master and applies them to remote devices.
96-
97-
This subcommand can be run manually; or periodically using cron,
98-
a scheduled task, or a similar tool.
99-
100-
101-
USAGE
102-
-----
103-
puppet device [-h|--help] [-v|--verbose] [-d|--debug]
104-
[-l|--logdest syslog|<file>|console] [--detailed-exitcodes]
105-
[--deviceconfig <file>] [-w|--waitforcert <seconds>]
106-
[--libdir <directory>]
107-
[-a|--apply <file>] [-f|--facts] [-r|--resource <type> [name]]
108-
[-t|--target <device>] [--user=<user>] [-V|--version]
109-
110-
111-
DESCRIPTION
112-
-----------
113-
Devices require a proxy Puppet agent to request certificates, collect facts,
114-
retrieve and apply catalogs, and store reports.
115-
116-
117-
USAGE NOTES
118-
-----------
119-
Devices managed by the puppet-device subcommand on a Puppet agent are
120-
configured in device.conf, which is located at $confdir/device.conf by default,
121-
and is configurable with the $deviceconfig setting.
122-
123-
The device.conf file is an INI-like file, with one section per device:
124-
125-
[<DEVICE_CERTNAME>]
126-
type <TYPE>
127-
url <URL>
128-
debug
129-
130-
The section name specifies the certname of the device.
131-
132-
The values for the type and url properties are specific to each type of device.
133-
134-
The optional debug property specifies transport-level debugging,
135-
and is limited to telnet and ssh transports.
136-
137-
See https://puppet.com/docs/puppet/latest/config_file_device.html for details.
138-
139-
140-
OPTIONS
141-
-------
142-
Note that any setting that's valid in the configuration file is also a valid
143-
long argument. For example, 'server' is a valid configuration parameter, so
144-
you can specify '--server <servername>' as an argument.
145-
146-
* --help, -h:
147-
Print this help message
148-
149-
* --verbose, -v:
150-
Turn on verbose reporting.
151-
152-
* --debug, -d:
153-
Enable full debugging.
154-
155-
* --logdest, -l:
156-
Where to send log messages. Choose between 'syslog' (the POSIX syslog
157-
service), 'console', or the path to a log file. If debugging or verbosity is
158-
enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
159-
Multiple destinations can be set using a comma separated list
160-
(eg: `/path/file1,console,/path/file2`)"
161-
162-
A path ending with '.json' will receive structured output in JSON format. The
163-
log file will not have an ending ']' automatically written to it due to the
164-
appending nature of logging. It must be appended manually to make the content
165-
valid JSON.
166-
167-
* --detailed-exitcodes:
168-
Provide transaction information via exit codes. If this is enabled, an exit
169-
code of '1' means at least one device had a compile failure, an exit code of
170-
'2' means at least one device had resource changes, and an exit code of '4'
171-
means at least one device had resource failures. Exit codes of '3', '5', '6',
172-
or '7' means that a bitwise combination of the preceding exit codes happened.
173-
174-
* --deviceconfig:
175-
Path to the device config file for puppet device.
176-
Default: $confdir/device.conf
177-
178-
* --waitforcert, -w:
179-
This option only matters for targets that do not yet have certificates
180-
and it is enabled by default, with a value of 120 (seconds). This causes
181-
+puppet device+ to poll the server every 2 minutes and ask it to sign a
182-
certificate request. This is useful for the initial setup of a target.
183-
You can turn off waiting for certificates by specifying a time of 0.
184-
185-
* --libdir:
186-
Override the per-device libdir with a local directory. Specifying a libdir also
187-
disables pluginsync. This is useful for testing.
188-
189-
A path ending with '.jsonl' will receive structured output in JSON Lines
190-
format.
191-
192-
* --apply:
193-
Apply a manifest against a remote target. Target must be specified.
194-
195-
* --facts:
196-
Displays the facts of a remote target. Target must be specified.
197-
198-
* --resource:
199-
Displays a resource state as Puppet code, roughly equivalent to
200-
`puppet resource`. Can be filtered by title. Requires --target be specified.
201-
202-
* --target:
203-
Target a specific device/certificate in the device.conf. Doing so will perform a
204-
device run against only that device/certificate.
205-
206-
* --to_yaml:
207-
Output found resources in yaml format, suitable to use with Hiera and
208-
create_resources.
209-
210-
* --user:
211-
The user to run as.
212-
213-
214-
EXAMPLE
215-
-------
216-
$ puppet device --target remotehost --verbose
217-
218-
AUTHOR
219-
------
220-
Brice Figureau
221-
222-
223-
COPYRIGHT
224-
---------
225-
Copyright (c) 2011-2018 Puppet Inc., LLC
226-
Licensed under the Apache 2.0 License
227-
HELP
88+
<<~HELP
89+
90+
puppet-device(8) -- #{summary}
91+
========
92+
93+
SYNOPSIS
94+
--------
95+
Retrieves catalogs from the Puppet master and applies them to remote devices.
96+
97+
This subcommand can be run manually; or periodically using cron,
98+
a scheduled task, or a similar tool.
99+
100+
101+
USAGE
102+
-----
103+
puppet device [-h|--help] [-v|--verbose] [-d|--debug]
104+
[-l|--logdest syslog|<file>|console] [--detailed-exitcodes]
105+
[--deviceconfig <file>] [-w|--waitforcert <seconds>]
106+
[--libdir <directory>]
107+
[-a|--apply <file>] [-f|--facts] [-r|--resource <type> [name]]
108+
[-t|--target <device>] [--user=<user>] [-V|--version]
109+
110+
111+
DESCRIPTION
112+
-----------
113+
Devices require a proxy Puppet agent to request certificates, collect facts,
114+
retrieve and apply catalogs, and store reports.
115+
116+
117+
USAGE NOTES
118+
-----------
119+
Devices managed by the puppet-device subcommand on a Puppet agent are
120+
configured in device.conf, which is located at $confdir/device.conf by default,
121+
and is configurable with the $deviceconfig setting.
122+
123+
The device.conf file is an INI-like file, with one section per device:
124+
125+
[<DEVICE_CERTNAME>]
126+
type <TYPE>
127+
url <URL>
128+
debug
129+
130+
The section name specifies the certname of the device.
131+
132+
The values for the type and url properties are specific to each type of device.
133+
134+
The optional debug property specifies transport-level debugging,
135+
and is limited to telnet and ssh transports.
136+
137+
See https://puppet.com/docs/puppet/latest/config_file_device.html for details.
138+
139+
140+
OPTIONS
141+
-------
142+
Note that any setting that's valid in the configuration file is also a valid
143+
long argument. For example, 'server' is a valid configuration parameter, so
144+
you can specify '--server <servername>' as an argument.
145+
146+
* --help, -h:
147+
Print this help message
148+
149+
* --verbose, -v:
150+
Turn on verbose reporting.
151+
152+
* --debug, -d:
153+
Enable full debugging.
154+
155+
* --logdest, -l:
156+
Where to send log messages. Choose between 'syslog' (the POSIX syslog
157+
service), 'console', or the path to a log file. If debugging or verbosity is
158+
enabled, this defaults to 'console'. Otherwise, it defaults to 'syslog'.
159+
Multiple destinations can be set using a comma separated list
160+
(eg: `/path/file1,console,/path/file2`)"
161+
162+
A path ending with '.json' will receive structured output in JSON format. The
163+
log file will not have an ending ']' automatically written to it due to the
164+
appending nature of logging. It must be appended manually to make the content
165+
valid JSON.
166+
167+
* --detailed-exitcodes:
168+
Provide transaction information via exit codes. If this is enabled, an exit
169+
code of '1' means at least one device had a compile failure, an exit code of
170+
'2' means at least one device had resource changes, and an exit code of '4'
171+
means at least one device had resource failures. Exit codes of '3', '5', '6',
172+
or '7' means that a bitwise combination of the preceding exit codes happened.
173+
174+
* --deviceconfig:
175+
Path to the device config file for puppet device.
176+
Default: $confdir/device.conf
177+
178+
* --waitforcert, -w:
179+
This option only matters for targets that do not yet have certificates
180+
and it is enabled by default, with a value of 120 (seconds). This causes
181+
+puppet device+ to poll the server every 2 minutes and ask it to sign a
182+
certificate request. This is useful for the initial setup of a target.
183+
You can turn off waiting for certificates by specifying a time of 0.
184+
185+
* --libdir:
186+
Override the per-device libdir with a local directory. Specifying a libdir also
187+
disables pluginsync. This is useful for testing.
188+
189+
A path ending with '.jsonl' will receive structured output in JSON Lines
190+
format.
191+
192+
* --apply:
193+
Apply a manifest against a remote target. Target must be specified.
194+
195+
* --facts:
196+
Displays the facts of a remote target. Target must be specified.
197+
198+
* --resource:
199+
Displays a resource state as Puppet code, roughly equivalent to
200+
`puppet resource`. Can be filtered by title. Requires --target be specified.
201+
202+
* --target:
203+
Target a specific device/certificate in the device.conf. Doing so will perform a
204+
device run against only that device/certificate.
205+
206+
* --to_yaml:
207+
Output found resources in yaml format, suitable to use with Hiera and
208+
create_resources.
209+
210+
* --user:
211+
The user to run as.
212+
213+
214+
EXAMPLE
215+
-------
216+
$ puppet device --target remotehost --verbose
217+
218+
AUTHOR
219+
------
220+
Brice Figureau
221+
222+
223+
COPYRIGHT
224+
---------
225+
Copyright (c) 2011-2018 Puppet Inc., LLC
226+
Licensed under the Apache 2.0 License
227+
HELP
228228
end
229229

230230
def main

lib/puppet/configurer.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ def execute_prerun_command
4141

4242
# Initialize and load storage
4343
def init_storage
44-
Puppet::Util::Storage.load
44+
Puppet::Util::Storage.load
4545
rescue => detail
4646
Puppet.log_exception(detail, _("Removing corrupt state file %{file}: %{detail}") % { file: Puppet[:statefile], detail: detail })
4747
begin

lib/puppet/external/dot.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ def to_s(t = '')
273273
# This is a graph.
274274

275275
class DOTDigraph < DOTSubgraph
276-
def initialize(params = {}, option_list = GRAPH_OPTS)
277-
super(params, option_list)
278-
@dot_string = 'digraph'
279-
end
276+
def initialize(params = {}, option_list = GRAPH_OPTS)
277+
super(params, option_list)
278+
@dot_string = 'digraph'
279+
end
280280
end
281281

282282
# This is an edge.

lib/puppet/face/config.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ def warn_default_section(section_name)
110110
end
111111

112112
def report_section_and_environment(section_name, environment_name)
113-
$stderr.puts colorize(:hyellow,
114-
_("Resolving settings from section '%{section_name}' in environment '%{environment_name}'") %
115-
{ section_name: section_name, environment_name: environment_name })
113+
$stderr.puts colorize(:hyellow,
114+
_("Resolving settings from section '%{section_name}' in environment '%{environment_name}'") %
115+
{ section_name: section_name, environment_name: environment_name })
116116
end
117117

118118
action(:set) do

lib/puppet/feature/libuser.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
require_relative '../../puppet/util/libuser'
55

66
Puppet.features.add(:libuser) {
7-
File.executable?("/usr/sbin/lgroupadd") and
8-
File.executable?("/usr/sbin/luseradd") and
9-
Puppet::FileSystem.exist?(Puppet::Util::Libuser.getconf)
7+
File.executable?("/usr/sbin/lgroupadd") and
8+
File.executable?("/usr/sbin/luseradd") and
9+
Puppet::FileSystem.exist?(Puppet::Util::Libuser.getconf)
1010
}

lib/puppet/file_serving/base.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ class Puppet::FileServing::Base
1212

1313
# Does our file exist?
1414
def exist?
15-
stat
16-
return true
15+
stat
16+
return true
1717
rescue
18-
return false
18+
return false
1919
end
2020

2121
# Return the full path to our file. Fails if there's no path set.

lib/puppet/file_system.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@ module Puppet::FileSystem
1010

1111
# create instance of the file system implementation to use for the current platform
1212
@impl = if Puppet::Util::Platform.windows?
13-
require_relative 'file_system/windows'
14-
Puppet::FileSystem::Windows
13+
require_relative 'file_system/windows'
14+
Puppet::FileSystem::Windows
1515
elsif Puppet::Util::Platform.jruby?
1616
require_relative 'file_system/jruby'
1717
Puppet::FileSystem::JRuby

0 commit comments

Comments
 (0)