yast/yast-yast2

View on GitHub
library/system/src/lib/yast2/clients/view_anymsg.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

    def main
      textdomain "base"

      # the command line description map
      return CommandLine.Run("id" => "view_anymsg") if WFM.Args.first == "help"
Severity: Minor
Found in library/system/src/lib/yast2/clients/view_anymsg.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 dialog_content has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def dialog_content
      VBox(
        HSpacing(70), # force width
        HBox(
          HSpacing(1.0),
Severity: Minor
Found in library/system/src/lib/yast2/clients/view_anymsg.rb - About 1 hr to fix

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

        def start_journal?
          case file_state(selected_filename)
          when :ok
            false
          when :empty
    Severity: Minor
    Found in library/system/src/lib/yast2/clients/view_anymsg.rb - About 1 hr to fix

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

          def main
            textdomain "base"
      
            # the command line description map
            return CommandLine.Run("id" => "view_anymsg") if WFM.Args.first == "help"
      Severity: Minor
      Found in library/system/src/lib/yast2/clients/view_anymsg.rb - About 1 hr to fix

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

            def write_new_filenames
              result = []
        
              to_write = (available_filenames + [selected_filename]).uniq
        
        
        Severity: Minor
        Found in library/system/src/lib/yast2/clients/view_anymsg.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

        Avoid too many return statements within this method.
        Open

              return :empty if !File.size?(file)
        Severity: Major
        Found in library/system/src/lib/yast2/clients/view_anymsg.rb - About 30 mins to fix

          There are no issues that match your filters.

          Category
          Status