yast/yast-yast2

View on GitHub
library/log/src/modules/LogView.rb

Summary

Maintainability
D
2 days
Test Coverage

File LogView.rb has 362 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

module Yast
  class LogViewClass < Module
    def main
Severity: Minor
Found in library/log/src/modules/LogView.rb - About 4 hrs to fix

    Class LogViewClass has 21 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class LogViewClass < Module
        def main
          Yast.import "UI"
          textdomain "base"
    
    
    Severity: Minor
    Found in library/log/src/modules/LogView.rb - About 2 hrs to fix

      Method CreateHelp has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
      Open

          def CreateHelp(logs, parameters)
            parameters = deep_copy(parameters)
            help = Ops.get_string(parameters, "help", "")
            return help if help != "" && !help.nil?
      
      
      Severity: Minor
      Found in library/log/src/modules/LogView.rb - About 2 hrs 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 Display has 47 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def Display(parameters)
            parameters = deep_copy(parameters)
            @param = deep_copy(parameters)
      
            # menubutton
      Severity: Minor
      Found in library/log/src/modules/LogView.rb - About 1 hr to fix

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

            def CreateWidget(parameters, log_files)
              parameters = deep_copy(parameters)
              log_files = deep_copy(log_files)
              # logview caption
              caption = Ops.get_locale(@param, "log_label", _("&Log"))
        Severity: Minor
        Found in library/log/src/modules/LogView.rb - About 1 hr to fix

          Method LogHandle has 35 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def LogHandle(_key, event)
                event = deep_copy(event)
                @param = CWM.GetProcessedWidget
                LogViewCore.Update(Id(:_cwm_log))
                ret = Ops.get(event, "ID")
          Severity: Minor
          Found in library/log/src/modules/LogView.rb - About 1 hr to fix

            Method GetMenuButtonWidget has 32 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                def GetMenuButtonWidget(actions, save, mb_label)
                  actions = deep_copy(actions)
                  menubutton = []
                  if save
                    # menubutton entry
            Severity: Minor
            Found in library/log/src/modules/LogView.rb - About 1 hr to fix

              Method CreateHelp has 31 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  def CreateHelp(logs, parameters)
                    parameters = deep_copy(parameters)
                    help = Ops.get_string(parameters, "help", "")
                    return help if help != "" && !help.nil?
              
              
              Severity: Minor
              Found in library/log/src/modules/LogView.rb - About 1 hr to fix

                Method Display has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                Open

                    def Display(parameters)
                      parameters = deep_copy(parameters)
                      @param = deep_copy(parameters)
                
                      # menubutton
                Severity: Minor
                Found in library/log/src/modules/LogView.rb - About 55 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 GetMenuButtonWidget has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def GetMenuButtonWidget(actions, save, mb_label)
                      actions = deep_copy(actions)
                      menubutton = []
                      if save
                        # menubutton entry
                Severity: Minor
                Found in library/log/src/modules/LogView.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 LogHandle has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def LogHandle(_key, event)
                      event = deep_copy(event)
                      @param = CWM.GetProcessedWidget
                      LogViewCore.Update(Id(:_cwm_log))
                      ret = Ops.get(event, "ID")
                Severity: Minor
                Found in library/log/src/modules/LogView.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

                There are no issues that match your filters.

                Category
                Status