yast/yast-yast2

View on GitHub
library/desktop/src/clients/menu.rb

Summary

Maintainability
D
2 days
Test Coverage

Method main has a Cognitive Complexity of 36 (exceeds 5 allowed). Consider refactoring.
Open

    def main
      Yast.import "UI"

      textdomain "base"

Severity: Minor
Found in library/desktop/src/clients/menu.rb - About 5 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 main has 122 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def main
      Yast.import "UI"

      textdomain "base"

Severity: Major
Found in library/desktop/src/clients/menu.rb - About 4 hrs to fix

    File menu.rb has 309 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    require "shellwords"
    
    module Yast
      class MenuClient < Client
        def main
    Severity: Minor
    Found in library/desktop/src/clients/menu.rb - About 3 hrs to fix

      Method OpenMenu has 68 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def OpenMenu
            # check if user is root (#246015)
            output = Convert.to_map(
              SCR.Execute(path(".target.bash_output"), "/usr/bin/id --user")
            )
      Severity: Major
      Found in library/desktop/src/clients/menu.rb - About 2 hrs to fix

        Method ShowNcursesHelp has 54 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def ShowNcursesHelp
              # NCurses (textmode) Control Center headline
              headline = _("Controlling YaST ncurses with the Keyboard")
        
              # NCurses Control Center help 1/
        Severity: Major
        Found in library/desktop/src/clients/menu.rb - About 2 hrs to fix

          Method Launch has 28 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              def Launch(modul)
                function = Ops.get_string(@Modules, [modul, "X-SuSE-YaST-Call"], "")
                argument = Ops.get_string(@Modules, [modul, "X-SuSE-YaST-Argument"], "")
                Builtins.y2debug("Calling: %1 (%2)", function, argument)
          
          
          Severity: Minor
          Found in library/desktop/src/clients/menu.rb - About 1 hr to fix

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

                def Launch(modul)
                  function = Ops.get_string(@Modules, [modul, "X-SuSE-YaST-Call"], "")
                  argument = Ops.get_string(@Modules, [modul, "X-SuSE-YaST-Argument"], "")
                  Builtins.y2debug("Calling: %1 (%2)", function, argument)
            
            
            Severity: Minor
            Found in library/desktop/src/clients/menu.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

            There are no issues that match your filters.

            Category
            Status