QutBioacoustics/baw-server

View on GitHub

Showing 213 of 257 total issues

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

  def destroy
    return system_mutate if system_job?

    do_load_resource
    do_authorize_instance
Severity: Minor
Found in app/controllers/analysis_jobs_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 format_resque_worker has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def format_resque_worker(result, settings)
        is_resque_worker = resque_worker?
        result[:resque_worker] = {
          running: is_resque_worker,
          mode: baw_workers_mode(settings),
Severity: Minor
Found in lib/gems/baw-workers/lib/baw_workers/config.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_project_if_exists
    do_authorize_instance

Severity: Minor
Found in app/controllers/harvests_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_config has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def get_config(raw_opts)
          if raw_opts[:config_file] && raw_opts[:config_string]
            raise ArgumentError, 'Must provide only one of config_file or config_string.'
          end
          if !raw_opts[:config_file] && !raw_opts[:config_string]
Severity: Minor
Found in lib/gems/baw-workers/lib/baw_workers/jobs/analysis/payload.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 alphabetical_paginator has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def alphabetical_paginator(current_page = 'a', window_size = 1, index_size = 1)
    raise if window_size < 1
    raise if index_size < 1

    other = AlphabeticalPaginatorQuery::OTHER #"\u{1F30F}"
Severity: Minor
Found in app/helpers/alphabetical_paginator_helper.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 safe_result has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def safe_result(promise, index:)
    return 'unknown' if promise.pending?

    # result returns a tuple (an array) of
    # [fulfilled?, value, reason]
Severity: Minor
Found in app/controllers/status_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 info_hash has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

  def self.info_hash(identifier, rails_identifier)
    tzinfo_tz = TimeZoneHelper.tzinfo_class(identifier)
    rails_tz = TimeZoneHelper.ruby_tz_class(rails_identifier)

    return nil unless tzinfo_tz
Severity: Minor
Found in app/modules/time_zone_helper.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_integer has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def validate_integer(value, min = nil, max = nil)
      raise CustomErrors::FilterArgumentError, 'Value must not be blank' if value.blank?
      if value.blank? || value != value.to_i
        raise CustomErrors::FilterArgumentError, "Value must be an integer, got #{value}"
      end
Severity: Minor
Found in app/modules/filter/validate.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 modify_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def modify_command(source, target)
      source = Pathname(source)
      target = Pathname(target)
      raise ArgumentError, "Source is not a png file: #{source}" unless source.extname == '.png'
      raise ArgumentError, "Target is not a png file: : #{target}" unless target.extname == '.png'
Severity: Minor
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/image_image_magick.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 hash_sha256_io has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def hash_sha256_io(io)
      unless io_ish?(io)
        raise ArgumentError,
              "io not an IO, it is an #{io.class}"
      end
Severity: Minor
Found in lib/gems/baw-workers/lib/baw_workers/io.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 check_source has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

    def check_source(path)
      raise Exceptions::FileNotFoundError, 'Source path was empty or nil' if path.nil? || (path.is_a?(String) && path.empty?)
      path = Pathname(path)

      # Maybe worth resolving symlinks to a realpath, but currently does not cause any failures without
Severity: Minor
Found in lib/gems/baw-audio-tools/lib/baw_audio_tools/audio_base.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 normalise_datetime has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

      def normalise_datetime(value)
        raise ArgumentError, 'Expected value to be a ActiveSupport::TimeWithZone, got blank.' if value.blank?

        return value if value.is_a?(ActiveSupport::TimeWithZone)

Severity: Minor
Found in lib/gems/baw-workers/lib/baw_workers/validation.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 format_command has a Cognitive Complexity of 6 (exceeds 5 allowed). Consider refactoring.
Open

        def self.format_command(opts, command_opts)
          command_format = opts[:command_format].dup

          command_placeholders = BawWorkers::Jobs::Analysis::Runner.extract_command_placeholders(opts)
          allowed_placeholders = BawWorkers::Jobs::Analysis::Payload::COMMAND_PLACEHOLDERS
Severity: Minor
Found in lib/gems/baw-workers/lib/baw_workers/jobs/analysis/runner.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