QutBioacoustics/baw-server

View on GitHub

Showing 213 of 257 total issues

Method try_update has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

        def try_update(*context)
          retry_attempts = self.class.retry_attempts
          attempts_left = retry_attempts
          failed = false
          errors = []
Severity: Minor
Found in lib/gems/baw-workers/lib/baw_workers/jobs/analysis/status.rb - About 35 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 arg_offsets has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def arg_offsets(start_offset, end_offset)
      cmd_arg = ''

      # start offset
      # -ss Seek to given time position in seconds. hh:mm:ss[.xxx] syntax is also supported.
Severity: Minor
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_ffmpeg.rb - About 35 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 check_integrity_item has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def check_integrity_item(hash)
      return nil if hash.blank?

      return nil if hash[:id].starts_with?('graph')
      return nil if hash[:id].starts_with?('audio format')
Severity: Minor
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_ffmpeg.rb - About 35 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 info has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring.
Open

    def info(source)
      source = source.to_s
      raise ArgumentError, "Source is not a wac file: #{source}" unless source.match(/\.wac$/)
      raise Exceptions::AudioFileNotFoundError, "Could not find #{source}." unless File.exist?(source)

Severity: Minor
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_wac2wav.rb - About 35 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

Avoid too many return statements within this method.
Open

      return nil if hash[:description].starts_with?('parser not found for')
Severity: Major
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_ffmpeg.rb - About 30 mins to fix

    Avoid too many return statements within this method.
    Open

          return nil if hash[:description].starts_with?('max_analyze_duration')
    Severity: Major
    Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_ffmpeg.rb - About 30 mins to fix

      Avoid too many return statements within this method.
      Open

              return nil
      Severity: Major
      Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_ffmpeg.rb - About 30 mins to fix

        Method update has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            do_load_resource
            do_authorize_instance
        
            relevant_params = audio_recording_params
        Severity: Minor
        Found in app/controllers/audio_recordings_controller.rb - About 25 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 project_access_request has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def project_access_request(sender_user, project_ids, reason)
            @sender_user = sender_user
            @access_reason = reason
        
            user_projects = {}
        Severity: Minor
        Found in app/mailers/project_mailer.rb - About 25 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

        Function createMarker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

        function createMarker(map, latLng, text, isInfoWindowOpen, draggable) {
            var instructions = 'Drag marker to site location. Delete Latitude and Longitude to specify no location.';
        
            // calculate defaults
            var draggableValue = (typeof draggable !== 'undefined' || !draggable) ? draggable : false;
        Severity: Minor
        Found in app/assets/javascripts/shared.js - About 25 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 get_existing_files has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_existing_files(poll_locations)
              existing_files = []
        
              poll_locations.each do |location|
                #dir = location[:dir]
        Severity: Minor
        Found in app/modules/media_poll.rb - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def update
            do_load_resource
            get_audio_event
            do_authorize_instance
        
        
        Severity: Minor
        Found in app/controllers/audio_event_comments_controller.rb - About 25 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 get_sign_in_params has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def get_sign_in_params
              # available parameters
              email = params[:email].presence
              login = params[:login].presence
              password = params[:password].presence
        Severity: Minor
        Found in app/modules/api/api_auth.rb - About 25 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 make_visualise_path has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def make_visualise_path(value)
              raise ArgumentError, 'Must provide project or site' if value.blank?
        
              link = '/visualize?'
        
        
        Severity: Minor
        Found in app/modules/api/custom_url_helpers.rb - About 25 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 compose_range_string_node has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def compose_range_string_node(node, range_string)
              validate_node_or_attribute(node)
        
              range_regex = /(\[|\()(.*),(.*)(\)|\])/i
              matches = range_string.match(range_regex)
        Severity: Minor
        Found in app/modules/filter/subset.rb - About 25 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 generate_yaml has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

                def self.generate_yaml(project_id, site_id, uploaders, recursive:, utc_offset: nil)
                  raise ArgumentError, 'recursive must be `true` or `false`' unless [true, false].include?(recursive)
        
                  uploader_section =
                    if uploaders.blank?
        Severity: Minor
        Found in lib/gems/baw-workers/lib/baw_workers/jobs/harvest/metadata.rb - About 25 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 has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def update
              @script = Script.find(params[:id])
        
              unless @script.is_last_version?
                respond_to do |format|
        Severity: Minor
        Found in app/controllers/admin/scripts_controller.rb - About 25 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 convert has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

            def convert(value, inline, words)
              return nil if value.blank?
        
              html = Kramdown::Document.new(value, KRAMDOWN_OPTIONS).to_html
        
        
        Severity: Minor
        Found in app/modules/custom_render.rb - About 25 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 validate_channel has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

              def validate_channel(opts)
                provided = validate_msg_provided(opts)
                raise ArgumentError, "#{validate_msg_base} channel. #{provided}" unless opts.include? :channel
                unless opts[:channel].to_i >= 0
                  raise ArgumentError, "channel #{validate_msg_eq_or_gt} 0: #{opts[:channel]}. #{provided}"
        Severity: Minor
        Found in lib/gems/baw-workers/lib/baw_workers/storage/common.rb - About 25 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 taxonomic_enforced has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
        Open

          def taxonomic_enforced
            if type_of_tag == 'common_name' || type_of_tag == 'species_name'
              errors.add(:is_taxonomic, "must be true for #{type_of_tag}") unless is_taxonomic
            elsif is_taxonomic
              errors.add(:is_taxonomic, "must be false for #{type_of_tag}")
        Severity: Minor
        Found in app/models/tag.rb - About 25 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

        Severity
        Category
        Status
        Source
        Language