torquebox/maven-tools

View on GitHub
lib/maven/tools/coordinate.rb

Summary

Maintainability
B
6 hrs
Test Coverage

Method convert has a Cognitive Complexity of 15 (exceeds 5 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

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

      There are no issues that match your filters.

      Category
      Status