Skip to content

Commit 2241371

Browse files
authored
Merge pull request #9195 from mhashizume/PUP-11768/main/additional-layout-cops
(PUP-11768) Additional Layout cops
2 parents da413eb + 19bdb37 commit 2241371

File tree

337 files changed

+8035
-7979
lines changed

Some content is hidden

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

337 files changed

+8035
-7979
lines changed

.rubocop.yml

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ AllCops:
1717
- 'lib/puppet/vendor/**/*'
1818
- 'lib/puppet/pops/parser/eparser.rb'
1919

20-
# This cop would completely reformat defaults, so we skip it for now.
21-
Layout/ArgumentAlignment:
20+
# The formatting of defaults is unusual, so let's skip layout cops.
21+
Layout:
2222
Exclude:
2323
- 'lib/puppet/defaults.rb'
2424

@@ -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: 1 addition & 89 deletions
Original file line numberDiff line numberDiff line change
@@ -22,94 +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: EnforcedStyleAlignWith, Severity.
27-
# SupportedStylesAlignWith: keyword, variable, start_of_line
28-
Layout/EndAlignment:
29-
Enabled: false
30-
31-
# This cop supports safe auto-correction (--auto-correct).
32-
# Configuration parameters: AllowForAlignment, AllowBeforeTrailingComments, ForceEqualSignAlignment.
33-
Layout/ExtraSpacing:
34-
Enabled: false
35-
36-
# This cop supports safe auto-correction (--auto-correct).
37-
# Configuration parameters: EnforcedStyle, IndentationWidth.
38-
# SupportedStyles: consistent, consistent_relative_to_receiver, special_for_inner_method_call, special_for_inner_method_call_in_parentheses
39-
Layout/FirstArgumentIndentation:
40-
Enabled: false
41-
42-
# This cop supports safe auto-correction (--auto-correct).
43-
# Configuration parameters: EnforcedStyle, IndentationWidth.
44-
# SupportedStyles: special_inside_parentheses, consistent, align_brackets
45-
Layout/FirstArrayElementIndentation:
46-
Exclude:
47-
- 'lib/puppet/file_serving/mount/file.rb'
48-
- 'lib/puppet/functions/lookup.rb'
49-
- 'lib/puppet/pops/loader/static_loader.rb'
50-
- 'lib/puppet/pops/model/ast.rb'
51-
- 'lib/puppet/pops/model/pn_transformer.rb'
52-
- 'lib/puppet/pops/resource/resource_type_impl.rb'
53-
- 'lib/puppet/pops/types/iterable.rb'
54-
- 'lib/puppet/pops/types/p_uri_type.rb'
55-
- 'lib/puppet/pops/types/types.rb'
56-
- 'lib/puppet/provider/nameservice/pw.rb'
57-
- 'lib/puppet/type/file/content.rb'
58-
59-
# This cop supports safe auto-correction (--auto-correct).
60-
# Configuration parameters: EnforcedStyle, IndentationWidth.
61-
# SupportedStyles: special_inside_parentheses, consistent, align_braces
62-
Layout/FirstHashElementIndentation:
63-
Enabled: false
64-
65-
# This cop supports safe auto-correction (--auto-correct).
66-
# Configuration parameters: EnforcedStyle, IndentationWidth.
67-
# SupportedStyles: consistent, align_parentheses
68-
Layout/FirstParameterIndentation:
69-
Exclude:
70-
- 'lib/puppet/pal/pal_impl.rb'
71-
72-
# This cop supports safe auto-correction (--auto-correct).
73-
# Configuration parameters: AllowMultipleStyles, EnforcedHashRocketStyle, EnforcedColonStyle, EnforcedLastArgumentHashStyle.
74-
# SupportedHashRocketStyles: key, separator, table
75-
# SupportedColonStyles: key, separator, table
76-
# SupportedLastArgumentHashStyles: always_inspect, always_ignore, ignore_implicit, ignore_explicit
77-
Layout/HashAlignment:
78-
Enabled: false
79-
80-
# This cop supports safe auto-correction (--auto-correct).
81-
Layout/HeredocIndentation:
82-
Enabled: false
83-
84-
# This cop supports safe auto-correction (--auto-correct).
85-
# Configuration parameters: EnforcedStyle.
86-
# SupportedStyles: normal, indented_internal_methods
87-
Layout/IndentationConsistency:
88-
Enabled: false
89-
90-
# This cop supports safe auto-correction (--auto-correct).
91-
# Configuration parameters: IndentationWidth, EnforcedStyle.
92-
# SupportedStyles: spaces, tabs
93-
Layout/IndentationStyle:
94-
Exclude:
95-
- 'lib/puppet/ffi/windows/structs.rb'
96-
- 'lib/puppet/transaction.rb'
97-
98-
# This cop supports safe auto-correction (--auto-correct).
99-
# Configuration parameters: Width, AllowedPatterns, IgnoredPatterns.
100-
Layout/IndentationWidth:
101-
Enabled: false
102-
103-
# This cop supports safe auto-correction (--auto-correct).
104-
Layout/InitialIndentation:
105-
Exclude:
106-
- 'lib/puppet/parser/functions/require.rb'
107-
108-
# This cop supports safe auto-correction (--auto-correct).
109-
# Configuration parameters: AllowDoxygenCommentStyle, AllowGemfileRubyComment.
110-
Layout/LeadingCommentSpace:
111-
Enabled: false
112-
11325
# This cop supports safe auto-correction (--auto-correct).
11426
Layout/LeadingEmptyLines:
11527
Exclude:
@@ -1565,4 +1477,4 @@ Style/ZeroLengthPredicate:
15651477
# Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, IgnoredPatterns.
15661478
# URISchemes: http, https
15671479
Layout/LineLength:
1568-
Max: 580
1480+
Enabled: false

