expertiza/expertiza

View on GitHub
spec/features/survey_spec.rb

Summary

Maintainability
B
5 hrs
Test Coverage

Assignment Branch Condition size for deploy_survey is too high. [27.17/15]
Open

def deploy_survey(start_date, end_date, survey_name)
  login_as('instructor6')
  expect(page).to have_content('Manage content')
  create_assignment_questionnaire survey_name
  survey = Questionnaire.where(name: survey_name)
Severity: Minor
Found in spec/features/survey_spec.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

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

describe 'Survey questionnaire tests for instructor interface' do
  before(:each) do
    assignment_setup
    @previous_day = (Time.now.getlocal - 1 * 86_400).strftime('%Y-%m-%d %H:%M:%S')
    @next_day = (Time.now.getlocal + 1 * 86_400).strftime('%Y-%m-%d %H:%M:%S')
Severity: Minor
Found in spec/features/survey_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.

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

def deploy_survey(start_date, end_date, survey_name)
  login_as('instructor6')
  expect(page).to have_content('Manage content')
  create_assignment_questionnaire survey_name
  survey = Questionnaire.where(name: survey_name)
Severity: Minor
Found in spec/features/survey_spec.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.

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

  it 'is able to view statistics of a survey' do
    survey_name = 'Survey Questionnaire 1'
    deploy_survey(@next_day, @next_to_next_day, survey_name)

    survey_questionnaire_1 = Questionnaire.where(name: survey_name).first
Severity: Major
Found in spec/features/survey_spec.rb and 1 other location - About 2 hrs to fix
spec/features/assignment_survey_spec.rb on lines 53..79

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

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

def deploy_survey(start_date, end_date, survey_name)
  login_as('instructor6')
  expect(page).to have_content('Manage content')
  create_assignment_questionnaire survey_name
  survey = Questionnaire.where(name: survey_name)
Severity: Major
Found in spec/features/survey_spec.rb and 1 other location - About 1 hr to fix
spec/features/course_survey_spec.rb on lines 9..21

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

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 'is able to view responses of a survey' do
    survey_name = 'Survey Questionnaire 1'
    deploy_survey(@next_day, @next_to_next_day, survey_name)

    survey_questionnaire_1 = Questionnaire.where(name: survey_name).first
Severity: Minor
Found in spec/features/survey_spec.rb and 2 other locations - About 35 mins to fix
spec/features/assignment_survey_spec.rb on lines 82..91
spec/features/assignment_survey_spec.rb on lines 109..118

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

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

  before(:each) do
    assignment_setup
    @previous_day = (Time.now.getlocal - 1 * 86_400).strftime('%Y-%m-%d %H:%M:%S')
    @next_day = (Time.now.getlocal + 1 * 86_400).strftime('%Y-%m-%d %H:%M:%S')
    @next_to_next_day = (Time.now.getlocal + 2 * 86_400).strftime('%Y-%m-%d %H:%M:%S')
Severity: Major
Found in spec/features/survey_spec.rb and 3 other locations - About 35 mins to fix
spec/features/assignment_survey_spec.rb on lines 24..28
spec/features/course_survey_spec.rb on lines 25..29
spec/features/global_survey_spec.rb on lines 26..30

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

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

Use normalcase for variable numbers.
Open

    survey_questionnaire_1 = Questionnaire.where(name: survey_name).first
Severity: Minor
Found in spec/features/survey_spec.rb by rubocop

This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

Example: EnforcedStyle: snake_case

# bad

variable1 = 1

# good

variable_1 = 1

Example: EnforcedStyle: normalcase (default)

# bad

variable_1 = 1

# good

variable1 = 1

Example: EnforcedStyle: non_integer

# bad

variable1 = 1

variable_1 = 1

# good

variableone = 1

variable_one = 1

include is used at the top level. Use inside class or module.
Open

include InstructorInterfaceHelperSpec
Severity: Minor
Found in spec/features/survey_spec.rb by rubocop

This cop checks that include, extend and prepend exists at the top level. Using these at the top level affects the behavior of Object. There will not be using include, extend and prepend at the top level. Let's use it inside class or module.

Example:

# bad
include M

class C
end

# bad
extend M

class C
end

# bad
prepend M

class C
end

# good
class C
  include M
end

# good
class C
  extend M
end

# good
class C
  prepend M
end

Use normalcase for variable numbers.
Open

    survey_questionnaire_1 = Questionnaire.where(name: survey_name).first
Severity: Minor
Found in spec/features/survey_spec.rb by rubocop

This cop makes sure that all numbered variables use the configured style, snakecase, normalcase or noninteger, for their numbering.

Example: EnforcedStyle: snake_case

# bad

variable1 = 1

# good

variable_1 = 1

Example: EnforcedStyle: normalcase (default)

# bad

variable_1 = 1

# good

variable1 = 1

Example: EnforcedStyle: non_integer

# bad

variable1 = 1

variable_1 = 1

# good

variableone = 1

variable_one = 1

There are no issues that match your filters.

Category
Status