scottwillson/racing_on_rails

View on GitHub
test/models/results/results_file_test.rb

Summary

Maintainability
D
2 days
Test Coverage

File results_file_test.rb has 602 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require "test_helper"

# :stopdoc:
module Results
  # FIXME: DNF's not handled correctly.
Severity: Major
Found in test/models/results/results_file_test.rb - About 1 day to fix

    Method get_expected_races has 118 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        def get_expected_races
          races = []
    
          race = Race.new(category: Category.new(name: "Senior Men Pro/1/2/3"))
          race.results << Result.new(place: "1", first_name: "Evan", last_name: "Elken", number: "154", license: "999999999", team_name: "Jittery Joe's", points: "23.0")
    Severity: Major
    Found in test/models/results/results_file_test.rb - About 4 hrs to fix

      Method expected_results has 34 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          def expected_results(_event)
            expected_races = []
      
            race = Race.new(category: Category.new(name: "Category 3"))
      
      
      Severity: Minor
      Found in test/models/results/results_file_test.rb - About 1 hr to fix

        Method build_result has 5 arguments (exceeds 4 allowed). Consider refactoring.
        Open

            def build_result(race, place, first_name = nil, last_name = nil, team_name = nil)
        Severity: Minor
        Found in test/models/results/results_file_test.rb - About 35 mins to fix

          TODO found
          Open

                # TODO: Import starters/field size

          FIXME found
          Open

            # FIXME: DNF's not handled correctly.

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

              test "#same_time?" do
                table = Tabular::Table.new([
                                             { place: "1", name: "Joanne Eastwood", time: "24:21" },
                                             { place: "2", name: "Nicole Pressprich", time: "" }
                                           ])
          Severity: Minor
          Found in test/models/results/results_file_test.rb and 1 other location - About 25 mins to fix
          test/models/results/results_file_test.rb on lines 454..460

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

          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

              test "#same_time? should consider place" do
                table = Tabular::Table.new([
                                             { place: "1", name: "Joanne Eastwood", time: "24:21" },
                                             { place: "DNS", name: "Nicole Pressprich", time: "DNS" }
                                           ])
          Severity: Minor
          Found in test/models/results/results_file_test.rb and 1 other location - About 25 mins to fix
          test/models/results/results_file_test.rb on lines 445..451

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

          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

                      assert(result.person.member?(race_date), "member? for race #{index} result #{result_index} #{result.name} #{result.person.member_from} #{result.person.member_to}")
          Severity: Minor
          Found in test/models/results/results_file_test.rb and 1 other location - About 15 mins to fix
          test/models/results/results_file_test.rb on lines 76..76

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

          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

              test "race notes" do
                event = SingleDayEvent.create!
                results_file = ResultsFile.new(File.new(file_fixture("results/tt.xlsx")), event)
                results_file.import
                assert_equal("Field Size: 40 riders, 40 Laps, Sunny, cool, 40K", event.races.reload.first.notes, "Race notes")
          Severity: Minor
          Found in test/models/results/results_file_test.rb and 1 other location - About 15 mins to fix
          test/models/results/usac_results_file_test.rb on lines 42..46

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

          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

                      assert_not(result.person.member?(race_date), "member? for race #{index} result #{result_index} #{result.name} #{result.person.member_from} #{result.person.member_to}")
          Severity: Minor
          Found in test/models/results/results_file_test.rb and 1 other location - About 15 mins to fix
          test/models/results/results_file_test.rb on lines 69..69

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

          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