ext/windows/service/daemon.rb

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
require 'puppet/util/windows/monkey_patches/process'
1414

1515
class WindowsDaemon < Puppet::Util::Windows::Daemon
16-
CREATE_NEW_CONSOLE = 0x00000010
16+
CREATE_NEW_CONSOLE = 0x00000010
1717

1818
@run_thread = nil
1919
@LOG_TO_FILE = false
@@ -146,9 +146,9 @@ def report_windows_event(type,id,message)
146146
eventlog = nil
147147
eventlog = Puppet::Util::Windows::EventLog.open("Puppet")
148148
eventlog.report_event(
149-
:event_type => type, # EVENTLOG_ERROR_TYPE, etc
150-
:event_id => id, # 0x01 or 0x02, 0x03 etc.
151-
:data => message # "the message"
149+
:event_type => type, # EVENTLOG_ERROR_TYPE, etc
150+
:event_id => id, # 0x01 or 0x02, 0x03 etc.
151+
:data => message # "the message"
152152
)
153153
rescue Exception
154154
# Ignore all errors

lib/hiera/puppet_function.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ def self.init_dispatch
2323
scope_param
2424
param 'String',:key
2525
param 'Any', :default
26-
optional_param 'Any', :override
26+
optional_param 'Any', :override
2727
end
2828

2929
dispatch :hiera_block1 do
@@ -62,7 +62,7 @@ def hiera_block2(scope, key, override, &default_block)
6262

6363
def lookup(scope, key, default, has_default, override, &default_block)
6464
unless Puppet[:strict] == :off
65-
#TRANSLATORS 'lookup' is a puppet function and should not be translated
65+
# TRANSLATORS 'lookup' is a puppet function and should not be translated
6666
message = _("The function '%{class_name}' is deprecated in favor of using 'lookup'.") % { class_name: self.class.name }
6767
message += ' '+ _("See https://puppet.com/docs/puppet/%{minor_version}/deprecated_language.html") %
6868
{ minor_version: Puppet.minor_version }

lib/puppet/application.rb

Lines changed: 5 additions & 5 deletions
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

@@ -365,8 +365,8 @@ def initialize(command_line = Puppet::Util::CommandLine.new)
365365
# @api public
366366
def app_defaults
367367
Puppet::Settings.app_defaults_for_run_mode(self.class.run_mode).merge(
368-
:name => name
369-
)
368+
:name => name
369+
)
370370
end
371371

372372
# Initialize application defaults. It's usually not necessary to override this method.
@@ -504,8 +504,8 @@ def configure_indirector_routes
504504
def log_runtime_environment(extra_info=nil)
505505
runtime_info = {
506506
'puppet_version' => Puppet.version,
507-
'ruby_version' => RUBY_VERSION,
508-
'run_mode' => self.class.run_mode.name
507+
'ruby_version' => RUBY_VERSION,
508+
'run_mode' => self.class.run_mode.name
509509
}
510510
unless Puppet::Util::Platform.jruby_fips?
511511
runtime_info['openssl_version'] = "'#{OpenSSL::OPENSSL_VERSION}'"

0 commit comments

Comments
 (0)