yast/yast-installation

View on GitHub
src/lib/installation/proposal_store.rb

Summary

Maintainability
D
1 day
Test Coverage

File proposal_store.rb has 378 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "yast"

module Installation
  # 1. Provides access to metadata of proposal parts (clients), as defined in the control file
  #    elements /productDefines/proposals/proposal:
Severity: Minor
Found in src/lib/installation/proposal_store.rb - About 5 hrs to fix

    Class ProposalStore has 33 methods (exceeds 20 allowed). Consider refactoring.
    Open

      class ProposalStore
        include Yast::Logger
        include Yast::I18n
    
        # How many times to maximally (re)run the proposal while some proposal clients
    Severity: Minor
    Found in src/lib/installation/proposal_store.rb - About 4 hrs to fix

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

          def make_proposals(force_reset: false, language_changed: false, callback: proc {})
            clear_proposals
      
            # At first run, all clients will be called
            call_proposals = proposal_names
      Severity: Minor
      Found in src/lib/installation/proposal_store.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 global_help has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def global_help
            case @proposal_mode
            when "initial"
              if Yast::Mode.installation
                # Help text for installation proposal
      Severity: Minor
      Found in src/lib/installation/proposal_store.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 should_be_called_again? has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
      Open

          def should_be_called_again?(client)
            @proposals ||= {}
            return false unless @proposals.fetch(client, {}).key?("trigger")
      
            trigger = @proposals[client]["trigger"]
      Severity: Minor
      Found in src/lib/installation/proposal_store.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 read_only_proposals has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def read_only_proposals
            return @read_only_proposals if @read_only_proposals
      
            @read_only_proposals = { hard: [], soft: [] }
      
      
      Severity: Minor
      Found in src/lib/installation/proposal_store.rb - About 35 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 description_for has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def description_for(client)
            @descriptions ||= {}
            return @descriptions[client] if @descriptions.key?(client)
      
            description = Yast::WFM.CallFunction(client, ["Description", {}])
      Severity: Minor
      Found in src/lib/installation/proposal_store.rb - About 35 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