expertiza/expertiza

View on GitHub
spec/models/collusion_cycle_spec.rb

Summary

Maintainability
B
6 hrs
Test Coverage

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

describe CollusionCycle do
  #
  # assignment participant -----
  #    ^                       |
  #    |                       V
Severity: Minor
Found in spec/models/collusion_cycle_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. [110/25]
Open

  describe '#four_node_cycles' do
    context 'when the reviewers of current reviewer (ap3) does not include current assignment participant' do
      it 'skips this reviewer (ap3) and returns corresponding collusion cycles' do
        # Sets up stubs for test
        allow(ReviewResponseMap).to receive(:where).with('reviewee_id = ?', team1.id).and_return([response_map_team_1_2])
Severity: Minor
Found in spec/models/collusion_cycle_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. [64/25]
Open

    context 'when the reviewers of current reviewer (ap3) includes current assignment participant' do
      # This before-each function is used to extract out re-appearing code used in four_node_cycle tests
      # More specifically, it is used to extract out the common code used to
      # create a relationship between four reviewing participants
      before(:each) do
Severity: Minor
Found in spec/models/collusion_cycle_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. [52/25]
Open

      context 'when a full, four participant relationship has been constructed' do
        before(:each) do
          allow(ReviewResponseMap).to receive(:where).with(reviewee_id: team1.id, reviewer_id: participant2.id).and_return([response_map_team_1_2])
          allow(Response).to receive(:where).with(map_id: [response_map_team_1_2]).and_return([response_1_2])
          allow(ReviewResponseMap).to receive(:where).with(reviewee_id: team2.id, reviewer_id: participant3.id).and_return([response_map_team_2_3])
Severity: Minor
Found in spec/models/collusion_cycle_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.

File collusion_cycle_spec.rb has 270 lines of code (exceeds 250 allowed). Consider refactoring.
Open

describe CollusionCycle do
  #
  # assignment participant -----
  #    ^                       |
  #    |                       V
Severity: Minor
Found in spec/models/collusion_cycle_spec.rb - About 2 hrs to fix

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

      describe '#three_node_cycles' do
        context 'when the reviewers of current reviewer (ap2) does not include current assignment participant' do
          it 'skips this reviewer (ap2) and returns corresponding collusion cycles' do
            # Sets up stubs for test
            allow(ReviewResponseMap).to receive(:where).with('reviewee_id = ?', team1.id).and_return([response_map_team_1_2])
    Severity: Minor
    Found in spec/models/collusion_cycle_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. [30/25]
    Open

        context 'when the reviewers of current reviewer (ap2) includes current assignment participant' do
          # This before-each function is used to extract out re-appearing code used in three_node_cycle tests
          # More specifically, it is used to extract out the common code used to
          # create a relationship between three reviewing participants.
          before(:each) do
    Severity: Minor
    Found in spec/models/collusion_cycle_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 '#two_node_cycles' do
        context 'when the reviewers of current reviewer (ap) does not include current assignment participant' do
          it 'skips this reviewer (ap) and returns corresponding collusion cycles' do
            # Sets up stubs for test
            allow(ReviewResponseMap).to receive(:where).with('reviewee_id = ?', team1.id).and_return([response_map_team_1_2])
    Severity: Minor
    Found in spec/models/collusion_cycle_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 '#cycle_deviation_score' do
          context 'when collusion cycle has been calculated, verify the deviation score' do
            it 'returns cycle deviation score based on inputted 2 node cycle' do
              c = [[participant1, 91], [participant2, 71]]
              expect(cycle.cycle_deviation_score(c)).to eql(1.0)
    Severity: Major
    Found in spec/models/collusion_cycle_spec.rb and 1 other location - About 1 hr to fix
    spec/models/collusion_cycle_spec.rb on lines 305..317

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

    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 '#cycle_similarity_score' do
          context 'when collusion cycle has been calculated, verify the similarity score' do
            it 'returns similarity score based on inputted 2 node cycle' do
              c = [[participant1, 90], [participant2, 70]]
              expect(cycle.cycle_similarity_score(c)).to eql(20.0)
    Severity: Major
    Found in spec/models/collusion_cycle_spec.rb and 1 other location - About 1 hr to fix
    spec/models/collusion_cycle_spec.rb on lines 322..334

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

    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