mkristian/jar-dependencies

View on GitHub
lib/jar_dependencies.rb

Summary

Maintainability
C
1 day
Test Coverage

File jar_dependencies.rb has 286 lines of code (exceeds 250 allowed). Consider refactoring.
Open

module Jars
  unless defined? Jars::SKIP_LOCK
    MAVEN_SETTINGS = 'JARS_MAVEN_SETTINGS'
    LOCAL_MAVEN_REPO = 'JARS_LOCAL_MAVEN_REPO'
    # lock file to use
Severity: Minor
Found in lib/jar_dependencies.rb - About 2 hrs to fix

    Method require_jars_lock! has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
    Open

        def require_jars_lock!(scope = :runtime)
          urls = jars_lock_from_class_loader
          if urls && !urls.empty?
            @jars_lock = true
            # funny error during spec where it tries to load it again
    Severity: Minor
    Found in lib/jar_dependencies.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 require_jars_lock! has 28 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def require_jars_lock!(scope = :runtime)
          urls = jars_lock_from_class_loader
          if urls && !urls.empty?
            @jars_lock = true
            # funny error during spec where it tries to load it again
    Severity: Minor
    Found in lib/jar_dependencies.rb - About 1 hr to fix

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

          def require?
            @require = nil unless instance_variable_defined?(:@require)
            if @require.nil?
              if (require = to_boolean(REQUIRE)).nil?
                no_require = to_boolean(NO_REQUIRE)
      Severity: Minor
      Found in lib/jar_dependencies.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 require_jar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def require_jar(group_id, artifact_id, *classifier_version)
            require_jars_lock unless skip_lock?
            if classifier_version.empty? && block_given?
              classifier_version = [yield].compact
              return mark_as_required(group_id, artifact_id, UNKNOWN) || false if classifier_version.empty?
      Severity: Minor
      Found in lib/jar_dependencies.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 require_jar has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

      def require_jar(*args, &block)
        return nil unless Jars.require?
      
        result = Jars.require_jar(*args, &block)
        if result.is_a? String
      Severity: Minor
      Found in lib/jar_dependencies.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 detect_local_repository has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
      Open

          def detect_local_repository(settings)
            return nil unless settings
      
            doc = File.read(settings)
            # TODO: filter out xml comments
      Severity: Minor
      Found in lib/jar_dependencies.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 require_jar_with_block has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def require_jar_with_block(group_id, artifact_id, *classifier_version)
            version = classifier_version[-1]
            classifier = classifier_version[-2]
      
            coordinate = +"#{group_id}:#{artifact_id}"
      Severity: Minor
      Found in lib/jar_dependencies.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 do_require has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
      Open

          def do_require(*args)
            jar = to_jar(*args)
            local = File.join(Dir.pwd, 'jars', jar)
            vendor = File.join(Dir.pwd, 'vendor', 'jars', jar)
            file = File.join(home, jar)
      Severity: Minor
      Found in lib/jar_dependencies.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

      There are no issues that match your filters.

      Category
      Status