torquebox/maven-tools

View on GitHub

Showing 60 of 68 total issues

Method accept_raw_hash has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def accept_raw_hash( name, hash )
        unless hash.empty?
          attr = hash.select do |k, v|
            [ k, v ] if k.to_s.match( /^@/ )
          end
Severity: Minor
Found in lib/maven/tools/visitor.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 initialize has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def initialize(file)
        super()
        current = nil
        bundler = false
        f = file.is_a?(File) ? file.path: file
Severity: Minor
Found in lib/maven/tools/gemfile_lock.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 recurse has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def recurse(result, dep)
        if d = self[dep]
          result[dep] = d.version if  !result.key?(dep)
          d.dependencies.each do |name, version|
            unless result.key? name
Severity: Minor
Found in lib/maven/tools/gemfile_lock.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 execute has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

      def execute( id = nil, phase = nil, options = {}, &block )
        if block
          raise 'can not be inside a plugin' if @current == :plugin
          if phase.is_a? Hash
            options = phase
Severity: Minor
Found in lib/maven/tools/dsl.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 do_gem has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def do_gem( bang, *args )
        # in some setup that gem could overload the Kernel gem
        return if @current.nil?
        unless args[ 0 ].match( /:/ )
          args[ 0 ] = "rubygems:#{args[ 0 ] }"
Severity: Minor
Found in lib/maven/tools/dsl.rb - About 1 hr to fix

    Method process has 36 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            def process( spec, name, options )
              @parent.build.directory = '${basedir}/pkg'
              version = spec.version.to_s
              if spec.version.prerelease? && options[ :snapshot ] != false && ! version.end_with?( '-SNAPSHOT' )
                version += '-SNAPSHOT'
    Severity: Minor
    Found in lib/maven/tools/dsl/project_gemspec.rb - About 1 hr to fix

      Method do_repository has 36 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def do_repository( method, *args, &block )
              args, options = args_and_options( *args )
              if @current.respond_to?( method )
                r = DeploymentRepository.new
              else
      Severity: Minor
      Found in lib/maven/tools/dsl.rb - About 1 hr to fix

        Consider simplifying this complex logical expression.
        Open

                  elsif options.key?( :path )
                    @has_path = true
                  else
                    platform = options.delete( :platform ) || options.delete( 'platform' ) || options.delete( :platforms ) || options.delete( 'platforms' )
                    group = options.delete( :groups ) || options.delete( 'groups' ) ||  options.delete( :group ) || options.delete( 'group' ) || @group
        Severity: Critical
        Found in lib/maven/tools/dsl.rb - About 1 hr to fix

          Method update_unlocked has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  def update_unlocked( deps )
                    success = true
                    deps.each do |k,v|
                      bucket = ( data[ k ] ||= [] )
                      v.each do |e|
          Severity: Minor
          Found in lib/maven/tools/dsl/jarfile_lock.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 process has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  def process( spec, name, options )
                    @parent.build.directory = '${basedir}/pkg'
                    version = spec.version.to_s
                    if spec.version.prerelease? && options[ :snapshot ] != false && ! version.end_with?( '-SNAPSHOT' )
                      version += '-SNAPSHOT'
          Severity: Minor
          Found in lib/maven/tools/dsl/project_gemspec.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 initialize has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
          Open

                  def initialize( parent, file = 'Jarfile', skip_lock = false )
                    warn "DEPRECATED to have nil as parent" unless parent
                    lockfile = JarfileLock.new( skip_lock ? nil : file )
          
                    # the dependencies are only add if they are not locked
          Severity: Minor
          Found in lib/maven/tools/dsl/jarfile.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 to_split_coordinate has 31 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def to_split_coordinate( line )
                  if line =~ /^\s*(jar|pom)\s/
                    packaging = line.strip.sub(/\s+.*/, '')
          
                    # Remove packaging, comments and whitespaces
          Severity: Minor
          Found in lib/maven/tools/coordinate.rb - About 1 hr to fix

            Method convert has 29 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                  def convert(arg, low = nil, high = nil)
                    if arg =~ /~>/
                      val = arg.sub(/~>\s*/, '')
                      last = val=~/\./ ? val.sub(/\.[0-9]*[a-z]+.*$/, '').sub(/\.[^.]+$/, '.99999') : '99999'
                      ["[#{snapshot_version(val)}", "#{snapshot_version(last)}]"]
            Severity: Minor
            Found in lib/maven/tools/coordinate.rb - About 1 hr to fix

              Method initialize has 29 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                    def initialize( group_id, artifact_id, type,  
                                    version = nil, classifier = nil, exclusions = nil,
                                    options = {} )
                      if exclusions.nil?
                        if version.nil? and !classifier.nil?
              Severity: Minor
              Found in lib/maven/tools/artifact.rb - About 1 hr to fix

                Method populate_unlocked has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                      def populate_unlocked( container = nil, &block )
                        warn 'DEPRECATED use Maven::Tools::DSL::Jarfile instead'
                        if ::File.exists?(@file)
                          dsl = Maven::Tools::DSL::Jarfile.new( nil, @file )
                
                
                Severity: Minor
                Found in lib/maven/tools/jarfile.rb - About 1 hr to fix

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

                        def plugins(&block)
                          if block
                            block.call
                          else
                            if @current.respond_to? :build
                  Severity: Minor
                  Found in lib/maven/tools/dsl.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 fill_gav has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def fill_gav(receiver, *gav)
                          if receiver.is_a? Class
                            receiver = receiver.new
                          end
                          if gav.size > 0
                  Severity: Minor
                  Found in lib/maven/tools/dsl.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 repository_policy has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def repository_policy( rp, config, &block )
                          rp ||= RepositoryPolicy.new
                          case config
                          when Hash
                            rp.enabled = config[ :enabled ] unless config[ :enabled ].nil?
                  Severity: Minor
                  Found in lib/maven/tools/dsl.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 to_split_coordinate has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def to_split_coordinate( line )
                          if line =~ /^\s*(jar|pom)\s/
                            packaging = line.strip.sub(/\s+.*/, '')
                  
                            # Remove packaging, comments and whitespaces
                  Severity: Minor
                  Found in lib/maven/tools/coordinate.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 maven_version has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                        def maven_version(*args)
                          if args.size == 0 || (args.size == 1 && args[0].nil?)
                            nil
                          else
                            low, high = convert(args[0])
                  Severity: Minor
                  Found in lib/maven/tools/coordinate.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

                  Severity
                  Category
                  Status
                  Source
                  Language