Skip to content

Commit

Permalink
- enable Style/Space*
Browse files Browse the repository at this point in the history
  • Loading branch information
aschnell committed Nov 6, 2018
1 parent d9c8aa6 commit 3e7017d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 50 deletions.
37 changes: 0 additions & 37 deletions .rubocop.yml
Expand Up @@ -446,43 +446,6 @@ Style/Semicolon:
Exclude:
- 'src/modules/IscsiClientLib.rb'

# Offense count: 1
# Cop supports --auto-correct.
Style/SpaceAfterMethodName:
Exclude:
- 'src/modules/IscsiClientLib.rb'

# Offense count: 1
# Cop supports --auto-correct.
# Configuration parameters: SupportedStyles.
# SupportedStyles: space, no_space
Style/SpaceAroundEqualsInParameterDefault:
EnforcedStyle: no_space

# Offense count: 7
# Cop supports --auto-correct.
# Configuration parameters: AllowForAlignment.
Style/SpaceAroundOperators:
Exclude:
- 'src/include/iscsi-client/widgets.rb'
- 'src/modules/IscsiClientLib.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, EnforcedStyleForEmptyBraces, SupportedStyles.
# SupportedStyles: space, no_space, compact
Style/SpaceInsideHashLiteralBraces:
Exclude:
- 'src/modules/IscsiClientLib.rb'
- 'test/getiBFT_spec.rb'

# Offense count: 6
# Cop supports --auto-correct.
Style/SpaceInsideParens:
Exclude:
- 'src/include/iscsi-client/widgets.rb'
- 'src/modules/IscsiClientLib.rb'

# Offense count: 4
# Cop supports --auto-correct.
# Configuration parameters: EnforcedStyle, SupportedStyles, ConsistentQuotesInMultiline.
Expand Down
4 changes: 2 additions & 2 deletions src/include/iscsi-client/widgets.rb
Expand Up @@ -390,7 +390,7 @@ def validateInitName(key, event)
Builtins.regexpmatch(i_name, Builtins.sformat("^eui.%1%2$", reg1, reg2))

if !correct
go_on = Popup.YesNoHeadline( _("Incorrect Initiator Name"),
go_on = Popup.YesNoHeadline(_("Incorrect Initiator Name"),
_(
"\n" +
"The correct syntax is\n" +
Expand Down Expand Up @@ -575,7 +575,7 @@ def validateServerLocation(key, event)
end
if !IP.Check(ip)
# check for valid host name
result = SCR.Execute( path(".target.bash_output"),
result = SCR.Execute(path(".target.bash_output"),
"LC_ALL=POSIX host #{ip}")
Builtins.y2milestone("Cmd: host %1, result: %2", ip, result)
output = result["stdout"] || ""
Expand Down
18 changes: 9 additions & 9 deletions src/modules/IscsiClientLib.rb
Expand Up @@ -173,7 +173,7 @@ def SetOffloadCard(new_card)
# @param [Boolean] do_log write command to y2log?
# @return [String] complete command
#
def GetAdmCmd(params, do_log=true)
def GetAdmCmd(params, do_log = true)
ret = "LC_ALL=POSIX iscsiadm"
ret = Ops.add(Ops.add(ret, " "), params)
Builtins.y2milestone("GetAdmCmd: #{ret}") if do_log
Expand Down Expand Up @@ -209,7 +209,7 @@ def getFirmwareInfo
# @param [String] stdout (where info is seperated by '=') of iscsiadm command
# @return [Hash] command output converted to hash
#
def nodeInfoToMap (stdout)
def nodeInfoToMap(stdout)
retval = {}
return retval if stdout.empty?

Expand Down Expand Up @@ -298,7 +298,7 @@ def setConfig(new_config)

# do we use iSNS for targets?
def useISNS
isns_info = {"use" => false, "address" => "", "port" => "3205"}
isns_info = { "use" => false, "address" => "", "port" => "3205" }
# validateISNS checks for not empty address and port,
# storeISNS adds values to config
Builtins.foreach(getConfig) do |row|
Expand Down Expand Up @@ -784,7 +784,7 @@ def deleteRecord
# converted to a hash
def getCurrentNodeValues
ret = SCR.Execute(path(".target.bash_output"),
GetAdmCmd("-m node -I #{@currentRecord[2]||"default"} -T #{@currentRecord[1]||""} -p #{@currentRecord[0]||""}"))
GetAdmCmd("-m node -I #{@currentRecord[2] || "default"} -T #{@currentRecord[1] || ""} -p #{@currentRecord[0] || ""}"))
return {} if ret["exit"] != 0

nodeInfoToMap(ret["stdout"] || "")
Expand Down Expand Up @@ -844,7 +844,7 @@ def setValue(name, value)
Builtins.y2milestone("set %1 for record %2", name, rec)

log = !name.include?("password");
cmd = "-m node -I #{rec[2]||"default"} -T #{rec[1]||""} -p #{rec[0]||""} --op=update --name=#{name}"
cmd = "-m node -I #{rec[2] || "default"} -T #{rec[1] || ""} -p #{rec[0] || ""} --op=update --name=#{name}"

command = GetAdmCmd("#{cmd} --value=#{value}", log)
if !log
Expand Down Expand Up @@ -925,10 +925,10 @@ def connected(check_ip)
if check_ip
session_ip = Ops.get(
Builtins.splitstring(Ops.get(list_row, 0, ""), ","),
0, "" )
0, "")
current_ip = Ops.get(
Builtins.splitstring(Ops.get(@currentRecord, 0, ""), ","),
0, "" )
0, "")
ip_ok = ipEqual?(session_ip, current_ip)
end

Expand Down Expand Up @@ -1067,8 +1067,8 @@ def loginIntoTarget(target)
# Report a warning (not an error) if login failed for other reasons
# (also related to bsc#981693, warning popups usually are skipped)
elsif output["exit"] != 0
Report.Warning( _("Target connection failed.\n") +
output["stderr"] || "" )
Report.Warning(_("Target connection failed.\n") +
output["stderr"] || "")
end

setStartupStatus("onboot") if !Mode.autoinst
Expand Down
4 changes: 2 additions & 2 deletions test/getiBFT_spec.rb
Expand Up @@ -28,7 +28,7 @@
ibft_data = @iscsilib.getiBFT()

expect(ibft_data).to eq(
{"# BEGIN RECORD 2.0-872" => "",
{ "# BEGIN RECORD 2.0-872" => "",
"# END RECORD" => "",
"iface.bootproto" => "STATIC",
"iface.hwaddress" => "00:00:c9:b1:bc:7f",
Expand All @@ -37,7 +37,7 @@
"iface.ipaddress" => "2620:0113:80c0:8000:000c:0000:0000:04dc",
"node.conn[0].address" => "172.0.21.6",
"node.conn[0].port" => "3260",
"node.name" => "iqn.1986-03.com.ibm:sn.135061874"})
"node.name" => "iqn.1986-03.com.ibm:sn.135061874" })
end
end

Expand Down

0 comments on commit 3e7017d

Please sign in to comment.