Dalphi/dalphi

View on GitHub
spec/requests/annotation_documents_spec.rb

Summary

Maintainability
A
2 hrs
Test Coverage

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

RSpec.describe 'AnnotationDocuments internal API', type: :request do
  before(:each) do
    @annotation_document = FactoryGirl.create(:annotation_document)
    @project = @annotation_document.project
    sign_in(@project.admin)

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.

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  it 'returns 2 annotation documents if a count of 2 is specified' do
    another_annotation_document = FactoryGirl.create(
                                    :annotation_document_with_different_payload,
                                    raw_datum: @annotation_document.raw_datum,
                                    interface_type: @annotation_document.interface_type
Severity: Major
Found in spec/requests/annotation_documents_spec.rb and 1 other location - About 1 hr to fix
spec/requests/annotation_documents_spec.rb on lines 42..58

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Similar blocks of code found in 2 locations. Consider refactoring.
Open

  it 'returns 2 annotation documents, even if a count of 10 is specified but only 2 available' do
    another_annotation_document = FactoryGirl.create(
                                    :annotation_document_with_different_payload,
                                    raw_datum: @annotation_document.raw_datum,
                                    interface_type: @annotation_document.interface_type
Severity: Major
Found in spec/requests/annotation_documents_spec.rb and 1 other location - About 1 hr to fix
spec/requests/annotation_documents_spec.rb on lines 23..39

Duplicated Code

Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

Tuning

This issue has a mass of 56.

We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

Refactorings

Further Reading

Line is too long. [87/80]
Open

                                    interface_type: @annotation_document.interface_type

Line is too long. [87/80]
Open

                                    interface_type: @annotation_document.interface_type

Line is too long. [84/80]
Open

    compare_annotation_document_with_json_response(@annotation_document, json.first)

Indent the first parameter one step more than the start of the previous line.
Open

                                    :annotation_document_with_different_payload,

This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

Example:

# bad
some_method(
first_param,
second_param)

# good
some_method(
  first_param,
second_param)

Indent the first parameter one step more than the start of the previous line.
Open

                                    :annotation_document_with_different_payload,

This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

Example:

# bad
some_method(
first_param,
second_param)

# good
some_method(
  first_param,
second_param)

Line is too long. [84/80]
Open

    compare_annotation_document_with_json_response(@annotation_document, json.first)

Line is too long. [87/80]
Open

                                    interface_type: @annotation_document.interface_type

Line is too long. [90/80]
Open

    compare_annotation_document_with_json_response(another_annotation_document, json.last)

Line is too long. [90/80]
Open

    compare_annotation_document_with_json_response(another_annotation_document, json.last)

Indent ) the same as the start of the line where ( is.
Open

                                  )

This cops checks the indentation of hanging closing parentheses in method calls, method definitions, and grouped expressions. A hanging closing parenthesis means ) preceded by a line break.

Example:

# good: when x is on its own line, indent this way
func(
  x,
  y
)

# good: when x follows opening parenthesis, align parentheses
a = b * (x +
         y
        )

# bad
def func(
  x,
  y
  )
end

Line is too long. [84/80]
Open

    compare_annotation_document_with_json_response(@annotation_document, json.first)

Indent ) the same as the start of the line where ( is.
Open

                                  )

This cops checks the indentation of hanging closing parentheses in method calls, method definitions, and grouped expressions. A hanging closing parenthesis means ) preceded by a line break.

Example:

# good: when x is on its own line, indent this way
func(
  x,
  y
)

# good: when x follows opening parenthesis, align parentheses
a = b * (x +
         y
        )

# bad
def func(
  x,
  y
  )
end

Indent the first parameter one step more than the start of the previous line.
Open

                                    :annotation_document_with_different_payload,

This cop checks the indentation of the first parameter in a method call. Parameters after the first one are checked by Style/AlignParameters, not by this cop.

Example:

# bad
some_method(
first_param,
second_param)

# good
some_method(
  first_param,
second_param)

Indent ) the same as the start of the line where ( is.
Open

                                  )

This cops checks the indentation of hanging closing parentheses in method calls, method definitions, and grouped expressions. A hanging closing parenthesis means ) preceded by a line break.

Example:

# good: when x is on its own line, indent this way
func(
  x,
  y
)

# good: when x follows opening parenthesis, align parentheses
a = b * (x +
         y
        )

# bad
def func(
  x,
  y
  )
end

Line is too long. [97/80]
Open

  it 'returns 2 annotation documents, even if a count of 10 is specified but only 2 available' do

There are no issues that match your filters.

Category
Status