Skip to content

Commit 211f998

Browse files
committed
(CONT-789) Rubocop Auto Fixes 26-28
- Style/SoleNestedConditional - Style/TernaryParentheses - Style/TrailingCommaInHashLiteral
1 parent 6db3987 commit 211f998

File tree

15 files changed

+45
-81
lines changed

15 files changed

+45
-81
lines changed

.rubocop_todo.yml

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -235,13 +235,6 @@ Style/OptionalBooleanParameter:
235235
- 'lib/puppet/functions/mysql/password.rb'
236236
- 'lib/puppet/functions/mysql_password.rb'
237237

238-
# Offense count: 1
239-
# This cop supports safe autocorrection (--autocorrect).
240-
# Configuration parameters: AllowModifier.
241-
Style/SoleNestedConditional:
242-
Exclude:
243-
- 'lib/puppet/type/mysql_grant.rb'
244-
245238
# Offense count: 6
246239
# This cop supports unsafe autocorrection (--autocorrect-all).
247240
# Configuration parameters: Mode.
@@ -263,30 +256,3 @@ Style/SymbolProc:
263256
- 'lib/puppet/provider/mysql_login_path/inifile.rb'
264257
- 'spec/unit/puppet/provider/mysql_database/mysql_spec.rb'
265258
- 'spec/unit/puppet/provider/mysql_user/mysql_spec.rb'
266-
267-
# Offense count: 1
268-
# This cop supports safe autocorrection (--autocorrect).
269-
# Configuration parameters: EnforcedStyle, AllowSafeAssignment.
270-
# SupportedStyles: require_parentheses, require_no_parentheses, require_parentheses_when_complex
271-
Style/TernaryParentheses:
272-
Exclude:
273-
- 'spec/spec_helper_acceptance_local.rb'
274-
275-
# Offense count: 43
276-
# This cop supports safe autocorrection (--autocorrect).
277-
# Configuration parameters: EnforcedStyleForMultiline.
278-
# SupportedStylesForMultiline: comma, consistent_comma, no_comma
279-
Style/TrailingCommaInHashLiteral:
280-
Exclude:
281-
- 'lib/puppet/provider/mysql_grant/mysql.rb'
282-
- 'lib/puppet/provider/mysql_login_path/mysql_login_path.rb'
283-
- 'lib/puppet/type/mysql_login_path.rb'
284-
- 'spec/classes/graceful_failures_spec.rb'
285-
- 'spec/classes/mysql_backup_mysqldump_spec.rb'
286-
- 'spec/classes/mysql_bindings_spec.rb'
287-
- 'spec/classes/mysql_client_spec.rb'
288-
- 'spec/classes/mysql_server_backup_spec.rb'
289-
- 'spec/classes/mysql_server_spec.rb'
290-
- 'spec/spec_helper.rb'
291-
- 'spec/unit/puppet/provider/mysql_login_path/mysql_login_path_spec.rb'
292-
- 'spec/unit/puppet/provider/mysql_user/mysql_spec.rb'

lib/puppet/provider/mysql_grant/mysql.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ def self.instances
9191
privileges: sorted_privileges,
9292
table: table,
9393
user: "#{user}@#{host}",
94-
options: options.uniq,
94+
options: options.uniq
9595
}
9696
end
9797
end

lib/puppet/provider/mysql_login_path/mysql_login_path.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ def mysql_config_editor_set_cmd(context, uid, password = nil, *args)
4848
) % {
4949
str: command_str,
5050
exit_status: $CHILD_STATUS.exitstatus,
51-
output: e.message,
51+
output: e.message
5252
}
5353
end
5454
end

lib/puppet/type/mysql_grant.rb

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,7 @@ def initialize(*args)
3838
raise(_('mysql_grant: `table` `parameter` is required.')) if self[:ensure] == :present && self[:table].nil?
3939
raise(_('mysql_grant: `user` `parameter` is required.')) if self[:ensure] == :present && self[:user].nil?
4040

41-
if self[:user] && self[:table]
42-
raise(_('mysql_grant: `name` `parameter` must match user@host/table format.')) if self[:name] != "#{self[:user]}/#{self[:table]}"
43-
end
41+
raise(_('mysql_grant: `name` `parameter` must match user@host/table format.')) if self[:user] && self[:table] && (self[:name] != "#{self[:user]}/#{self[:table]}")
4442
end
4543

