bio-miga/miga

View on GitHub
test/taxonomy_test.rb

Summary

Maintainability
A
0 mins
Test Coverage
A
100%

Assignment Branch Condition size for test_alternative is too high. [52.15/15]
Open

  def test_alternative
    tx = MiGA::Taxonomy.new('ns:a s:Arnie', nil,
                            ['ns:b s:Bernie', 'ns:c s:Cornie', 's:Darnie'])
    # Fields
    assert_equal('ns:a s:Arnie', tx.to_s)
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Assignment Branch Condition size for test_reset is too high. [31.02/15]
Open

  def test_reset
    tx = MiGA::Taxonomy.new(
      'ns:Letters d:Latin s:A', nil,
      ['ns:Words d:English s:A', 'ns:Music d:Tone s:A']
    )
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [22/10]
Open

  def test_alternative
    tx = MiGA::Taxonomy.new('ns:a s:Arnie', nil,
                            ['ns:b s:Bernie', 'ns:c s:Cornie', 's:Darnie'])
    # Fields
    assert_equal('ns:a s:Arnie', tx.to_s)
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Method has too many lines. [18/10]
Open

  def test_reset
    tx = MiGA::Taxonomy.new(
      'ns:Letters d:Latin s:A', nil,
      ['ns:Words d:English s:A', 'ns:Music d:Tone s:A']
    )
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Assignment Branch Condition size for test_append is too high. [17.03/15]
Open

  def test_append
    tx = MiGA::Taxonomy.new ''
    assert_equal('', "#{tx}")
    tx << ['domain:Public', 'family:GNU']
    assert_equal('GNU', tx[:f])
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

Method has too many lines. [11/10]
Open

  def test_append
    tx = MiGA::Taxonomy.new ''
    assert_equal('', "#{tx}")
    tx << ['domain:Public', 'family:GNU']
    assert_equal('GNU', tx[:f])
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Redundant curly braces around a hash parameter.
Open

    tx = MiGA::Taxonomy.new({ k: 'Mascot', c: 'Cereal', s: 'Melvin' })
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Add parentheses to nested method call MiGA::Taxonomy.normalize_rank 'No Rank'.
Open

    assert_nil(MiGA::Taxonomy.normalize_rank 'No Rank')
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.

Example:

# good
method1(method2(arg), method3(arg))

# bad
method1(method2 arg, method3, arg)

Redundant curly braces around a hash parameter.
Open

    tx_js = JSON.parse(js, { symbolize_names: false, create_additions: true })
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Redundant curly braces around a hash parameter.
Open

    tx = JSON.parse(js, { symbolize_names: false, create_additions: true })
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Redundant curly braces around a hash parameter.
Open

    tx = MiGA::Taxonomy.new({ k: 'Mascot', s: 'Melvin', c: 'Cereal' })
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for braces around the last parameter in a method call if the last parameter is a hash. It supports braces, no_braces and context_dependent styles.

Example: EnforcedStyle: braces

# The `braces` style enforces braces around all method
# parameters that are hashes.

# bad
some_method(x, y, a: 1, b: 2)

# good
some_method(x, y, {a: 1, b: 2})

Example: EnforcedStyle: no_braces (default)

# The `no_braces` style checks that the last parameter doesn't
# have braces around it.

# bad
some_method(x, y, {a: 1, b: 2})

# good
some_method(x, y, a: 1, b: 2)

Example: EnforcedStyle: context_dependent

# The `context_dependent` style checks that the last parameter
# doesn't have braces around it, but requires braces if the
# second to last parameter is also a hash literal.

# bad
some_method(x, y, {a: 1, b: 2})
some_method(x, y, {a: 1, b: 2}, a: 1, b: 2)

# good
some_method(x, y, a: 1, b: 2)
some_method(x, y, {a: 1, b: 2}, {a: 1, b: 2})

Missing magic comment # frozen_string_literal: true.
Open

require 'test_helper'
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop is designed to help upgrade to Ruby 3.0. It will add the comment # frozen_string_literal: true to the top of files to enable frozen string literals. Frozen string literals may be default in Ruby 3.0. The comment will be added below a shebang and encoding comment. The frozen string literal comment is only valid in Ruby 2.3+.

Example: EnforcedStyle: when_needed (default)

# The `when_needed` style will add the frozen string literal comment
# to files only when the `TargetRubyVersion` is set to 2.3+.
# bad
module Foo
  # ...
end

# good
# frozen_string_literal: true

module Foo
  # ...
end

Example: EnforcedStyle: always

# The `always` style will always add the frozen string literal comment
# to a file, regardless of the Ruby version or if `freeze` or `<<` are
# called on a string literal.
# bad
module Bar
  # ...
end

# good
# frozen_string_literal: true

module Bar
  # ...
end

Example: EnforcedStyle: never

# The `never` will enforce that the frozen string literal comment does
# not exist in a file.
# bad
# frozen_string_literal: true

module Baz
  # ...
end

# good
module Baz
  # ...
end

Add parentheses to nested method call MiGA::Taxonomy.normalize_rank 'Captain'.
Open

    assert_nil(MiGA::Taxonomy.normalize_rank 'Captain')
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for unparenthesized method calls in the argument list of a parenthesized method call.

Example:

# good
method1(method2(arg), method3(arg))

# bad
method1(method2 arg, method3, arg)

Prefer to_s over string interpolation.
Open

    assert_equal('', "#{tx}")
Severity: Minor
Found in test/taxonomy_test.rb by rubocop

This cop checks for strings that are just an interpolated expression.

Example:

# bad
"#{@var}"

# good
@var.to_s

# good if @var is already a String
@var

There are no issues that match your filters.

Category
Status