RiotGames/berkshelf

View on GitHub

Showing 52 of 54 total issues

Method find_chefignore has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def find_chefignore(path)
      filename = "chefignore"

      Pathname.new(path).ascend do |dir|
        next unless dir.directory?
Severity: Minor
Found in lib/berkshelf/berksfile.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

Avoid too many return statements within this method.
Open

          return false
Severity: Major
Found in lib/berkshelf/lockfile.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

              return false
    Severity: Major
    Found in lib/berkshelf/lockfile.rb - About 30 mins to fix

      Method resolve has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def resolve
            graph.populate_store
            graph.populate(berksfile.sources)
      
            Solve.it!(graph, demand_array, ENV["DEBUG_RESOLVER"] ? { ui: Berkshelf.ui } : {}).collect do |name, version|
      Severity: Minor
      Found in lib/berkshelf/resolver.rb - About 25 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 cached_cookbook has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def cached_cookbook
            return @cached_cookbook if @cached_cookbook
      
            @cached_cookbook =
              if location
      Severity: Minor
      Found in lib/berkshelf/dependency.rb - About 25 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 fix_proxies has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

        def self.fix_proxies
          ENV["http_proxy"] = ENV["HTTP_PROXY"] if ENV["HTTP_PROXY"] && !ENV["http_proxy"]
          ENV["https_proxy"] = ENV["HTTPS_PROXY"] if ENV["HTTPS_PROXY"] && !ENV["https_proxy"]
          ENV["ftp_proxy"] = ENV["FTP_PROXY"] if ENV["FTP_PROXY"] && !ENV["ftp_proxy"]
          ENV["no_proxy"] = ENV["NO_PROXY"] if ENV["NO_PROXY"] && !ENV["no_proxy"]
      Severity: Minor
      Found in lib/berkshelf.rb - About 25 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 populate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def populate(sources)
              universe(sources).each do |cookbook|
                next if has_artifact?(cookbook.name, cookbook.version)
      
                artifact(cookbook.name, cookbook.version)
      Severity: Minor
      Found in lib/berkshelf/resolver/graph.rb - About 25 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 initialize has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def initialize(*args)
            super(*args)
      
            if @options[:config]
              unless File.exist?(@options[:config])
      Severity: Minor
      Found in lib/berkshelf/cli.rb - About 25 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 to_png has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def to_png(outfile = "graph.png")
            tempfile = Tempfile.new("dotdotfile")
            tempfile.write(to_dot)
            tempfile.rewind
      
      
      Severity: Minor
      Found in lib/berkshelf/visualizer.rb - About 25 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 compute_solver_engine has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def compute_solver_engine(berksfile)
            if berksfile.required_solver
              begin
                Solve.engine = berksfile.required_solver
              rescue Solve::Errors::InvalidEngine => e
      Severity: Minor
      Found in lib/berkshelf/resolver.rb - About 25 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 locks has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

            def locks
              @graph.sort.inject({}) do |hash, (name, item)|
                dependency = @lockfile.find(name) ||
                  @berksfile && @berksfile.find(name) ||
                  Dependency.new(@berksfile, name)
      Severity: Minor
      Found in lib/berkshelf/lockfile.rb - About 25 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 validate has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def validate
            raise IOError, "No Cookbook found at: #{path}" unless path.exist?
      
            syntax_checker = Chef::Cookbook::SyntaxCheck.new(path.to_path)
      
      
      Severity: Minor
      Found in lib/berkshelf/cached_cookbook.rb - About 25 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

      Severity
      Category
      Status
      Source
      Language