spec/controllers/legislation/annotations_controller_spec.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

      expect do
        xhr :post, :create, process_id: @process.id,
                    draft_version_id: @draft_version.id,
                    legislation_annotation: {
                        "quote" => "ipsum",
Severity: Minor
Found in spec/controllers/legislation/annotations_controller_spec.rb and 1 other location - About 35 mins to fix
spec/controllers/legislation/annotations_controller_spec.rb on lines 90..98

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

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

      expect do
        xhr :post, :create, process_id: @process.id,
                    draft_version_id: @draft_version.id,
                    legislation_annotation: {
                        "quote" => "ipsum",
Severity: Minor
Found in spec/controllers/legislation/annotations_controller_spec.rb and 1 other location - About 35 mins to fix
spec/controllers/legislation/annotations_controller_spec.rb on lines 59..67

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

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

      post :create, process_id: @process.id,
                    draft_version_id: @draft_version.id,
                    legislation_annotation: {
                        "quote" => "ipsum",
                        "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
Severity: Minor
Found in spec/controllers/legislation/annotations_controller_spec.rb and 1 other location - About 15 mins to fix
spec/controllers/legislation/annotations_controller_spec.rb on lines 30..38

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

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

      post :create, process_id: @process.id,
                    draft_version_id: @final_version.id,
                    legislation_annotation: {
                      "quote" => "ipsum",
                      "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],
Severity: Minor
Found in spec/controllers/legislation/annotations_controller_spec.rb and 1 other location - About 15 mins to fix
spec/controllers/legislation/annotations_controller_spec.rb on lines 16..23

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

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. [114/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                          ranges: [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

                    draft_version_id: @final_version.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      sign_in @user

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

                    draft_version_id: @draft_version.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      end.not_to change { @draft_version.annotations.count }

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      post :create, process_id: @process.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      end.to change { @draft_version.annotations.count }.by(1)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

                    draft_version_id: @draft_version.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

        xhr :post, :create, process_id: @process.id,

Line is too long. [108/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      expect(Ahoy::Event.last.properties['legislation_annotation_id']).to eq Legislation::Annotation.last.id

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      post :create, process_id: @process.id,

Line is too long. [137/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      @process = create(:legislation_process, allegations_start_date: Date.current - 3.days, allegations_end_date: Date.current + 2.days)

Line is too long. [108/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      @draft_version = create(:legislation_draft_version, :published, process: @process, title: "Version 1")

Line is too long. [116/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                        "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      sign_in @user

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      sign_in @user

Line is too long. [112/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                          range_start: "/p[1]", range_start_offset: 6, range_end: "/p[1]", range_end_offset: 11)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      end.not_to change { @draft_version.annotations.count }

Line is too long. [116/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                        "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],

Line is too long. [116/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                        "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      sign_in @user

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      @process.update_attribute(:allegations_end_date, Date.current - 1.day)

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      @final_version = create(:legislation_draft_version, :published, :final_version, process: @process, title: "Final version")

Line is too long. [128/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      @final_version = create(:legislation_draft_version, :published, :final_version, process: @process, title: "Final version")

Line is too long. [124/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                        "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}].to_json,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      sign_in @user

Line is too long. [114/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                      "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      sign_in @user

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      annotation = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

                    draft_version_id: @draft_version.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

        xhr :post, :create, process_id: @process.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

                    draft_version_id: @draft_version.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      @draft_version = create(:legislation_draft_version, :published, process: @process, title: "Version 1")

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

        xhr :post, :create, process_id: @process.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

                    draft_version_id: @draft_version.id,

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

      end.to change { @draft_version.annotations.count }.by(1)

Line is too long. [116/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

                        "ranges" => [{"start" => "/p[1]", "startOffset" => 6, "end" => "/p[1]", "endOffset" => 11}],

Line is too long. [104/100] (https://github.com/bbatsov/ruby-style-guide#80-character-limits)
Open

      annotation = create(:legislation_annotation, draft_version: @draft_version, text: "my annotation",

Use let instead of an instance variable. (http://www.rubydoc.info/gems/rubocop-rspec/RuboCop/Cop/RSpec/InstanceVariable)
Open

        xhr :post, :create, process_id: @process.id,

There are no issues that match your filters.

Category
Status