File SignatureCheckDialogs.rb
has 838 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
module Yast
class SignatureCheckDialogsClass < Module
def main
Method ImportGPGKeyIntoTrustedDialog
has 78 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ImportGPGKeyIntoTrustedDialog(key, repository)
key = deep_copy(key)
# additional Richtext (HTML) warning text (kind of help), 1/2
warning_text = _(
"<p>The owner of the key may distribute updates,\n" \
Method UseUnsignedItem
has 70 lines of code (exceeds 25 allowed). Consider refactoring. Open
def UseUnsignedItem(item_type, item_name, dont_show_dialog_ident, repository)
Builtins.y2milestone(
"UseUnsignedItem: type: %1, name: %2, dontshowid: %3, repo: %4",
item_type,
item_name,
Class SignatureCheckDialogsClass
has 24 methods (exceeds 20 allowed). Consider refactoring. Open
class SignatureCheckDialogsClass < Module
def main
Yast.import "Pkg"
Yast.import "UI"
textdomain "base"
Method ItemSignedWithUnknownSignature
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialog_ident, repoid)
repo_url = Ops.get_string(Pkg.SourceGeneralData(repoid), "url", "")
description_text = Builtins.sformat(
if item_type == :package
# popup question, %1 stands for the package name, %2 for the complex multiline description of the GnuPG key
Method ItemSignedWithPublicSignature
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ItemSignedWithPublicSignature(item_type, item_name, key)
key = deep_copy(key)
description_text = Builtins.sformat(
if item_type == :package
# popup question, %1 stands for the package name, %2 for the key ID, %3 for the key name
Method UseItemWithNoChecksum
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def UseItemWithNoChecksum(item_type, item_name, dont_show_dialog_ident)
description_text = Builtins.sformat(
if item_type == :package
# popup question, %1 stands for the package name
_(
Method GPGKeyAsTerm
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def GPGKeyAsTerm(key)
key = deep_copy(key)
rt = Ops.add(
# GPG key property
Builtins.sformat(
Method UseCorruptedItem
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
def UseCorruptedItem(item_type, item_name, key, repository)
key = deep_copy(key)
repo = Pkg.SourceGeneralData(repository)
description_text = Builtins.sformat(
Method GPGKeyAsString
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def GPGKeyAsString(key)
key = deep_copy(key)
# Part of the GnuPG key description in popup, %1 is a GnuPG key ID
Ops.add(
Ops.add(
Method StringSplitter
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def StringSplitter(whattosplit, delimiter, after_chars)
splittedstring = ""
after_chars_counter = 0
max_size = Builtins.size(whattosplit)
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method SetShowThisPopup
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def SetShowThisPopup(popup_type, show_it, popup_url)
if popup_type.nil? || show_it.nil?
Builtins.y2error(
"Neither popup_type %1 nor show_it %2 can be nil!",
popup_type,
Method RunSimpleErrorPopup
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def RunSimpleErrorPopup(heading, description_text, dont_show_dialog_ident, dont_show_dialog_param)
UI.OpenDialog(
Opt(:decorated),
VBox(
# dialog heading - displayed in a big bold font
Method ItemSignedWithUnknownSignature
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialog_ident, repoid)
Method GPGKeyAsString
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def GPGKeyAsString(key)
key = deep_copy(key)
# Part of the GnuPG key description in popup, %1 is a GnuPG key ID
Ops.add(
Ops.add(
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method WaitForSymbolUserInput
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def WaitForSymbolUserInput(list_of_accepted, default_symb)
list_of_accepted = deep_copy(list_of_accepted)
user_input = nil
ret = nil
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ItemSignedWithUnknownSignature
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ItemSignedWithUnknownSignature(item_type, item_name, key_id, dont_show_dialog_ident, repoid)
repo_url = Ops.get_string(Pkg.SourceGeneralData(repoid), "url", "")
description_text = Builtins.sformat(
if item_type == :package
# popup question, %1 stands for the package name, %2 for the complex multiline description of the GnuPG key
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method UseUnsignedItem
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def UseUnsignedItem(item_type, item_name, dont_show_dialog_ident, repository)
Builtins.y2milestone(
"UseUnsignedItem: type: %1, name: %2, dontshowid: %3, repo: %4",
item_type,
item_name,
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method ImportGPGKeyIntoTrustedDialog
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ImportGPGKeyIntoTrustedDialog(key, repository)
key = deep_copy(key)
# additional Richtext (HTML) warning text (kind of help), 1/2
warning_text = _(
"<p>The owner of the key may distribute updates,\n" \
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Method WaitForYesNoCancelUserInput
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def WaitForYesNoCancelUserInput
user_input = nil
ret = nil
loop do
- Read upRead up
Cognitive Complexity
Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.
A method's cognitive complexity is based on a few simple rules:
- Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
- Code is considered more complex for each "break in the linear flow of the code"
- Code is considered more complex when "flow breaking structures are nested"
Further reading
Similar blocks of code found in 2 locations. Consider refactoring. Open
UI.OpenDialog(
Opt(:decorated),
VBox(
# popup heading
Heading(_("Unknown GnuPG Key")),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 30.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
UI.OpenDialog(
Opt(:decorated),
VBox(
# popup heading
Heading(_("No Checksum Found")),
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 30.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if Ops.greater_than(Builtins.size(Ops.get_string(key, "created", "")), 0)
# GPG key property
rt = Ops.add(
rt,
Builtins.sformat(
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 25.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76
Similar blocks of code found in 2 locations. Consider refactoring. Open
if Ops.greater_than(Builtins.size(Ops.get_string(key, "expires", "")), 0)
# GPG key property
rt = Ops.add(
rt,
Builtins.sformat(
- Read upRead up
Duplicated Code
Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:
Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.
When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).
Tuning
This issue has a mass of 25.
We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.
The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.
If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.
See codeclimate-duplication
's documentation for more information about tuning the mass threshold in your .codeclimate.yml
.
Refactorings
- Extract Method
- Extract Class
- Form Template Method
- Introduce Null Object
- Pull Up Method
- Pull Up Field
- Substitute Algorithm
Further Reading
- Don't Repeat Yourself on the C2 Wiki
- Duplicated Code on SourceMaking
- Refactoring: Improving the Design of Existing Code by Martin Fowler. Duplicated Code, p76