yast/yast-yast2

View on GitHub

Showing 806 of 967 total issues

Avoid deeply nested control flow statements.
Open

          ret = nil unless functions[:abort].call
Severity: Major
Found in library/cwm/src/modules/CWM.rb - About 45 mins to fix

    Method PrepareScripts has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def PrepareScripts(workflow)
          workflow = deep_copy(workflow)
          tmp_dir = Convert.to_string(WFM.Read(path(".local.tmpdir"), []))
          if Builtins.haskey(workflow, "prescript")
            interpreter = Ops.get_string(workflow, ["prescript", "interpreter"], "shell")
    Severity: Minor
    Found in library/control/src/modules/ProductControl.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 ValidateValueType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

        def ValidateValueType(key, value, widget, popup)
          value = deep_copy(value)
          success = true
          if popup
            case key
    Severity: Minor
    Found in library/cwm/src/modules/TablePopup.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

    Avoid deeply nested control flow statements.
    Open

                    tableEntryChanged(opt_id, option_map) ? "*" : ""
    Severity: Major
    Found in library/cwm/src/modules/TablePopup.rb - About 45 mins to fix

      Method MergeProposal has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def MergeProposal(base, additional_control, prod_name, domain)
            base = deep_copy(base)
            additional_control = deep_copy(additional_control)
            # Additional proposal settings - Replacing items
            replaces = Builtins.listmap(
      Severity: Minor
      Found in library/control/src/modules/WorkflowManager.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 MergeWorkflows has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def MergeWorkflows
            Builtins.y2milestone("Merging additional control files from scratch...")
            @unmerged_changes = false
      
            # Init the Base Workflow settings
      Severity: Minor
      Found in library/control/src/modules/WorkflowManager.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 LazyLoadCurrentConf has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def LazyLoadCurrentConf
            if !@already_read
              if FileUtils.Exists(@conf_file) && FileUtils.IsFile(@conf_file)
                Builtins.y2milestone("Reading %1 file", @conf_file)
                # Read and evaluate the current configuration
      Severity: Minor
      Found in library/general/src/modules/DontShowAgain.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 anyTimedMessageTypeInternal has 6 arguments (exceeds 4 allowed). Consider refactoring.
      Open

          def anyTimedMessageTypeInternal(headline, message, timeout, richtext, width, height)
      Severity: Minor
      Found in library/general/src/modules/Popup.rb - About 45 mins to fix

        Method handle_event has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

              def handle_event(res, details, remaining_time, focus)
                case res
                when :__details
                  show(details)
                  nil
        Severity: Minor
        Found in library/general/src/lib/yast2/popup.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 TimedAnyQuestion has 6 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def TimedAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
        Severity: Minor
        Found in library/general/src/modules/Popup.rb - About 45 mins to fix

          Method plain_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                  def plain_text(tags: nil, replacements: nil, &block)
                    regex = tags ? Regexp.union(tags.map { |t| /<[^>]*#{t}[^>]*>/i }) : /<.+?>/
                    replacements ||= Refinements::DEFAULT_HTML_TAGS_REPLACEMENTS
          
                    result = gsub(regex) do |match|
          Severity: Minor
          Found in library/general/src/lib/yast2/refinements/string_manipulations.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 EditTable has 6 arguments (exceeds 4 allowed). Consider refactoring.
          Open

              def EditTable(table_header, table_contents, above_table, below_table, below_buttons, buttons)
          Severity: Minor
          Found in library/general/src/modules/UIHelper.rb - About 45 mins to fix

            Method TimedErrorAnyQuestion has 6 arguments (exceeds 4 allowed). Consider refactoring.
            Open

                def TimedErrorAnyQuestion(headline, message, yes_button_message, no_button_message, focus, timeout_seconds)
            Severity: Minor
            Found in library/general/src/modules/Popup.rb - About 45 mins to fix

              Method wrap_text has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                      def wrap_text(line_width = 76, n_lines: nil, cut_text: "")
                        return self if line_width > length
              
                        wrapped_text = lines.collect! do |line|
                          l = (line.length > line_width) ? line.gsub(/(.{1,#{line_width}})(?:\s+|$)/, "\\1\n") : line
              Severity: Minor
              Found in library/general/src/lib/yast2/refinements/string_manipulations.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 anyMessageDetailsInternalType has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
              Open

                  def anyMessageDetailsInternalType(headline, message, details, richtext, width, height)
                    button_box = ButtonBox(
                      PushButton(Id(:ok_msg), Opt(:default, :okButton), Label.OKButton),
                      # FIXME: BNC #422612, Use `opt(`noSanityCheck) later
                      # button label
              Severity: Minor
              Found in library/general/src/modules/Popup.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 anyMessageDetailsInternalType has 6 arguments (exceeds 4 allowed). Consider refactoring.
              Open

                  def anyMessageDetailsInternalType(headline, message, details, richtext, width, height)
              Severity: Minor
              Found in library/general/src/modules/Popup.rb - About 45 mins to fix

                Method AssertLineValid has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
                Open

                    def AssertLineValid(file, line)
                      if Builtins.haskey(Ops.get_map(file.value, "l", {}), line) &&
                          Ops.get_boolean(file.value, ["l", line, "buildline"], false)
                        delim = Builtins.substring(
                          Ops.get_string(file.value, "delim", " "),
                Severity: Minor
                Found in library/general/src/modules/AsciiFile.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

                Avoid deeply nested control flow statements.
                Open

                              minimum_step = Ops.add(minimum_step, 1) if Ops.less_or_equal(@current_step, minimum_step) && !allow_back
                Severity: Major
                Found in library/control/src/modules/ProductControl.rb - About 45 mins to fix

                  Method AnyQuestion3 has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                      def AnyQuestion3(headline, message, yes_button_message, no_button_message, retry_button_message, focus)
                  Severity: Minor
                  Found in library/general/src/modules/Popup.rb - About 45 mins to fix

                    Avoid deeply nested control flow statements.
                    Open

                                  str = CutBlanks(str) if remove_whitespace
                    Severity: Major
                    Found in library/types/src/modules/String.rb - About 45 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language