yast/yast-yast2

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

Summary

Maintainability
F
4 days
Test Coverage

File CWMTsigKeys.rb has 576 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"
require "shellwords"

module Yast
  class CWMTsigKeysClass < Module
Severity: Major
Found in library/cwm/src/modules/CWMTsigKeys.rb - About 1 day to fix

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

        def Handle(widget, _key, event)
          widget = deep_copy(widget)
          event = deep_copy(event)
          ret = Ops.get(event, "ID")
          existing_filename = Convert.to_string(
    Severity: Minor
    Found in library/cwm/src/modules/CWMTsigKeys.rb - About 1 day 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 Handle has 176 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def Handle(widget, _key, event)
          widget = deep_copy(widget)
          event = deep_copy(event)
          ret = Ops.get(event, "ID")
          existing_filename = Convert.to_string(
    Severity: Major
    Found in library/cwm/src/modules/CWMTsigKeys.rb - About 7 hrs to fix

      Method CreateWidget has 173 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def CreateWidget(settings)
            settings = deep_copy(settings)
            # tsig keys management dialog help 1/4
            help = _(
              "<p><big><b>TSIG Key Management</b></big><br>\nUse this dialog to manage the TSIG keys.</p>\n"
      Severity: Major
      Found in library/cwm/src/modules/CWMTsigKeys.rb - About 6 hrs to fix

        Avoid too many return statements within this method.
        Open

                  return nil
        Severity: Major
        Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

          Avoid too many return statements within this method.
          Open

                      return nil
          Severity: Major
          Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

            Avoid too many return statements within this method.
            Open

                      return nil
            Severity: Major
            Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

              Avoid too many return statements within this method.
              Open

                          return nil
              Severity: Major
              Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

                Avoid too many return statements within this method.
                Open

                          return nil unless Popup.YesNo(_("Specified file exists. Rewrite it?"))
                Severity: Major
                Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

                  Avoid too many return statements within this method.
                  Open

                            return nil
                  Severity: Major
                  Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

                    Avoid too many return statements within this method.
                    Open

                            return nil if !Popup.YesNo(_("The key will be created now. Continue?"))
                    Severity: Major
                    Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

                      Avoid too many return statements within this method.
                      Open

                                return nil
                      Severity: Major
                      Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

                        Avoid too many return statements within this method.
                        Open

                                    return nil
                        Severity: Major
                        Found in library/cwm/src/modules/CWMTsigKeys.rb - About 30 mins to fix

                          Method NormalizeFilename has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
                          Open

                              def NormalizeFilename(filename)
                                while filename != "" &&
                                    (Builtins.substring(filename, 0, 1) == " " ||
                                      Builtins.substring(filename, 0, 1) == "\"")
                                  filename = Builtins.substring(filename, 1)
                          Severity: Minor
                          Found in library/cwm/src/modules/CWMTsigKeys.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