Showing 213 of 257 total issues
Class AudioBase
has 25 methods (exceeds 20 allowed). Consider refactoring. Open
class AudioBase
attr_reader :audio_defaults, :logger, :temp_dir, :timeout_sec,
:audio_ffmpeg, :audio_mp3splt, :audio_sox,
:audio_wavpack, :audio_shntool, :audio_waveform,
:audio_wac2wav
Method check_request_parameters
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
def check_request_parameters(audio_recording, request_params)
original_duration = audio_recording.duration_seconds
# offsets
start_offset = nil
Method show_results
has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring. Open
def show_results(is_head_request, analysis_job_item, results_path, api_opts)
# assertion: audio_recordings must be in the specified job - authorization should filter out those that aren't
# extract parameters for analysis response
audio_recording = analysis_job_item.audio_recording
- Read upRead up
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 20 (exceeds 5 allowed). Consider refactoring. Open
def create
#do_new_resource - custom new audio_recording
#do_set_attributes(audio_recording_params) - custom set attributes
@audio_recording = AudioRecording.build_by_file_hash(audio_recording_params)
get_project_site
- Read upRead up
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
File audio_event.rb
has 280 lines of code (exceeds 250 allowed). Consider refactoring. Open
class AudioEvent < ApplicationRecord
# relations
belongs_to :audio_recording, inverse_of: :audio_events
belongs_to :audio_event_import, inverse_of: :audio_events, optional: true
has_many :taggings, inverse_of: :audio_event, strict_loading: false
Method download
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
def download
params_cleaned = CleanParams.perform(audio_event_download_params)
is_authorized = false
Method filter_settings
has 67 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.filter_settings(is_system = false)
fields = [
:id, :analysis_job_id, :audio_recording_id,
:created_at, :queued_at, :work_started_at, :completed_at,
:queue_id,
Method filter_settings
has 65 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.filter_settings
{
valid_fields: [:id, :audio_recording_id,
:start_time_seconds, :end_time_seconds,
:low_frequency_hertz, :high_frequency_hertz,
Method annotation_download
has a Cognitive Complexity of 19 (exceeds 5 allowed). Consider refactoring. Open
def annotation_download
selected_params = annotation_download_params
selected_project_id = selected_params[:selected_project_id]
selected_site_id = selected_params[:selected_site_id]
- Read upRead up
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
File validate.rb
has 272 lines of code (exceeds 250 allowed). Consider refactoring. Open
require 'active_support/concern'
# Provides common validations for composing queries.
module Filter
module Validate
File schema.rb
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Api
# The OpenAPI schema for the API.
module Schema
extend Helpers
File media_metadata.rb
has 268 lines of code (exceeds 250 allowed). Consider refactoring. Open
module Api
class MediaMetadata
# accepts '111', '11.123', not '.11'
OFFSET_REGEXP = /^-?(\d+\.)?\d+$/
Method check_uploader
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def check_uploader
#do_authorize_class - not used, this action does a custom auth
get_project_site
# current user should be the harvester
- Read upRead up
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 filter_settings
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def self.filter_settings
{
valid_fields: [:id, :name, :description, :creator_id,
:created_at,
:updater_id,
- Read upRead up
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
Class Config
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Config
class << self
@is_resque_worker = false
# Is this a resque_worker?
# @return [Boolean]
Method registered
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.registered(app)
app.get '/statuses' do
@start = params[:start].to_i
Method filter_settings
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.filter_settings(priority_algorithm = nil)
result = {
valid_fields: [
:id, :dataset_id, :audio_recording_id, :start_time_seconds,
:end_time_seconds, :order, :creator_id, :created_at, :priority
File audio_ffmpeg.rb
has 261 lines of code (exceeds 250 allowed). Consider refactoring. Open
module BawAudioTools
# Used to manipulate the ffmpeg command line tool
class AudioFfmpeg
ERROR_FRAME_SIZE_1 = 'Could not find codec parameters for stream [0-9]+ \\(Audio\\: [a-zA-Z0-9]+\\, [0-9]+ channels\\, [a-zA-Z0-9]+\\)\\: unspecified frame size'
ERROR_FRAME_SIZE_2 = 'Failed to read frame size: Could not seek to [0-9]+\\.'
Method get_extra_options
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def get_extra_options(extra_options)
extra_options_formatted = ''
case extra_options
when Hash
extra_options.each_pair do |_key, value|
- Read upRead up
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
File public_controller.rb
has 254 lines of code (exceeds 250 allowed). Consider refactoring. Open
class PublicController < ApplicationController
skip_authorization_check only: [
:index,
:website_status,
:credits,