torquebox/maven-tools

View on GitHub

Showing 60 of 68 total issues

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

      def generate_lockfile(dependency_coordinates)
        if dependency_coordinates.empty?
          FileUtils.rm_f(@lockfile) if exists_lock?
        else
          ::File.open(@lockfile, 'w') do |f|
Severity: Minor
Found in lib/maven/tools/jarfile.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 eval_file has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def eval_file( file )
        if file && ::File.directory?( file )
          dir = file
          file = nil
        else
Severity: Minor
Found in lib/maven/tools/pom.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 initialize has 7 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def initialize( group_id, artifact_id, type,  
                      version = nil, classifier = nil, exclusions = nil,
                      options = {} )
Severity: Major
Found in lib/maven/tools/artifact.rb - About 50 mins to fix

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

          def prepare_config( receiver, options )
            return unless options
            inh = options.delete( 'inherited' )
            inh = options.delete( :inherited ) if inh.nil?
            receiver.inherited = inh unless inh.nil?
    Severity: Minor
    Found in lib/maven/tools/dsl.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 from has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
    Open

          def self.from( type, *args )
            if args.last.is_a? Hash
              options = args.last.dup
              args = args[0..-2]
            end
    Severity: Minor
    Found in lib/maven/tools/artifact.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

    Avoid deeply nested control flow statements.
    Open

                    if @current.respond_to? method
                      @current.send( method, *args )
                    end
    Severity: Major
    Found in lib/maven/tools/dsl.rb - About 45 mins to fix

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

            def retrieve_dependency( type, *args )
              if args.empty?
                a = type
                type = a[ :type ]
                options = a
      Severity: Minor
      Found in lib/maven/tools/dsl.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 create has 5 arguments (exceeds 4 allowed). Consider refactoring.
      Open

                def create( parent, type, scope, *args, &block )
      Severity: Minor
      Found in lib/maven/tools/dsl/dependency_dsl.rb - About 35 mins to fix

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

              def test_resource( options = {}, &block )
                # strange behaviour when calling specs from Rakefile
                return if @current.nil?
                resource = Resource.new
                fill_options( resource, options )
        Severity: Minor
        Found in lib/maven/tools/dsl.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 other_deps has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

                def other_deps( spec )
                  spec.requirements.each do |req|
                    req = req.sub( /#.*^/, '' )
                    method = req.sub(/\s.*$/, '' ).to_sym
                    line = req.sub(/^[^\s]*\s/, '' )
        Severity: Minor
        Found in lib/maven/tools/dsl/gemspec.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 setup_jruby has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def setup_jruby( jruby, jruby_scope = :provided )
                warn "deprecated: use jruby DSL directly"
                jruby ||= VERSIONS[ :jruby_version ]
        
                # if jruby.match( /-SNAPSHOT/ ) != nil
        Severity: Minor
        Found in lib/maven/tools/dsl.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 source has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def source(*args, &block)
                url = args[0].to_s
                url = 'https://rubygems.org' if url == :rubygems
                id = url.gsub( /[\/:"<>|?*]/, '_').gsub(/_+/, '_') unless url == 'https://rubygems.org'
        
        
        Severity: Minor
        Found in lib/maven/tools/dsl.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 add_scoped_hull has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def add_scoped_hull( locked, deps, done = [], scope = nil )
                result = {}
                scope ||= "compile runtime default"
                scope = scope.to_s
                names = deps.select do |d|
        Severity: Minor
        Found in lib/maven/tools/dsl.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 to_model has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
        Open

              def to_model( file )
                if ::File.exists?( file )
                  case file
                  when /pom.rb/
                    eval_pom( "tesla do\n#{ ::File.read( file ) }\nend", file )
        Severity: Minor
        Found in lib/maven/tools/pom.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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def method_missing( m, arg = nil )
                if ATTRS.member? m
                  # setter
                  self[ m.to_s[ 0..-2].to_sym ] = arg
                elsif ATTRS.member?( "#{m}=".to_sym )
        Severity: Minor
        Found in lib/maven/tools/artifact.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 visit has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def visit( model )
                model.attributes.each do |k, v|
                  if k == :properties
                    accept_raw_hash( k, v )
                  else
        Severity: Minor
        Found in lib/maven/tools/visitor.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 find_gemspec_file has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def find_gemspec_file( name )
                  if name
                    ::File.join( @parent.basedir, name )
                  else
                    gemspecs = Dir[ ::File.join( @parent.basedir, "*.gemspec" ) ]
        Severity: Minor
        Found in lib/maven/tools/dsl/gemspec.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 apply has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def apply
                  if version.nil?
                    # nothing to do
                  elsif( version < '1.6' )
                    raise 'jruby before 1.6 are not supported'
        Severity: Minor
        Found in lib/maven/tools/dsl/jruby_dsl.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 method_missing has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def method_missing( m, *args )
                  if @model.respond_to? m
                    meth = @model.method m
                    if meth.arity == 0 && args.size == 1
                      @model.send( "#{m}=".to_sym, *args )
        Severity: Minor
        Found in lib/maven/tools/dsl/models.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 resource has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def resource( options = {}, &block )
                resource = Resource.new
                fill_options( resource, options )
                nested_block( :resource, resource, block ) if block
                unless resource.directory
        Severity: Minor
        Found in lib/maven/tools/dsl.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