Skip to content

Commit

Permalink
fix Style/MultilineTernaryOperator
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Oct 31, 2019
1 parent ce166d0 commit 8197758
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 48 deletions.
8 changes: 0 additions & 8 deletions .rubocop_todo.yml
Expand Up @@ -141,14 +141,6 @@ Style/IdenticalConditionalBranches:
- 'src/modules/Profile.rb'
- 'src/modules/Y2ModuleConfig.rb'

# Offense count: 16
Style/MultilineTernaryOperator:
Exclude:
- 'src/include/autoinstall/ask.rb'
- 'src/include/autoinstall/conftree.rb'
- 'src/include/autoinstall/dialogs.rb'
- 'src/modules/AutoinstGeneral.rb'

# Offense count: 31
Style/MultipleComparison:
Exclude:
Expand Down
4 changes: 1 addition & 3 deletions src/include/autoinstall/conftree.rb
Expand Up @@ -396,9 +396,7 @@ def menus
_Menu = Wizard.AddMenuEntry(
_Menu,
"file-menu",
AutoinstConfig.ProfileEncrypted ?
_("Change to Decrypted") :
_("Change to Encrypted"),
AutoinstConfig.ProfileEncrypted ? _("Change to Decrypted") : _("Change to Encrypted"),
"change_encryption"
)
_Menu = Wizard.AddMenuEntry(
Expand Down
16 changes: 12 additions & 4 deletions src/include/autoinstall/dialogs.rb
Expand Up @@ -319,12 +319,16 @@ def ValidDialog
Builtins.y2debug("validation output: %1", o)
summary = Ops.add(
summary,
(Ops.get_integer(o, "exit", 1) != 0 ||
if Ops.get_integer(o, "exit", 1) != 0 ||
Ops.get_string(i, 2, "") == "jing sucks" &&
Ops.greater_than(
Builtins.size(Ops.get_string(o, "stderr", "")),
0
)) ? html_ko : html_ok
)
html_ko
else
html_ok
end
)
UpdateValidDialog(summary, Ops.get_string(o, "stderr", ""))
end
Expand Down Expand Up @@ -358,8 +362,12 @@ def ValidDialog
Builtins.y2debug("validation output: %1", o)
summary = Ops.add(
summary,
(Ops.get_integer(o, "exit", 1) != 0 ||
Ops.greater_than(Builtins.size(Ops.get_string(o, "stderr", "")), 0)) ? html_ko : html_ok
if Ops.get_integer(o, "exit", 1) != 0 ||
Ops.greater_than(Builtins.size(Ops.get_string(o, "stderr", "")), 0)
html_ko
else
html_ok
end
)
UpdateValidDialog(summary, Ops.get_string(o, "stderr", ""))
end
Expand Down
85 changes: 52 additions & 33 deletions src/modules/AutoinstGeneral.rb
Expand Up @@ -125,48 +125,53 @@ def Summary
summary = Summary.AddHeader(summary, _("Signature Handling"))
summary = Summary.AddLine(
summary,
Ops.get_boolean(@signature_handling, "accept_unsigned_file", false) ?
_("Accepting unsigned files") :
if Ops.get_boolean(@signature_handling, "accept_unsigned_file", false)
_("Accepting unsigned files")
else
_("Not accepting unsigned files")
end
)
summary = Summary.AddLine(
summary,
Ops.get_boolean(
if Ops.get_boolean(
@signature_handling,
"accept_file_without_checksum",
false
) ?
_("Accepting files without a checksum") :
)
_("Accepting files without a checksum")
else
_("Not accepting files without a checksum")
end
)
summary = Summary.AddLine(
summary,
Ops.get_boolean(
if Ops.get_boolean(
@signature_handling,
"accept_verification_failed",
false
) ?
_("Accepting failed verifications") :
)
_("Accepting failed verifications")
else
_("Not accepting failed verifications")
end
)
summary = Summary.AddLine(
summary,
Ops.get_boolean(@signature_handling, "accept_unknown_gpg_key", false) ?
_("Accepting unknown GPG keys") :
if Ops.get_boolean(@signature_handling, "accept_unknown_gpg_key", false)
_("Accepting unknown GPG keys")
else
_("Not accepting unknown GPG Keys")
end
)
summary = Summary.AddLine(
summary,
Ops.get_boolean(@signature_handling, "import_gpg_key", false) ?
_("Importing new GPG keys") :
if Ops.get_boolean(@signature_handling, "import_gpg_key", false)
_("Importing new GPG keys")
else
_("Not importing new GPG Keys")
end
)