4644
newparam(:name, namevar: true) do

lib/puppet/type/mysql_login_path.rb

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,48 +36,48 @@
3636
title_patterns: [
3737
{
3838
pattern: %r{^(?<name>.*[^-])-(?<owner>.*)$},
39-
desc: 'Where the name of the and the owner are provided with a hyphen seperator',
39+
desc: 'Where the name of the and the owner are provided with a hyphen seperator'
4040
},
4141
{
4242
pattern: %r{^(?<name>.*)$},
43-
desc: 'Where only the name is provided',
43+
desc: 'Where only the name is provided'
4444
},
4545
],
4646
attributes: {
4747
ensure: {
4848
type: 'Enum[present, absent]',
49-
desc: 'Whether this resource should be present or absent on the target system.',
49+
desc: 'Whether this resource should be present or absent on the target system.'
5050
},
5151
name: {
5252
type: 'String',
5353
desc: 'Name of the login path you want to manage.',
54-
behaviour: :namevar,
54+
behaviour: :namevar
5555
},
5656
owner: {
5757
type: 'String',
5858
desc: 'The user to whom the logon path should belong.',
5959
behaviour: :namevar,
60-
default: 'root',
60+
default: 'root'
6161
},
6262
host: {
6363
type: 'Optional[String]',
64-
desc: 'Host name to be entered into the login path.',
64+
desc: 'Host name to be entered into the login path.'
6565
},
6666
user: {
6767
type: 'Optional[String]',
68-
desc: 'Username to be entered into the login path.',
68+
desc: 'Username to be entered into the login path.'
6969
},
7070
password: {
7171
type: 'Optional[Sensitive[String[1]]]',
72-
desc: 'Password to be entered into login path',
72+
desc: 'Password to be entered into login path'
7373
},
7474
socket: {
7575
type: 'Optional[String]',
76-
desc: 'Socket path to be entered into login path',
76+
desc: 'Socket path to be entered into login path'
7777
},
7878
port: {
7979
type: 'Optional[Integer[0,65535]]',
80-
desc: 'Port number to be entered into login path.',
81-
},
80+
desc: 'Port number to be entered into login path.'
81+
}
8282
},
8383
)

spec/classes/graceful_failures_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
let(:facts) do
88
{
99
os: { family: 'UNSUPPORTED',
10-
name: 'UNSUPPORTED' },
10+
name: 'UNSUPPORTED' }
1111
}
1212
end
1313

spec/classes/mysql_backup_mysqldump_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ class { 'mysql::server': }
7676
let(:params) do
7777
{
7878
'file_per_database' => true,
79-
'excludedatabases' => ['information_schema'],
79+
'excludedatabases' => ['information_schema']
8080
}.merge(default_params)
8181
end
8282

spec/classes/mysql_bindings_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
'client_dev' => true,
2222
'daemon_dev' => true,
2323
'client_dev_package_name' => 'libmysqlclient-devel',
24-
'daemon_dev_package_name' => 'mysql-devel',
24+
'daemon_dev_package_name' => 'mysql-devel'
2525
}
2626
end
2727

spec/classes/mysql_client_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
let(:params) do
3838
{
3939
package_provider: 'dpkg',
40-
package_source: '/somewhere',
40+
package_source: '/somewhere'
4141
}
4242
end
4343

spec/classes/mysql_server_backup_spec.rb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ class { 'mysql::server': }
109109
context 'with delete after dump' do
110110
let(:custom_params) do
111111
{
112-
'delete_before_dump' => false,
112+
'delete_before_dump' => false
113113
}
114114
end
115115
let(:params) do
@@ -123,7 +123,7 @@ class { 'mysql::server': }
123123
let(:custom_params) do
124124
{
125125
'delete_before_dump' => false,
126-
'backup_success_file_path' => '/opt/mysqlbackup_success',
126+
'backup_success_file_path' => '/opt/mysqlbackup_success'
127127
}
128128
end
129129
let(:params) do

0 commit comments

Comments
 (0)