mkristian/jar-dependencies

View on GitHub

Showing 27 of 40 total issues

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 process has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
    Open

        def process(scope)
          scope ||= :runtime
          File.read(@file).each_line do |line|
            next unless /:.+:/.match?(line)
    
    
    Severity: Minor
    Found in lib/jars/lock.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 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 user_settings has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def user_settings
            @_jars_maven_user_settings_ = nil unless instance_variable_defined?(:@_jars_maven_user_settings_)
            if @_jars_maven_user_settings_.nil?
              if (settings = Jars.absolute(Jars.to_prop(MAVEN_SETTINGS)))
                unless File.exist?(settings)
    Severity: Minor
    Found in lib/jars/maven_settings.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 attach_jars has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring.
    Open

          def attach_jars(spec, all_dependencies: false)
            @index ||= 0
            @done ||= []
    
            deps = GemspecArtifacts.new(spec)
    Severity: Minor
    Found in lib/jars/maven_factory.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 new has 44 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

          def self.new(line)
            line = line.strip
            index = line.index(/\s/)
            return nil if index.nil?
    
    
    Severity: Minor
    Found in lib/jars/gemspec_artifacts.rb - About 1 hr to fix

      Method convert has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring.
      Open

            def convert(arg, low = nil, high = nil)
              if arg.include?('~>')
                val = arg.sub(/~>\s*/, '')
                last = val.include?('.') ? val.sub(/\.[0-9]*[a-z]+.*$/, '').sub(/\.[^.]+$/, '.99999') : '99999'
                ["[#{snapshot_version(val)}", "#{snapshot_version(last)}]"]
      Severity: Minor
      Found in lib/jars/gemspec_artifacts.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 global_settings has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring.
      Open

            def global_settings
              @_jars_maven_global_settings_ = nil unless instance_variable_defined?(:@_jars_maven_global_settings_)
              if @_jars_maven_global_settings_.nil?
                if (mvn_home = ENV['M2_HOME'] || ENV['MAVEN_HOME'])
                  settings = File.join(mvn_home, 'conf/settings.xml')
      Severity: Minor
      Found in lib/jars/maven_settings.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 lock_down has 30 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def lock_down(vendor_dir = nil, force: false, update: false, tree: nil)
            out = File.expand_path('.jars.output')
            tree_provided = tree
            tree ||= File.expand_path('.jars.tree')
            maven.property('jars.outputFile', out)
      Severity: Minor
      Found in lib/jars/lock_down.rb - About 1 hr to fix

        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 new has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def new(*args)
                  if args.empty? || (args.size == 1 && args[0].nil?)
                    nil
                  else
                    low, high = convert(args[0])
          Severity: Minor
          Found in lib/jars/gemspec_artifacts.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? 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 effective_settings has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring.
          Open

                def effective_settings
                  @_jars_effective_maven_settings_ = nil unless instance_variable_defined?(:@_jars_effective_maven_settings_)
                  if @_jars_effective_maven_settings_.nil?
                    begin
                      require 'rubygems/request'
          Severity: Minor
          Found in lib/jars/maven_settings.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 convert has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

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

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

                def self.print_require_jar(file, dep, fallback: false)
                  return if dep.type != :jar || dep.scope != :runtime
            
                  if dep.system?
                    file&.puts("require '#{dep.file}'")
            Severity: Minor
            Found in lib/jars/installer.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(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 find_spec has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def find_spec(allow_no_file)
                  specs = Dir['*.gemspec']
                  case specs.size
                  when 0
                    raise 'no gemspec found' unless allow_no_file
            Severity: Minor
            Found in lib/jars/maven_exec.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 lock_down has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
            Open

                def lock_down(vendor_dir = nil, force: false, update: false, tree: nil)
                  out = File.expand_path('.jars.output')
                  tree_provided = tree
                  tree ||= File.expand_path('.jars.tree')
                  maven.property('jars.outputFile', out)
            Severity: Minor
            Found in lib/jars/lock_down.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