QutBioacoustics/baw-server

View on GitHub
lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb

Summary

Maintainability
D
1 day
Test Coverage

Method logged_csv_line has 104 lines of code (exceeds 25 allowed). Consider refactoring.
Open

          def logged_csv_line(file_path, exists, moved_path = nil,
                              compare_hash = nil, api_result_hash = nil,
                              api_response = nil, review_level = :none_all_good,
                              audio_recording_id)
            csv_headers = [
Severity: Major
Found in lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb - About 4 hrs to fix

    Method logged_csv_line has a Cognitive Complexity of 27 (exceeds 5 allowed). Consider refactoring.
    Open

              def logged_csv_line(file_path, exists, moved_path = nil,
                                  compare_hash = nil, api_result_hash = nil,
                                  api_response = nil, review_level = :none_all_good,
                                  audio_recording_id)
                csv_headers = [
    Severity: Minor
    Found in lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb - About 3 hrs to fix

    Cognitive Complexity

    Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

    A method's cognitive complexity is based on a few simple rules:

    • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
    • Code is considered more complex for each "break in the linear flow of the code"
    • Code is considered more complex when "flow breaking structures are nested"

    Further reading

    Method write_audio_recordings_csv has 51 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

              def write_audio_recordings_csv(original_csv, hash_csv, result_csv)
                audio_info = {}
    
                BawWorkers::ReadCsv.read_audio_recording_csv(original_csv) do |audio_params|
                  audio_info[audio_params[:uuid]] = audio_params
    Severity: Major
    Found in lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb - About 2 hrs to fix

      Method compare_csv_db has 37 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

                def compare_csv_db(csv_file)
                  original_audio = BawWorkers::Config.original_audio_helper
      
                  # gather all existing files
                  files = []
      Severity: Minor
      Found in lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb - About 1 hr to fix

        Method logged_csv_line has 8 arguments (exceeds 4 allowed). Consider refactoring.
        Open

                  def logged_csv_line(file_path, exists, moved_path = nil,
                                      compare_hash = nil, api_result_hash = nil,
                                      api_response = nil, review_level = :none_all_good,
                                      audio_recording_id)
        Severity: Major
        Found in lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb - About 1 hr to fix

          Method write_audio_recordings_csv has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring.
          Open

                    def write_audio_recordings_csv(original_csv, hash_csv, result_csv)
                      audio_info = {}
          
                      BawWorkers::ReadCsv.read_audio_recording_csv(original_csv) do |audio_params|
                        audio_info[audio_params[:uuid]] = audio_params
          Severity: Minor
          Found in lib/gems/baw-workers/lib/baw_workers/jobs/audio_check/csv_helper.rb - About 45 mins to fix

          Cognitive Complexity

          Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

          A method's cognitive complexity is based on a few simple rules:

          • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
          • Code is considered more complex for each "break in the linear flow of the code"
          • Code is considered more complex when "flow breaking structures are nested"

          Further reading

          There are no issues that match your filters.

          Category
          Status