yast/yast-yast2

View on GitHub
library/cwm/src/modules/WizardHW.rb

Summary

Maintainability
B
5 hrs
Test Coverage

File WizardHW.rb has 276 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

module Yast
  class WizardHWClass < Module
    def main
Severity: Minor
Found in library/cwm/src/modules/WizardHW.rb - About 2 hrs to fix

    Method RunHWDialog has 53 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def RunHWDialog(settings)
          settings = deep_copy(settings)
          # reinitialize internal variables
          @current_items = []
          @descriptions = {}
    Severity: Major
    Found in library/cwm/src/modules/WizardHW.rb - About 2 hrs to fix

      Method Handle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def Handle(_key, event)
            event = deep_copy(event)
            @last_event = deep_copy(event)
            current = Convert.to_string(UI.QueryWidget(Id(:_hw_items), :CurrentItem))
            if Ops.get(event, "ID") == :_hw_items
      Severity: Minor
      Found in library/cwm/src/modules/WizardHW.rb - About 45 mins to fix

      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 CreateActionsButton has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def CreateActionsButton(actions)
            actions = deep_copy(actions)
            sz = Builtins.size(actions)
            return Empty() if sz == 0
      
      
      Severity: Minor
      Found in library/cwm/src/modules/WizardHW.rb - About 25 mins to fix

      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

      There are no issues that match your filters.

      Category
      Status