# summary = Summary::AddHeader(summary, _("Proposals"));
# foreach(string p, proposals, ``{
# summary = Summary::AddLine(summary, p);
# });

summary
end

Expand Down Expand Up @@ -285,49 +290,55 @@ def SetSignatureHandling

if Builtins.haskey(@signature_handling, "accept_unsigned_file")
Pkg.CallbackAcceptUnsignedFile(
Ops.get_boolean(@signature_handling, "accept_unsigned_file", false) ?
if Ops.get_boolean(@signature_handling, "accept_unsigned_file", false)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_string_integer),
"boolean (string, integer)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_string_integer),
"boolean (string, integer)"
)
end
)
end
if Builtins.haskey(@signature_handling, "accept_file_without_checksum")
Pkg.CallbackAcceptFileWithoutChecksum(
Ops.get_boolean(
if Ops.get_boolean(
@signature_handling,
"accept_file_without_checksum",
false
) ?
)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_string),
"boolean (string)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_string),
"boolean (string)"
)
end
)
end
if Builtins.haskey(@signature_handling, "accept_verification_failed")
Pkg.CallbackAcceptVerificationFailed(
Ops.get_boolean(
if Ops.get_boolean(
@signature_handling,
"accept_verification_failed",
false
) ?
)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_string_map_integer),
"boolean (string, map <string, any>, integer)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_string_map_integer),
"boolean (string, map <string, any>, integer)"
)
end
)
end
if Builtins.haskey(@signature_handling, "trusted_key_added")
Expand All @@ -348,54 +359,62 @@ def SetSignatureHandling
end
if Builtins.haskey(@signature_handling, "accept_unknown_gpg_key")
Pkg.CallbackAcceptUnknownGpgKey(
Ops.get_boolean(@signature_handling, "accept_unknown_gpg_key", false) ?
if Ops.get_boolean(@signature_handling, "accept_unknown_gpg_key", false)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_string_string_integer),
"boolean (string, string, integer)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_string_string_integer),
"boolean (string, string, integer)"
)
end
)
end
if Builtins.haskey(@signature_handling, "import_gpg_key")
Pkg.CallbackImportGpgKey(
Ops.get_boolean(@signature_handling, "import_gpg_key", false) ?
if Ops.get_boolean(@signature_handling, "import_gpg_key", false)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_map_integer),
"boolean (map <string, any>, integer)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_map_integer),
"boolean (map <string, any>, integer)"
)
end
)
end
if Builtins.haskey(@signature_handling, "accept_wrong_digest")
Pkg.CallbackAcceptWrongDigest(
Ops.get_boolean(@signature_handling, "accept_wrong_digest", false) ?
if Ops.get_boolean(@signature_handling, "accept_wrong_digest", false)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_string_string_string),
"boolean (string, string, string)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_string_string_string),
"boolean (string, string, string)"
)
end
)
end
if Builtins.haskey(@signature_handling, "accept_unknown_digest")
Pkg.CallbackAcceptWrongDigest(
Ops.get_boolean(@signature_handling, "accept_unknown_digest", false) ?
if Ops.get_boolean(@signature_handling, "accept_unknown_digest", false)
fun_ref(
AutoInstall.method(:callbackTrue_boolean_string_string_string),
"boolean (string, string, string)"
) :
)
else
fun_ref(
AutoInstall.method(:callbackFalse_boolean_string_string_string),
"boolean (string, string, string)"
)
end
)
end

Expand Down

0 comments on commit 8197758

Please sign in to comment.