Dalphi/dalphi

View on GitHub
spec/models/interface_spec.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

RSpec.describe Interface, type: :model do
  before(:each) do
    @interface = FactoryGirl.build(:interface)
  end

Severity: Minor
Found in spec/models/interface_spec.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.

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

  describe 'title' do
    it 'should not be nil' do
      @interface.title = nil
      expect(@interface).to be_invalid
    end
Severity: Minor
Found in spec/models/interface_spec.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.

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

  describe 'compiled_java_script' do
    it 'can be nil or empty iff java_script is nil' do
      @interface.java_script = nil
      @interface.compiled_java_script = nil
      expect(@interface).to be_valid
Severity: Minor
Found in spec/models/interface_spec.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.

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

  describe 'compiled_stylesheet' do
    it 'can be nil or empty iff stylesheet is nil' do
      @interface.stylesheet = nil
      @interface.compiled_stylesheet = nil
      expect(@interface).to be_valid
Severity: Minor
Found in spec/models/interface_spec.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.

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

    it 'is the compiled version of the java_script' do
      begin
        file = Tempfile.new('java_script')
        file.write(
          <<-COFFEE.gsub(/^ {12}/, '')
Severity: Minor
Found in spec/models/interface_spec.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.

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

  describe 'stylesheet' do
    it 'can be nil' do
      @interface.stylesheet = nil
      expect(@interface).to be_valid
    end
Severity: Major
Found in spec/models/interface_spec.rb and 1 other location - About 2 hrs to fix
spec/models/interface_spec.rb on lines 185..208

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 83.

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

  describe 'java_script' do
    it 'can be nil' do
      @interface.java_script = nil
      expect(@interface).to be_valid
    end
Severity: Major
Found in spec/models/interface_spec.rb and 1 other location - About 2 hrs to fix
spec/models/interface_spec.rb on lines 122..145

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 83.

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 3 locations. Consider refactoring.
Open

    it 'should not be assigned twice for non disjunct sets of problem identifiers' do
      @interface.title = 'Duplicate title'
      @interface.associated_problem_identifiers = %w(ner superNER)
      @interface.save!

Severity: Minor
Found in spec/models/interface_spec.rb and 2 other locations - About 30 mins to fix
spec/models/interface_spec.rb on lines 45..54
spec/models/interface_spec.rb on lines 57..66

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 32.

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 3 locations. Consider refactoring.
Open

    it 'can be assigned twice for disjunct sets of problem identifiers' do
      @interface.title = 'Duplicate title'
      @interface.associated_problem_identifiers = %w(ner superNER)
      @interface.save!

Severity: Minor
Found in spec/models/interface_spec.rb and 2 other locations - About 30 mins to fix
spec/models/interface_spec.rb on lines 33..42
spec/models/interface_spec.rb on lines 57..66

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 32.

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 3 locations. Consider refactoring.
Open

    it 'can be different for non disjunct sets of problem identifiers' do
      @interface.title = 'Different title'
      @interface.associated_problem_identifiers = %w(ner superNER)
      @interface.save!

Severity: Minor
Found in spec/models/interface_spec.rb and 2 other locations - About 30 mins to fix
spec/models/interface_spec.rb on lines 33..42
spec/models/interface_spec.rb on lines 45..54

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 32.

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 'can be nil or empty iff java_script is nil' do
      @interface.java_script = nil
      @interface.compiled_java_script = nil
      expect(@interface).to be_valid

Severity: Minor
Found in spec/models/interface_spec.rb and 1 other location - About 25 mins to fix
spec/models/interface_spec.rb on lines 150..157

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 30.

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 'can be nil or empty iff stylesheet is nil' do
      @interface.stylesheet = nil
      @interface.compiled_stylesheet = nil
      expect(@interface).to be_valid

Severity: Minor
Found in spec/models/interface_spec.rb and 1 other location - About 25 mins to fix
spec/models/interface_spec.rb on lines 215..222

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 30.

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. [94/80]
Open

                                             associated_problem_identifiers: %w(ner ultraNER))
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [105/80]
Open

      @interface.java_script = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal_invalid.js")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Empty line detected around arguments.
Open


              test();
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cops checks if empty lines exist around the arguments of a method invocation.

Example:

# bad
do_something(
  foo

)

