QutBioacoustics/baw-server

View on GitHub

Showing 213 of 257 total issues

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

  def validate_each(record, attribute, value)
    # bypass rail's eager serialization of values
    if value.is_a?(Hash)
      return true if record.attributes_before_type_cast[attribute.to_s].is_a?(Hash)

Severity: Minor
Found in app/validators/json_validator.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

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

  def create
    do_new_resource
    do_set_attributes(site_params)
    get_project_if_exists
    do_authorize_instance
Severity: Minor
Found in app/controllers/sites_controller.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

Method audio_tool_segment has 6 arguments (exceeds 4 allowed). Consider refactoring.
Open

    def audio_tool_segment(extension, audio_tool_method, source, source_info, target, modify_parameters)
Severity: Minor
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_base.rb - About 45 mins to fix

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

        def command(
          source, _source_info, target,
          width: 1800, height: 280,
          colour_fg: 'FF9329FF', # audacity dark theme orange
          scale: :lin
    Severity: Minor
    Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_waveform.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

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

            def perform(analysis_params)
              analysis_params_sym = BawWorkers::Jobs::Analysis::Payload.normalize_opts(analysis_params)
    
              BawWorkers::Config.logger_worker.info do
                { message: 'Started analysis', parameters: Job.format_params_for_log(analysis_params_sym) }
    Severity: Minor
    Found in lib/gems/baw-workers/lib/baw_workers/jobs/analysis/job.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

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

        def modify_command(source, target)
          raise ArgumentError, "Source is not a wac file: #{source}" unless source.to_s.match(/\.wac$/)
          raise ArgumentError, "Target is not a wav file: : #{target}" unless target.to_s.match(/\.wav$/)
          raise Exceptions::FileNotFoundError, "Source does not exist: #{source}" unless File.exist? source
          raise Exceptions::FileAlreadyExistsError, "Target exists: #{target}" if File.exist? target
    Severity: Minor
    Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_wac2wav.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

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

        def modify_command(source, _source_info, target, start_offset = nil, end_offset = nil)
          source = Pathname(source)
          target = Pathname(target)
          raise ArgumentError, "Source is not a mp3 file: #{source}" unless source.extname == '.mp3'
          raise ArgumentError, "Target is not a mp3 file: : #{target}" unless target.extname == '.mp3'
    Severity: Minor
    Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_mp3splt.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

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

            def percent_complete
              if completed?
                100
              elsif queued?
                0
    Severity: Minor
    Found in lib/gems/baw-workers/lib/baw_workers/active_job/status/status_data.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

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

          def update_status(*messages, status: nil, progress: nil, total: nil)
            ensure_status
    
            status ||= @status.status
            unless TERMINAL_STATUSES.include?(status) || status == STATUS_WORKING
    Severity: Minor
    Found in lib/gems/baw-workers/lib/baw_workers/active_job/status.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

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

            def decode(status_string)
              return nil if status_string.nil?
    
              raise ArgumentError, 'status_string was not a string' unless status_string.is_a?(String)
    
    
    Severity: Minor
    Found in lib/gems/baw-workers/lib/baw_workers/active_job/status/persistance.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

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

        def modify_command(source, _source_info, target, start_offset = nil, end_offset = nil)
          source = Pathname(source)
          target = Pathname(target)
          raise ArgumentError, "Source is not a wavpack file: #{source}" unless source.extname == '.wv'
          raise ArgumentError, "Target is not a wav file: : #{target}" unless target.extname == '.wav'
    Severity: Minor
    Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_wavpack.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

    Consider simplifying this complex logical expression.
    Open

          return if value.is_a?(NilClass) || value.is_a?(Integer) || value.is_a?(String) || value.is_a?(Float) ||
                    value.is_a?(TrueClass) || value.is_a?(FalseClass)
    Severity: Major
    Found in app/modules/filter/validate.rb - About 40 mins to fix

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

        def send_message(logged_in_user, model, rails_request, subject_prefix, template_name)
      Severity: Minor
      Found in app/mailers/public_mailer.rb - About 35 mins to fix

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

            def compose_not_range(table, column_name, allowed, from, to)
        Severity: Minor
        Found in app/modules/filter/subset.rb - About 35 mins to fix

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

              def compose_sites_from_projects(field, filter_name, filter_value, table, valid_fields)
          Severity: Minor
          Found in app/modules/filter/custom.rb - About 35 mins to fix

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

                def create_available_details(audio_recording, current, modified_params, formats, relevant_keys)
            Severity: Minor
            Found in app/modules/api/media_metadata.rb - About 35 mins to fix

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

                  def compose_range(table, column_name, allowed, from, to)
              Severity: Minor
              Found in app/modules/filter/subset.rb - About 35 mins to fix

                Function createMarker has 5 arguments (exceeds 4 allowed). Consider refactoring.
                Open

                function createMarker(map, latLng, text, isInfoWindowOpen, draggable) {
                Severity: Minor
                Found in app/assets/javascripts/shared.js - About 35 mins to fix

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

                      def create_audio_recording_name(audio_recording, start_offset, end_offset, extra_options = '', extension = '')
                  Severity: Minor
                  Found in app/modules/namey_wamey.rb - About 35 mins to fix

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

                        def modify_command(source, _source_info, target, start_offset = nil, end_offset = nil)
                    Severity: Minor
                    Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_wavpack.rb - About 35 mins to fix
                      Severity
                      Category
                      Status
                      Source
                      Language