yast/yast-network

View on GitHub
src/lib/y2network/dialogs/wireless_wep_keys.rb

Summary

Maintainability
B
4 hrs
Test Coverage

Method dialog has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

        def dialog(value = nil)
          value ||= ""
          Yast::UI.OpenDialog(
            Opt(:decorated),
            VBox(
Severity: Minor
Found in src/lib/y2network/dialogs/wireless_wep_keys.rb - About 1 hr to fix

    Method handle has 29 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def handle(event)
              return nil if event["EventReason"] != "Activated"
    
              cur = Yast::UI.QueryWidget(Id(:wep_keys_table), :CurrentItem).to_i
              case event["ID"]
    Severity: Minor
    Found in src/lib/y2network/dialogs/wireless_wep_keys.rb - About 1 hr to fix

      Method handle has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

              def handle(event)
                return nil if event["EventReason"] != "Activated"
      
                cur = Yast::UI.QueryWidget(Id(:wep_keys_table), :CurrentItem).to_i
                case event["ID"]
      Severity: Minor
      Found in src/lib/y2network/dialogs/wireless_wep_keys.rb - About 1 hr 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 refresh_table has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

              def refresh_table(selected_index)
                @settings.keys ||= [] # TODO: should be fixed by proper initialize of settings object
                table_items = @settings.keys.each_with_index.map do |key, i|
                  next unless key
      
      
      Severity: Minor
      Found in src/lib/y2network/dialogs/wireless_wep_keys.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 dialog has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

              def dialog(value = nil)
                value ||= ""
                Yast::UI.OpenDialog(
                  Opt(:decorated),
                  VBox(
      Severity: Minor
      Found in src/lib/y2network/dialogs/wireless_wep_keys.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