ManageIQ/polisher

View on GitHub

Showing 37 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

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module BodhiVersionChecker
            def self.default?
              @default ||= false
            end
        
        
        Severity: Minor
        Found in lib/polisher/adaptors/version_checker/bodhi.rb and 1 other location - About 1 hr to fix
        lib/polisher/adaptors/version_checker/errata.rb on lines 7..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module KojiVersionChecker
            def self.default?
              @default ||= true
            end
        
        
        Severity: Minor
        Found in lib/polisher/adaptors/version_checker/koji.rb and 1 other location - About 1 hr to fix
        lib/polisher/adaptors/version_checker/fedora.rb on lines 7..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module ErrataVersionChecker
            def self.default?
              @default ||= false
            end
        
        
        Severity: Minor
        Found in lib/polisher/adaptors/version_checker/errata.rb and 1 other location - About 1 hr to fix
        lib/polisher/adaptors/version_checker/bodhi.rb on lines 7..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Similar blocks of code found in 2 locations. Consider refactoring.
        Open

          module FedoraVersionChecker
            def self.default?
              @default ||= true
            end
        
        
        Severity: Minor
        Found in lib/polisher/adaptors/version_checker/fedora.rb and 1 other location - About 1 hr to fix
        lib/polisher/adaptors/version_checker/koji.rb on lines 7..25

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 47.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        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

        Severity
        Category
        Status
        Source
        Language