mhenrixon/stub_requests

View on GitHub

Showing 70 of 71 total issues

Complex method let#endpoint (26.9)
Open

  let(:endpoint) { service.register(endpoint_id, endpoint_verb, endpoint_path) }

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method describe(#register)::context#with existing difference callbacks (26.1)
Open

    context "with existing difference callbacks" do
      before do
        registry.register(:another, :endpoint, :any, callback)
      end

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

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

RSpec.describe Time do
  it { is_expected.to respond_to(:blank?) }
  it { is_expected.to respond_to(:present?) }
  it { is_expected.to respond_to(:presence) }

Severity: Major
Found in spec/stub_requests/core_ext/object/blank_spec.rb and 2 other locations - About 45 mins to fix
spec/stub_requests/core_ext/object/blank_spec.rb on lines 5..13
spec/stub_requests/core_ext/object/blank_spec.rb on lines 115..122

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

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

RSpec.describe Object do
  it { is_expected.to respond_to(:blank?) }
  it { is_expected.to respond_to(:present?) }
  it { is_expected.to respond_to(:presence) }

Severity: Major
Found in spec/stub_requests/core_ext/object/blank_spec.rb and 2 other locations - About 45 mins to fix
spec/stub_requests/core_ext/object/blank_spec.rb on lines 115..122
spec/stub_requests/core_ext/object/blank_spec.rb on lines 125..132

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

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

RSpec.describe Numeric do
  it { is_expected.to respond_to(:blank?) }
  it { is_expected.to respond_to(:present?) }
  it { is_expected.to respond_to(:presence) }

Severity: Major
Found in spec/stub_requests/core_ext/object/blank_spec.rb and 2 other locations - About 45 mins to fix
spec/stub_requests/core_ext/object/blank_spec.rb on lines 5..13
spec/stub_requests/core_ext/object/blank_spec.rb on lines 125..132

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

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

Complex method describe(#each)::context(when given a block)::context#when endpoint is registered (25.0)
Open

      context "when endpoint is registered" do
        before { registry.register(endpoint) }

        specify do
          each { |ep| expect(ep.id).to eq(endpoint.id) }

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method describe(#==)::context#when other have same id (24.4)
Open

    context "when `other` have same id" do
      let(:other_id) { service_id }

      specify { expect(service).to eq(other) }
Severity: Minor
Found in spec/stub_requests/service_spec.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method let#endpoint_attributes (23.4)
Open

  let(:endpoint_attributes) do
    {
      endpoint_id: endpoint_id,
      service_id: service_id,
      service_uri: service_uri,

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method describe##define (23.3)
Open

  describe "#define" do
    subject(:define) { instance.define }

    before do
      allow(receiver).to receive(:module_eval)

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method describe(#==)::context#when other has a different id (23.2)
Open

    context "when `other` has a different id" do
      specify { expect(service).not_to eq(other) }
Severity: Minor
Found in spec/stub_requests/service_spec.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

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

    describe "#stub_person_documents_patch" do
      it "stubs WebMock with the right request details" do
        test_instance.stub_person_documents_patch(person_id: 789, id: 321) do
          expect(self).to be_a(WebMock::RequestStub)
          expect(request_pattern.uri_pattern.to_s).to eq("https://domain.com/api/internal/persons/789/documents/321")
Severity: Minor
Found in spec/stub_requests/dsl_spec.rb and 1 other location - About 35 mins to fix
spec/stub_requests/dsl_spec.rb on lines 98..103

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

    describe "#stub_person_documents_destroy" do
      it "stubs WebMock with the right request details" do
        test_instance.stub_person_documents_destroy(person_id: 789, id: 321) do
          expect(self).to be_a(WebMock::RequestStub)
          expect(request_pattern.uri_pattern.to_s).to eq("https://domain.com/api/internal/persons/789/documents/321")
Severity: Minor
Found in spec/stub_requests/dsl_spec.rb and 1 other location - About 35 mins to fix
spec/stub_requests/dsl_spec.rb on lines 88..93

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

Complex method describe#.call (22.7)
Open

  describe ".call" do
    subject(:call) { described_class.call(name, type, default, properties) }

    before do
      allow(described_class).to receive(:new).and_return(validator)

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method let#service (22.4)
Open

  let(:service)  { service_registry.register(service_id, service_uri) }

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

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

    describe "#stub_person_documents_create" do
      it "stubs WebMock with the right request details" do
        test_instance.stub_person_documents_create(person_id: "abcdef") do
          expect(self).to be_a(WebMock::RequestStub)
          expect(request_pattern.uri_pattern.to_s).to eq("https://domain.com/api/internal/persons/abcdef/documents")
Severity: Minor
Found in spec/stub_requests/dsl_spec.rb and 1 other location - About 30 mins to fix
spec/stub_requests/dsl_spec.rb on lines 78..83

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

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

Complex method describe(#initialize)::its#verb (22.2)
Open

    its(:verb)          { is_expected.to eq(request_pattern.method_pattern.to_s.to_sym) }

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

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

    describe "#stub_person_documents_index" do
      it "stubs WebMock with the right request details" do
        test_instance.stub_person_documents_index(person_id: "631") do
          expect(self).to be_a(WebMock::RequestStub)
          expect(request_pattern.uri_pattern.to_s).to eq("https://domain.com/api/internal/persons/631/documents")
Severity: Minor
Found in spec/stub_requests/dsl_spec.rb and 1 other location - About 30 mins to fix
spec/stub_requests/dsl_spec.rb on lines 58..63

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

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

Complex method describe(#register)::context#without existing callbacks (22.1)
Open

    context "without existing callbacks" do
      it! { is_expected.to change(registry.callbacks, :size).by(1) }

      it { is_expected.to be_a(StubRequests::Callback) }
      its(:service_id)  { is_expected.to eq(service_id) }

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method describe(#invoke_callbacks)::context#with existing callbacks (21.8)
Open

    context "with existing callbacks" do
      before do
        registry.register(service_id, endpoint_id, verb, callback)
        allow(callback).to receive(:call)
      end

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Complex method describe(#it!)::context(with metadata)::context(preserves access to metadata that ends in hash)::it!#foo (21.2)
Open

        it!(:foo, bar: 17) do |example|
          expect(example.metadata[:foo]).to be(true)
          expect(example.metadata[:bar]).to be(17)
Severity: Minor
Found in spec/rspec/subject_as_lambda_spec.rb by flog

Flog calculates the ABC score for methods. The ABC score is based on assignments, branches (method calls), and conditions.

You can read more about ABC metrics or the flog tool

Severity
Category
Status
Source
Language