Skip to content

Commit 99ae2cf

Browse files
authored
Merge pull request #9231 from tvpartytonight/PUP-11767
(PUP-11767) Enable more style cops
2 parents a20a869 + 580d37d commit 99ae2cf

File tree

138 files changed

+273
-246
lines changed

Some content is hidden

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

138 files changed

+273
-246
lines changed

.rubocop.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,3 +208,27 @@ Style/CaseEquality:
208208

209209
Style/CaseLikeIf:
210210
Enabled: true
211+
212+
Style/ClassCheck:
213+
Enabled: true
214+
215+
Style/ClassEqualityComparison:
216+
Enabled: true
217+
218+
Style/ClassMethods:
219+
Enabled: true
220+
221+
Style/CollectionCompact:
222+
Enabled: true
223+
224+
Style/ColonMethodCall:
225+
Enabled: true
226+
227+
Style/CombinableLoops:
228+
Enabled: true
229+
230+
Style/ColonMethodDefinition:
231+
Enabled: true
232+
233+
Style/DefWithParentheses:
234+
Enabled: true

.rubocop_todo.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -341,7 +341,10 @@ Style/CommentedKeyword:
341341
Style/ConditionalAssignment:
342342
Enabled: false
343343

344-
# This cop supports safe auto-correction (--auto-correct).
344+
# Enabling this would require reworking Puppet's use of DateTime's #rfc2822, #httptime, and _strptime
345+
Style/DateTime:
346+
Enabled: false
347+
345348
Style/DefWithParentheses:
346349
Enabled: false
347350

lib/puppet/application.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ def app_defaults
372372
# Initialize application defaults. It's usually not necessary to override this method.
373373
# @return [void]
374374
# @api public
375-
def initialize_app_defaults()
375+
def initialize_app_defaults
376376
Puppet.settings.initialize_app_defaults(app_defaults)
377377
end
378378

lib/puppet/application/apply.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ def apply_catalog(catalog)
366366

367367
# Returns facts or nil
368368
#
369-
def get_facts()
369+
def get_facts
370370
facts = nil
371371
unless Puppet[:node_name_fact].empty?
372372
# Collect our facts.
@@ -381,7 +381,7 @@ def get_facts()
381381

382382
# Returns the node or raises and error if node not found.
383383
#
384-
def get_node()
384+
def get_node
385385
node = Puppet::Node.indirection.find(Puppet[:node_name_value])
386386
raise _("Could not find node %{node}") % { node: Puppet[:node_name_value] } unless node
387387

@@ -390,7 +390,7 @@ def get_node()
390390

391391
# Returns either a manifest (filename) or nil if apply should use content of Puppet[:code]
392392
#
393-
def get_manifest()
393+
def get_manifest
394394
manifest = nil
395395
# Set our code or file to use.
396396
if options[:code] or command_line.args.length == 0

lib/puppet/daemon.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def daemonize
5858

5959
# Close stdin/stdout/stderr so that we can finish our transition into 'daemon' mode.
6060
# @return nil
61-
def self.close_streams()
61+
def self.close_streams
6262
Puppet.debug("Closing streams for daemon mode")
6363
begin
6464
$stdin.reopen "/dev/null"
@@ -68,15 +68,15 @@ def self.close_streams()
6868
Puppet.debug("Finished closing streams for daemon mode")
6969
rescue => detail
7070
Puppet.err "Could not start #{Puppet.run_mode.name}: #{detail}"
71-
Puppet::Util::replace_file("/tmp/daemonout", 0644) do |f|
71+
Puppet::Util.replace_file("/tmp/daemonout", 0644) do |f|
7272
f.puts "Could not start #{Puppet.run_mode.name}: #{detail}"
7373
end
7474
exit(12)
7575
end
7676
end
7777

7878
# Convenience signature for calling Puppet::Daemon.close_streams
79-
def close_streams()
79+
def close_streams
8080
Puppet::Daemon.close_streams
8181
end
8282

lib/puppet/face/generate.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
raise ArgumentError, _("The output directory '%{outputdir}' exists and is not a directory") % { outputdir: outputdir }
5959
end
6060

61-
Puppet::FileSystem::mkpath(outputdir)
61+
Puppet::FileSystem.mkpath(outputdir)
6262

6363
generator.generate(inputs, outputdir, options[:force])
6464

lib/puppet/face/help.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ def legacy_applications
160160
# @return [Array] An Array of Arrays. The outer array contains one entry per application; each
161161
# element in the outer array is a pair whose first element is a String containing the application
162162
# name, and whose second element is a String containing the summary for that application.
163-
def all_application_summaries()
163+
def all_application_summaries
164164
available_application_names_special_sort().inject([]) do |result, appname|
165165
next result if exclude_from_docs?(appname)
166166

@@ -196,7 +196,7 @@ def all_application_summaries()
196196
COMMON = 'Common:'
197197
SPECIALIZED = 'Specialized:'
198198
BLANK = "\n"
199-
def available_application_names_special_sort()
199+
def available_application_names_special_sort
200200
full_list = Puppet::Application.available_application_names
201201
a_list = full_list & %w{apply agent config help lookup module resource}
202202
a_list = a_list.sort

lib/puppet/file_bucket/file.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -125,7 +125,7 @@ def checksum_data(base_method)
125125
end
126126

127127
def to_binary
128-
Puppet::FileSystem::binread(@path)
128+
Puppet::FileSystem.binread(@path)
129129
end
130130
end
131131
end

lib/puppet/file_system/windows.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ def chmod(mode, path)
115115

116116
def read_preserve_line_endings(path)
117117
contents = path.read(:mode => 'rb', :encoding => 'bom|utf-8')
118-
contents = path.read(:mode => 'rb', :encoding => "bom|#{Encoding::default_external.name}") unless contents.valid_encoding?
118+
contents = path.read(:mode => 'rb', :encoding => "bom|#{Encoding.default_external.name}") unless contents.valid_encoding?
119119
contents = path.read unless contents.valid_encoding?
120120

121121
contents

lib/puppet/functions/break.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
dispatch :break_impl do
3838
end
3939

40-
def break_impl()
40+
def break_impl
4141
# get file, line if available, else they are set to nil
4242
file, line = Puppet::Pops::PuppetStack.top_of_stack
4343

0 commit comments

Comments
 (0)