File PackageCallbacks.rb
has 2396 lines of code (exceeds 250 allowed). Consider refactoring. Open
require "yast"
require "uri"
require "packages/dummy_callbacks"
require "packages/file_conflict_callbacks"
Class PackageCallbacksClass
has 120 methods (exceeds 20 allowed). Consider refactoring. Open
class PackageCallbacksClass < Module
include Yast::Logger
# text to clean progress bar in command line
CLEAR_PROGRESS_TEXT = ("\b" * 10) + (" " * 10) + ("\b" * 10)
Method MediaChange
has a Cognitive Complexity of 101 (exceeds 5 allowed). Consider refactoring. Open
def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device)
devices = deep_copy(devices)
if @autorefreshing && @autorefreshing_aborted
Builtins.y2milestone("Refresh aborted")
return "C"
- 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 MediaChange
has 279 lines of code (exceeds 25 allowed). Consider refactoring. Open
def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device)
devices = deep_copy(devices)
if @autorefreshing && @autorefreshing_aborted
Builtins.y2milestone("Refresh aborted")
return "C"
Method DonePackage
has a Cognitive Complexity of 51 (exceeds 5 allowed). Consider refactoring. Open
def DonePackage(error, reason)
# remove invalid characters (bnc#876459)
if !reason.valid_encoding?
reason.encode!("UTF-16", undef: :replace, invalid: :replace, replace: "?")
reason.encode!("UTF-8")
- 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 DoneProvide
has a Cognitive Complexity of 48 (exceeds 5 allowed). Consider refactoring. Open
def DoneProvide(error, reason, name)
Builtins.y2milestone("DoneProvide: %1, %2, %3", error, reason, name)
if @_provide_popup
UI.CloseDialog
- 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 DoneProvide
has 110 lines of code (exceeds 25 allowed). Consider refactoring. Open
def DoneProvide(error, reason, name)
Builtins.y2milestone("DoneProvide: %1, %2, %3", error, reason, name)
if @_provide_popup
UI.CloseDialog
Method ProgressDownload
has a Cognitive Complexity of 29 (exceeds 5 allowed). Consider refactoring. Open
def ProgressDownload(percent, bps_avg, bps_current)
if @autorefreshing && @autorefreshing_aborted
Builtins.y2milestone("Refresh aborted")
return false
end
- 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 DonePackage
has 85 lines of code (exceeds 25 allowed). Consider refactoring. Open
def DonePackage(error, reason)
# remove invalid characters (bnc#876459)
if !reason.valid_encoding?
reason.encode!("UTF-16", undef: :replace, invalid: :replace, replace: "?")
reason.encode!("UTF-8")
Method ErrorScanDb
has a Cognitive Complexity of 22 (exceeds 5 allowed). Consider refactoring. Open
def ErrorScanDb(error, description)
Builtins.y2error(
"ErrorScanDb callback: error: %1, description: %2",
error,
description
- 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 InitPackageCallbacks
has 76 lines of code (exceeds 25 allowed). Consider refactoring. Open
def InitPackageCallbacks
SetProcessCallbacks()
SetProvideCallbacks()
Method ErrorScanDb
has 64 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ErrorScanDb(error, description)
Builtins.y2error(
"ErrorScanDb callback: error: %1, description: %2",
error,
description
Method main
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
def main
Yast.import "Pkg"
Yast.import "UI"
textdomain "base"
Method ScriptStart
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ScriptStart(patch_name, patch_version, patch_arch, script_path)
patch_full_name = FormatPatchName(patch_name, patch_version, patch_arch)
Builtins.y2milestone(
"ScriptStart callback: patch: %1, script: %2",
Method Authentication
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
def Authentication(url, msg, username, password)
# FIXME: after SLE12 release
# The following 'if' block is a workaround for bnc#895719 that should be
# extracted to a proper private method (not sure if it will work as
# expected being a callback) and adapted to use normal _() instead of
Method ProgressDownload
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ProgressDownload(percent, bps_avg, bps_current)
if @autorefreshing && @autorefreshing_aborted
Builtins.y2milestone("Refresh aborted")
return false
end
Method ProgressStart
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def ProgressStart(id, task, in_percent, is_alive, _min, _max, _val_raw, val_percent)
Builtins.y2milestone("ProgressStart: %1", id)
@tick_progress = is_alive
@val_progress = !in_percent && !is_alive
- 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 SourceProbeError
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def SourceProbeError(url, error, description)
Builtins.y2milestone(
"Source probe: error: url: %1, error: %2, description: %3",
URL.HidePassword(url),
error,
Method SourceCreateError
has 45 lines of code (exceeds 25 allowed). Consider refactoring. Open
def SourceCreateError(url, error, description)
Builtins.y2milestone(
"Source create: error: url: %1, error: %2, description: %3",
URL.HidePassword(url),
error,
Method SourceReportError
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def SourceReportError(source_id, url, error, description)
Builtins.y2milestone(
"Source report: error: id: %1, url: %2, error: %3, description: %4",
source_id,
URL.HidePassword(url),
Method ProgressStart
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ProgressStart(id, task, in_percent, is_alive, _min, _max, _val_raw, val_percent)
Builtins.y2milestone("ProgressStart: %1", id)
@tick_progress = is_alive
@val_progress = !in_percent && !is_alive
Method ProgressProgress
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
def ProgressProgress(id, val_raw, val_percent)
Builtins.y2debug("ProgressProgress: %1, %2%% ", id, val_percent)
if Mode.commandline
if @tick_progress
- 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 MediaChange
has 11 arguments (exceeds 4 allowed). Consider refactoring. Open
def MediaChange(error_code, error, url, product, current, current_label, wanted, wanted_label, double_sided, devices, current_device)
Method StartProvide
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def StartProvide(name, archivesize, remote)
Builtins.y2milestone("StartProvide: name: %1, remote: %2", name, remote)
if remote
sz = String.FormatSizeWithPrecision(archivesize, 2, false)
if Mode.commandline
- 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 AskAbortRefresh
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
def AskAbortRefresh
UI.OpenDialog(
MarginBox(
1,
0.5,
Method ProgressProgress
has 29 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ProgressProgress(id, val_raw, val_percent)
Builtins.y2debug("ProgressProgress: %1, %2%% ", id, val_percent)
if Mode.commandline
if @tick_progress
Method StartScanDb
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def StartScanDb
Builtins.y2milestone("Scanning RPM DB...")
if Mode.commandline
# progress message (command line mode)
Method cd_devices
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def cd_devices(preferred)
cds = Convert.convert(
SCR.Read(path(".probe.cdrom")),
from: "any",
to: "list <map>"
- 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 ProcessStart
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def ProcessStart(task, stages, help)
stages = deep_copy(stages)
Builtins.y2milestone(
"Process: Start: task: %1, stages: %2, help: %3",
task,
Method StartPackage
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def StartPackage(name, _location, _summary, installsize, is_delete)
return if !@enable_asterix_package
@_package_name = name
@_package_size = installsize
Method cd_devices
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def cd_devices(preferred)
cds = Convert.convert(
SCR.Read(path(".probe.cdrom")),
from: "any",
to: "list <map>"
Method layout_popup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def layout_popup(message, button_box, info_on)
vertical_size = info_on ? 10 : 1
VBox(
HSpacing(50), # enforce width
VSpacing(0.1),
Method ProgressStart
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
def ProgressStart(id, task, in_percent, is_alive, _min, _max, _val_raw, val_percent)
Method StartPackage
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def StartPackage(name, _location, _summary, installsize, is_delete)
return if !@enable_asterix_package
@_package_name = name
@_package_size = installsize
- 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 ScriptProgress
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def ScriptProgress(ping, output)
Builtins.y2milestone("ScriptProgress: ping:%1, output: %2", ping, output)
if @_script_popup
if ping
- 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 FormatPatchName
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def FormatPatchName(patch_name, patch_version, patch_arch)
patch_full_name = (!patch_name.nil? && patch_name != "") ? patch_name : ""
if patch_full_name != ""
if !patch_version.nil? && patch_version != ""
- 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 SourceReportEnd
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def SourceReportEnd(src_id, url, task, error, description)
Method StartPackage
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
def StartPackage(name, _location, _summary, installsize, is_delete)
Method SourceCreateError
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def SourceCreateError(url, error, description)
Builtins.y2milestone(
"Source create: error: url: %1, error: %2, description: %3",
URL.HidePassword(url),
error,
- 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 ScriptStart
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ScriptStart(patch_name, patch_version, patch_arch, script_path)
patch_full_name = FormatPatchName(patch_name, patch_version, patch_arch)
Builtins.y2milestone(
"ScriptStart callback: patch: %1, script: %2",
- 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 ProgressEnd
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def ProgressEnd(id)
Builtins.y2milestone("ProgressFinish: %1", id)
# remove the last element from the progress stack
@progress_stack = Builtins.remove(
- 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 process_message
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def process_message(msg, max_len)
words = msg.split
log.info "words: %{words}"
- 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 SourceProbeError
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def SourceProbeError(url, error, description)
Builtins.y2milestone(
"Source probe: error: url: %1, error: %2, description: %3",
URL.HidePassword(url),
error,
- 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 SourceReportError
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def SourceReportError(source_id, url, error, description)
Builtins.y2milestone(
"Source report: error: id: %1, url: %2, error: %3, description: %4",
source_id,
URL.HidePassword(url),
- 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
Avoid too many return
statements within this method. Open
return "C" if r == :abort
Avoid too many return
statements within this method. Open
return "R" if r == :retry
Avoid too many return
statements within this method. Open
return "E" if eject_device == ""
Avoid too many return
statements within this method. Open
return "R" if r == :retry
Avoid too many return
statements within this method. Open
return "I"
Avoid too many return
statements within this method. Open
return "I"
Avoid too many return
statements within this method. Open
return "I" if r == :ignore
Avoid too many return
statements within this method. Open
return "S"
Avoid too many return
statements within this method. Open
return "I"
Method ProgressScanDb
has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring. Open
def ProgressScanDb(value)
if Mode.commandline
CommandLine.PrintVerboseNoCR(CLEAR_PROGRESS_TEXT + "#{value}%")
elsif @_scan_popup && UI.WidgetExists(Id(:label_scanDB_popup))
UI.ChangeWidget(Id(:progress), :Value, value)
- 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
def SetProvideCallbacks
Pkg.CallbackStartProvide(
fun_ref(method(:StartProvide), "void (string, integer, boolean)")
)
Pkg.CallbackProgressProvide(
- 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 45.
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
def SetDownloadCallbacks
Pkg.CallbackInitDownload(fun_ref(method(:InitDownload), "void (string)"))
Pkg.CallbackStartDownload(
fun_ref(method(:StartDownload), "void (string, string)")
)
- 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 45.
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 3 locations. Consider refactoring. Open
def SetSourceCreateCallbacks
# source create callbacks
Pkg.CallbackSourceCreateStart(
fun_ref(method(:SourceCreateStart), "void (string)")
)
- 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 39.
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 3 locations. Consider refactoring. Open
def SetSourceReportCallbacks
# source report callbacks
Pkg.CallbackSourceReportStart(
fun_ref(method(:SourceReportStart), "void (integer, string, string)")
)
- 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 39.
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 3 locations. Consider refactoring. Open
def SetSourceProbeCallbacks
# source probing callbacks
Pkg.CallbackSourceProbeStart(
fun_ref(method(:SourceProbeStart), "void (string)")
)
- 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 39.
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
def SetHeaderSourcePopup(text)
# Qt UI uses bold font, the string must be shortened even more
ui_adjustment = textmode ? 0 : 5
if Ops.greater_than(
- 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 34.
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
def SetLabelSourcePopup(text)
# Qt uses proportional font, the string might be longer
ui_adjustment = textmode ? 0 : 6
if Ops.greater_than(
- 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 34.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if Mode.commandline
CommandLine.Print(message)
CommandLine.Print(URL.HidePassword(url))
CommandLine.Print(description)
- 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 33.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if Mode.commandline
CommandLine.Print(message)
CommandLine.Print(URL.HidePassword(url))
CommandLine.Print(description)
- 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 33.
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
error_symbol = "ERROR"
# https://github.com/openSUSE/libzypp/blob/8dda46306f06440e1acaefb36fb60f6ce909fd42/zypp/ZYppCallbacks.h#L106
case error
when 2
- 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
error_symbol = "UNKNOWN"
case error
when 0
error_symbol = "NO_ERROR"
- 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 4 locations. Consider refactoring. Open
def SetScanDBCallbacks
Pkg.CallbackStartScanDb(fun_ref(method(:StartScanDb), "void ()"))
Pkg.CallbackProgressScanDb(
fun_ref(method(:ProgressScanDb), "boolean (integer)")
)
- 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 27.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if CommandLine.Interactive
CommandLine.Print("")
# command line mode - ask user whether installation of the failed package should be retried
CommandLine.Print(_("Retry installation of the package?"))
- 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 27.
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 4 locations. Consider refactoring. Open
def SetRebuildDBCallbacks
Pkg.CallbackStartRebuildDb(fun_ref(method(:StartRebuildDB), "void ()"))
Pkg.CallbackProgressRebuildDb(
fun_ref(method(:ProgressRebuildDB), "void (integer)")
)
- 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 27.
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 4 locations. Consider refactoring. Open
def SetConvertDBCallbacks
Pkg.CallbackStartConvertDb(
fun_ref(method(:StartConvertDB), "void (string)")
)
Pkg.CallbackProgressConvertDb(
- 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 27.
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
Identical blocks of code found in 2 locations. Consider refactoring. Open
if CommandLine.Interactive
CommandLine.Print("")
# command line mode - ask user whether installation of the failed package should be retried
CommandLine.Print(_("Retry installation of the package?"))
- 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 27.
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 4 locations. Consider refactoring. Open
def SetProcessCallbacks
# register process callbacks (total progress)
Pkg.CallbackProcessStart(
fun_ref(method(:ProcessStart), "void (string, list <string>, string)")
)
- 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 27.
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