mguymon/lock_jar

View on GitHub

Showing 56 of 56 total issues

Block has too many lines. [51/25]
Open

      after_define do |project|
        task compile: 'lock_jar:compile'
        task 'test:compile' => 'lock_jar:test:compile'

        task 'eclipse' => 'lock_jar:eclipse'
Severity: Minor
Found in lib/lock_jar/buildr.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

Method load has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def load(lockfile_or_path, groups = ['default'], opts = {}, &blk)
        # lockfile is only loaded once
        unless lockfile_or_path.nil?
          # loaded a Lockfile instance
          if lockfile_or_path.is_a? LockJar::Domain::Lockfile
Severity: Minor
Found in lib/lock_jar/runtime/load.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 lock! has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

      def lock!(*opts)
        # check if Bundler has already run
        return unless ::Bundler.instance_variable_get('@setup').nil?

        dsl = nil
Severity: Minor
Found in lib/lock_jar/bundler.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

Block has too many lines. [46/25]
Open

        namespace 'lock_jar' do
          desc 'Lock dependencies to JarFile'
          task('lock') do
            dsl = project.lockjar_dsl
            if dsl
Severity: Minor
Found in lib/lock_jar/buildr.rb by rubocop

This cop checks if the length of a block exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable. The cop can be configured to ignore blocks passed to certain methods.

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

      def list(lockfile_or_path, groups = ['default'], opts = {}, &blk)
        dependencies = []
        maps = []
        with_locals = { with_locals: true }.merge(opts).delete(:with_locals)

Severity: Minor
Found in lib/lock_jar/runtime/list.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 extract_args has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring.
Open

    def extract_args(type, args, &blk)
      lockfile_or_path = nil
      opts = {}
      groups = ['default']
      args.each do |arg|
Severity: Minor
Found in lib/lock_jar.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 list has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

      def list(lockfile_or_path, groups = ['default'], opts = {}, &blk)
        dependencies = []
        maps = []
        with_locals = { with_locals: true }.merge(opts).delete(:with_locals)

Severity: Minor
Found in lib/lock_jar/runtime/list.rb - About 1 hr to fix

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

      def apply_artifacts!(artifacts)
        # Build the dependencies_graph hash in the resolver
        resolver(opts).resolve(
          artifacts.select(&:resolvable?).map(&:to_dep), opts[:download] == true
        )
Severity: Minor
Found in lib/lock_jar/runtime/lock.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 artifact_groups has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def artifact_groups(restrict = nil)
        artifacts = Hash.new { |hash, key| hash[key] = [] }

        from_dsl.artifacts.each do |group, group_artifacts|
          next if restrict && !restrict.include?(group)
Severity: Minor
Found in lib/lock_jar/domain/dsl_merger.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 lockfile_dependencies has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

    def lockfile_dependencies(lockfile, groups, with_locals = true)
      dependencies = []

      groups.each do |group|
        next unless lockfile.groups[group.to_s]
Severity: Minor
Found in lib/lock_jar/runtime.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 assign_groups has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def assign_groups(artifact, groups = nil)
        if groups
          groups = Array(groups)

          # include present group if within a group block
Severity: Minor
Found in lib/lock_jar/domain/dsl.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 to_hash has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
Open

      def to_hash
        lock_data = { 'version' => @version }

        lock_data['local_repository'] = local_repository unless local_repository.nil?

Severity: Minor
Found in lib/lock_jar/domain/lockfile.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 fs_or_classpath has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
Open

      def self.fs_or_classpath(path)
        if File.exist? path
          YAML.load_file(path)

        # Lookup of Jarfile.lock in the classpath
Severity: Minor
Found in lib/lock_jar/domain/lockfile.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 deploy_artifact has 5 arguments (exceeds 4 allowed). Consider refactoring.
Open

      def deploy_artifact(notation, file_path, url, deploy_opts = {}, lockjar_opts = {})
Severity: Minor
Found in lib/lock_jar/maven.rb - About 35 mins to fix

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

      def create_dsl!(jarfile_or_dsl, &blk)
        if jarfile_or_dsl
          @jarfile = if jarfile_or_dsl.is_a? LockJar::Domain::Dsl
                       jarfile_or_dsl
                     else
Severity: Minor
Found in lib/lock_jar/runtime/lock.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 resolver has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def resolver(opts = {})
      # XXX: Caches the resolver by the options. Passing in nil opts will replay
      #      from the cache. This need to change.
      if !opts.nil?
        opts[:local_repo] = File.expand_path(opts[:local_repo]) if opts[:local_repo]
Severity: Minor
Found in lib/lock_jar/runtime.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 write_pom has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def write_pom(notation, file_path, opts = {})
        opts = { include_resolved: true }.merge(opts)

        maven = Naether::Maven.create_from_notataion(notation)

Severity: Minor
Found in lib/lock_jar/maven.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 add_artifact! has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def add_artifact!(group, artifact_data, artifact)
        if artifact.is_a? LockJar::Domain::Jar
          group['dependencies'] << artifact.notation
          g = resolver(opts).dependencies_graph[artifact.notation]
          artifact_data['transitive'] = g.to_hash if g
Severity: Minor
Found in lib/lock_jar/runtime/lock.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

Use %i or %I for an array of symbols.
Open

task default: [:spec, :rubocop]
Severity: Minor
Found in Rakefile by rubocop

This cop can check for array literals made up of symbols that are not using the %i() syntax.

Alternatively, it checks for symbol arrays using the %i() syntax on projects which do not want to use that syntax.

Configuration option: MinSize If set, arrays with fewer elements than this value will not trigger the cop. For example, a MinSize of3` will not enforce a style on an array of 2 or fewer elements.

Example: EnforcedStyle: percent (default)

# good
%i[foo bar baz]

# bad
[:foo, :bar, :baz]

Example: EnforcedStyle: brackets

# good
[:foo, :bar, :baz]

# bad
%i[foo bar baz]

Favor modifier unless usage when having a single-line body. Another good alternative is the usage of control flow &&/||.
Open

      unless with_locals
Severity: Minor
Found in lib/lock_jar/runtime.rb by rubocop

Checks for if and unless statements that would fit on one line if written as a modifier if/unless. The maximum line length is configured in the Metrics/LineLength cop.

Example:

# bad
if condition
  do_stuff(bar)
end

unless qux.empty?
  Foo.do_something
end

# good
do_stuff(bar) if condition
Foo.do_something unless qux.empty?
Severity
Category
Status
Source
Language