torquebox/maven-tools

View on GitHub

Showing 68 of 68 total issues

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

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

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

          def site( *args, &block )
            site = Site.new
            args, options = args_and_options( *args )
            site.id = args[ 0 ]
            site.url = args[ 1 ]
    Severity: Minor
    Found in lib/maven/tools/dsl.rb and 1 other location - About 45 mins to fix
    lib/maven/tools/dsl.rb on lines 494..502

    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 40.

    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

          def source_control( *args, &block )
            scm = Scm.new
            args, options = args_and_options( *args )
            scm.connection = args[ 0 ]
            scm.developer_connection = args[ 1 ]
    Severity: Minor
    Found in lib/maven/tools/dsl.rb and 1 other location - About 45 mins to fix
    lib/maven/tools/dsl.rb on lines 483..491

    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 40.

    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

    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

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

              def distribution_management( *args, &block )
                di = DistributionManagement.new
                args, options = args_and_options( *args )
                di.status = args[ 0 ]
                di.download_url = args[ 1 ]
        Severity: Minor
        Found in lib/maven/tools/dsl.rb and 1 other location - About 35 mins to fix
        lib/maven/tools/dsl.rb on lines 506..513

        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 35.

        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

              def issue_management( *args, &block )
                issues = IssueManagement.new
                args, options = args_and_options( *args )
                issues.url = args[ 0 ]
                issues.system = args[ 1 ]
        Severity: Minor
        Found in lib/maven/tools/dsl.rb and 1 other location - About 35 mins to fix
        lib/maven/tools/dsl.rb on lines 527..534

        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 35.

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

        Severity
        Category
        Status
        Source
        Language