crowbar/crowbar-core

View on GitHub
crowbar_framework/spec/controllers/crowbar_controller_spec.rb

Summary

Maintainability
A
1 hr
Test Coverage

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

      it "returns plain text message if show fails" do
        allow_any_instance_of(CrowbarService).to receive(:show_active).and_return([500, "Error"])
        post :show, id: "default", format: "json"
        expect(response).to be_server_error
        expect(response.body).to be == "Error"
Severity: Minor
Found in crowbar_framework/spec/controllers/crowbar_controller_spec.rb and 1 other location - About 25 mins to fix
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 241..245

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

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 500 on failure for json" do
      allow_any_instance_of(CrowbarService).to receive(:destroy_active).and_return([500, "Error"])
      delete :delete, name: "default", format: "json"
      expect(response).to be_server_error
      expect(response.body).to be == "Error"
Severity: Minor
Found in crowbar_framework/spec/controllers/crowbar_controller_spec.rb and 1 other location - About 25 mins to fix
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 136..140

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

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 "returns plain text message if version fetching fails" do
      allow_any_instance_of(CrowbarService).to receive(:versions).and_return([404, "Not found"])
      get :versions
      expect(response).to be_missing
      expect(response.body).to be == "Not found"
Severity: Minor
Found in crowbar_framework/spec/controllers/crowbar_controller_spec.rb and 2 other locations - About 15 mins to fix
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 166..170
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 183..187

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

    it "returns plain text message if elements fails" do
      allow_any_instance_of(CrowbarService).to receive(:elements).and_return([500, "Error"])
      get :elements
      expect(response).to be_server_error
      expect(response.body).to be == "Error"
Severity: Minor
Found in crowbar_framework/spec/controllers/crowbar_controller_spec.rb and 2 other locations - About 15 mins to fix
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 59..63
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 183..187

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

    it "returns plain text message if element_info fails" do
      allow_any_instance_of(CrowbarService).to receive(:element_info).and_return([500, "Error"])
      get :element_info
      expect(response).to be_server_error
      expect(response.body).to be == "Error"
Severity: Minor
Found in crowbar_framework/spec/controllers/crowbar_controller_spec.rb and 2 other locations - About 15 mins to fix
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 59..63
crowbar_framework/spec/controllers/crowbar_controller_spec.rb on lines 166..170

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

There are no issues that match your filters.

Category
Status