Dalphi/dalphi

View on GitHub
spec/requests/projects/check_problem_identifiers_spec.rb

Summary

Maintainability
A
0 mins
Test Coverage

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

RSpec.describe "Problem identifier check", type: :request do
  before(:each) do
    @project = FactoryGirl.create(:project)
    sign_in(@project.admin)
  end

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.

Line is too long. [82/80]
Open

    @project.merge_service = FactoryGirl.create(:merge_service, problem_id: 'NER')

Redundant curly braces around a hash parameter.
Open

      { 'associatedProblemIdentifiers' => [] }

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

Line is too long. [91/80]
Open

    @project.iterate_service = FactoryGirl.create(:iterate_service, problem_id: 'HyperNER')

Redundant curly braces around a hash parameter.
Open

      { 'associatedProblemIdentifiers' => ['HyperNER', 'MegaNER', 'NER'].sort }

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

Use %w or %W for an array of words.
Open

      { 'associatedProblemIdentifiers' => ['HyperNER', 'MegaNER', 'NER'].sort }

This cop can check for array literals made up of word-like strings, that are not using the %w() syntax.

Alternatively, it can check for uses of the %w() syntax, in projects which do not want to include that syntax.

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

Example: EnforcedStyle: percent (default)

# good
%w[foo bar baz]

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

Example: EnforcedStyle: brackets

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

# bad
%w[foo bar baz]

Line is too long. [83/80]
Open

  it 'shows an empty set of associated problem identifiers if no service is set' do

Line is too long. [82/80]
Open

    @project.merge_service = FactoryGirl.create(:merge_service, problem_id: 'NER')

Prefer single-quoted strings when you don't need string interpolation or special symbols.
Open

RSpec.describe "Problem identifier check", type: :request do

Checks if uses of quotes match the configured preference.

Example: EnforcedStyle: single_quotes (default)

# bad
"No special symbols"
"No string interpolation"
"Just text"

# good
'No special symbols'
'No string interpolation'
'Just text'
"Wait! What's #{this}!"

Example: EnforcedStyle: double_quotes

# bad
'Just some text'
'No special chars or interpolation'

# good
"Just some text"
"No special chars or interpolation"
"Every string in #{project} uses double_quotes"

Line is too long. [104/80]
Open

    @project.machine_learning_service = FactoryGirl.create(:machine_learning_service, problem_id: 'NER')

Line is too long. [108/80]
Open

    @project.machine_learning_service = FactoryGirl.create(:machine_learning_service, problem_id: 'MegaNER')

Redundant curly braces around a hash parameter.
Open

      { 'associatedProblemIdentifiers' => ['NER'] }

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

Line is too long. [86/80]
Open

    @project.iterate_service = FactoryGirl.create(:iterate_service, problem_id: 'NER')

Line is too long. [89/80]
Open

  it 'shows a singleton if all associated services handle the same problem identifier' do

Line is too long. [97/80]
Open

  it 'should return a set of different problem identifiers if associated services handle them' do

There are no issues that match your filters.

Category
Status