process(bar,

        baz: qux,
        thud: fred)

some_method(

  [1,2,3],
  x: y
)

# good
do_something(
  foo
)

process(bar,
        baz: qux,
        thud: fred)

some_method(
  [1,2,3],
  x: y
)

Empty line detected around arguments.
Open


            }).call(this);
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cops checks if empty lines exist around the arguments of a method invocation.

Example:

# bad
do_something(
  foo

)

process(bar,

        baz: qux,
        thud: fred)

some_method(

  [1,2,3],
  x: y
)

# good
do_something(
  foo
)

process(bar,
        baz: qux,
        thud: fred)

some_method(
  [1,2,3],
  x: y
)

%w-literals should be delimited by [ and ].
Open

      @interface.associated_problem_identifiers = %w(ner superNER)
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Line is too long. [96/80]
Open

      @interface.template = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal.html")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [90/80]
Open

      @interface.java_script = File.new("#{Rails.root}/spec/fixtures/interfaces/empty.js")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [99/80]
Open

                                             associated_problem_identifiers: %w(ultraNER hyperNER))
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Empty line detected around arguments.
Open


            test()
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cops checks if empty lines exist around the arguments of a method invocation.

Example:

# bad
do_something(
  foo

)

process(bar,

        baz: qux,
        thud: fred)

some_method(

  [1,2,3],
  x: y
)

# good
do_something(
  foo
)

process(bar,
        baz: qux,
        thud: fred)

some_method(
  [1,2,3],
  x: y
)

Line is too long. [94/80]
Open

                                             associated_problem_identifiers: %w(ner ultraNER))
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [97/80]
Open

      @interface.java_script = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal.js")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [81/80]
Open

      @interface.associated_problem_identifiers = ['ner', 'image classification']
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [85/80]
Open

    it 'should not be assigned twice for non disjunct sets of problem identifiers' do
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [87/80]
Open

                                             interface_type: @interface.interface_type,
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [87/80]
Open

                                             interface_type: @interface.interface_type,
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [90/80]
Open

      @interface.stylesheet = File.new("#{Rails.root}/spec/fixtures/interfaces/empty.css")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [90/80]
Open

      @interface.java_script = File.new("#{Rails.root}/spec/fixtures/interfaces/empty.js")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

%w-literals should be delimited by [ and ].
Open

      @interface.associated_problem_identifiers = %w(ner superNER)
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

%w-literals should be delimited by [ and ].
Open

                                             associated_problem_identifiers: %w(ner ultraNER))
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Line is too long. [89/80]
Open

      @interface.template = File.new("#{Rails.root}/spec/fixtures/interfaces/empty.html")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [87/80]
Open

                                             interface_type: @interface.interface_type,
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [97/80]
Open

      @interface.stylesheet = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal.css")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [105/80]
Open

      @interface.stylesheet = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal_invalid.css")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [113/80]
Open

        file.write('$strong-font-size: 2rem; p { text-align: center; strong { font-size: $strong-font-size; } }')
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [97/80]
Open

      @interface.java_script = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal.js")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

%w-literals should be delimited by [ and ].
Open

                                             associated_problem_identifiers: %w(ultraNER hyperNER))
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

%w-literals should be delimited by [ and ].
Open

      @interface.associated_problem_identifiers = %w(ner superNER)
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

Line is too long. [90/80]
Open

      @interface.stylesheet = File.new("#{Rails.root}/spec/fixtures/interfaces/empty.css")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

Line is too long. [97/80]
Open

      @interface.stylesheet = File.new("#{Rails.root}/spec/fixtures/interfaces/text_nominal.css")
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

%w-literals should be delimited by [ and ].
Open

                                             associated_problem_identifiers: %w(ner ultraNER))
Severity: Minor
Found in spec/models/interface_spec.rb by rubocop

This cop enforces the consistent usage of %-literal delimiters.

Specify the 'default' key to set all preferred delimiters at once. You can continue to specify individual preferred delimiters to override the default.

Example:

# Style/PercentLiteralDelimiters:
#   PreferredDelimiters:
#     default: '[]'
#     '%i':    '()'

# good
%w[alpha beta] + %i(gamma delta)

# bad
%W(alpha #{beta})

# bad
%I(alpha beta)

There are no issues that match your filters.

Category
Status