ManageIQ/polisher

View on GitHub

Showing 33 of 37 total issues

Method conf_attr has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring.
Open

    def conf_attr(name, opts = {})
      @conf_attrs ||= []
      @conf_attrs  << name
      default    = opts[:default]
      accumulate = opts[:accumulate]
Severity: Minor
Found in lib/polisher/util/conf_helpers.rb - About 2 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 conf_source has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def conf_source
      if conf[:gemname]
        name = conf[:gemname]
        if conf[:gemversion]
          version = conf[:gemversion]
Severity: Minor
Found in lib/polisher/cli/sources.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 patched has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

    def patched
      vendored.collect do |dep|
        # TODO: right now just handling git based alternate sources,
        # should be able to handle other types bundler supports
        # (path and alternate rubygems src)
Severity: Minor
Found in lib/polisher/gemfile/deps.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 pretty_tgt has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
Open

    def pretty_tgt(dep, tgt, versions)
      pretty = ''

      @last_dep ||= nil
      if @last_dep != dep
Severity: Minor
Found in lib/polisher/cli/format.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 targets_options has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def targets_options(option_parser)
      option_parser.on('-p', '--prefix prefix', 'Prefix to append to gem name') do |p|
        conf[:prefix] = p
      end

Severity: Minor
Found in lib/polisher/cli/targets.rb - About 1 hr to fix

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

        def conf_attr(name, opts = {})
          @conf_attrs ||= []
          @conf_attrs  << name
          default    = opts[:default]
          accumulate = opts[:accumulate]
    Severity: Minor
    Found in lib/polisher/util/conf_helpers.rb - About 1 hr to fix

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

          def check_missing_dep(dep)
            dep_already_processed = missing_dep?(dep)      # determine if this requirement was already recorded
            gem_already_processed = missing_dep?(dep.name) # determine if previous requirement was not satified & recorded in deps
      
            # even if current dep is not missing downstream we need to record all deps for gems with at least one missing dep
      Severity: Minor
      Found in lib/polisher/cli/cross_ref.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 from has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

            def self.from(diff)
              return diff.collect { |d| from(d) } if diff.is_a?(Array)
      
              result = {}
      
      
      Severity: Minor
      Found in lib/polisher/rpm/patch.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 pretty_dep has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
      Open

          def pretty_dep(gem, dep, resolved_dep)
            pretty = ''
      
            # XXX little bit hacky but works for now
            @last_gem ||= nil
      Severity: Minor
      Found in lib/polisher/cli/format.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 conf_source has 27 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def conf_source
            if conf[:gemname]
              name = conf[:gemname]
              if conf[:gemversion]
                version = conf[:gemversion]
      Severity: Minor
      Found in lib/polisher/cli/sources.rb - About 1 hr to fix

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

            def self.profiles(profiles=nil)
              @profiles ||= []
        
              [profiles].flatten.compact.each { |profile|
                next unless conf_profiles[profile] && !@profiles.include?(profile)
        Severity: Minor
        Found in lib/polisher/util/profile.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

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

            def diff(other)
              require_dep! 'awesome_spawn'
              require_cmd! diff_cmd
              out = nil
        
        
        Severity: Minor
        Found in lib/polisher/gem/diff.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

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

              def clone
                require_dep! 'awesome_spawn'
                require_cmd! pkg_cmd
        
                clobber!
        Severity: Minor
        Found in lib/polisher/git/pkg/repo.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

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

            def dependency_versions(args = {}, &bl)
              versions   = args[:versions] || {}
              check_deps = args[:dev] ? dev_deps : deps
        
              check_deps.each do |dep|
        Severity: Minor
        Found in lib/polisher/gem/versions.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

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

          def rpmize
            require 'polisher/gem'
            require 'polisher/rpm/spec'
            matchers = Polisher::RPM::Spec::FILE_MACRO_MATCHERS
            replacements = Polisher::RPM::Spec::FILE_MACRO_REPLACEMENTS.invert
        Severity: Minor
        Found in lib/polisher/util/core_ext.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 each_file has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
        Open

            def each_file(&bl)
              unpack do |dir|
                Pathname.new(dir).find do |path|
                  next if path.to_s == dir.to_s
                  pathstr = path.to_s.gsub("#{dir}/", '')
        Severity: Minor
        Found in lib/polisher/gem/files.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 initialize has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def initialize(args = {})
                @br        = args[:br] || false
                @name      = args[:name]
                @condition = args[:condition]
                @version   = args[:version]
        Severity: Minor
        Found in lib/polisher/rpm/requirement.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 build_srpm has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def build_srpm
                require 'awesome_spawn'
        
                require_cmd! pkg_cmd
                in_repo do
        Severity: Minor
        Found in lib/polisher/git/pkg/builder.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 check_missing has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

        def check_missing
          missing_deps.each { |name, deps|
            latest   = latest_alt(name)
            print "#{name}(#{latest}) #{deps.collect { |dep| dep.requirement.to_s }}: ".blue.bold
        
        
        Severity: Minor
        Found in lib/polisher/cli/bin/gems2update.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 distgit_state has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

            def distgit_state(args = {})
              check_dep = args.key?(:check)
        
              begin
                distgit.clone
        Severity: Minor
        Found in lib/polisher/gem/state.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

        Severity
        Category
        Status
        Source
        Language