Showing 93 of 184 total issues
Method generate
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
def self.generate(source, target, modify_parameters)
raise ArgumentError, "Target path for spectrogram generation already exists: #{target}." unless !File.exist?(target)
# sample rate
sample_rate_param = modify_parameters.include?(:sample_rate) ? modify_parameters[:sample_rate].to_i : 11025
- 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_raw_query
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_raw_query
recordings_search = AudioRecording.scoped
if self.invalid?
Method modify_sox
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.modify_sox(source, target, modify_parameters = {})
raise ArgumentError, "Source is not a mp3 or wav file: #{File.basename(source)}" unless source.match(/\.mp3|\.wav$/)
raise ArgumentError, "Target is not a mp3 or wav file: : #{File.basename(target)}" unless target.match(/\.mp3|\.wav$/)
raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
raise ArgumentError, "Target exists: #{File.basename(target)}" unless !File.exists? target
Function updatePlayer
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
var updatePlayer = function () {
$player.jPlayer({
// Flash fallback for outdated browser not supporting HTML5 audio/video tags
// http://jplayer.org/download/
swfPath: 'assets/',
Function radioInputType
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function radioInputType(scope, element, attr) {
// make the name unique, if not defined
if (baw.angularCopies.isUndefined(attr.name)) {
element.attr('name', Number.Unique());
}
Method modify_wavpack
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.modify_wavpack(source, target, modify_parameters = {})
raise ArgumentError, "Source is not a wavpack file: #{File.basename(source)}" unless source.match(/\.wv$/)
raise ArgumentError, "Target is not a wav file: : #{File.basename(target)}" unless target.match(/\.wav$/)
raise ArgumentError "Source and Target are the same file: #{File.basename(target)}" unless source != target
Function getLowestCountItem
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.getLowestCountItem = function (containingObject) {
console.log('called $scope.getLowestCountItem', containingObject);
// find minimum
var minCount = null;
angular.forEach(containingObject, function (value, key) {
Function verifyPreface
has 35 lines of code (exceeds 25 allowed). Consider refactoring. Open
$scope.verifyPreface = function verifyPreface() {
$scope.errors.length = 0;
if ($scope.results.consented !== true) {
$scope.errors.push("You must consent to participate in this experiment.");
Function SiteCtrl
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
function SiteCtrl($scope, $resource, $routeParams, Project, Site, AudioRecording, AudioEvent) {
var siteResource = Site;
var routeArgs = {siteId: $routeParams.siteId};
$scope.downloadAnnotationLink = AudioEvent.csvLink({siteId: $routeParams.siteId});
Function Annotation
has 33 lines of code (exceeds 25 allowed). Consider refactoring. Open
baw.Annotation = function Annotation(localIdOrResource, audioRecordingId) {
var localId = typeof(localIdOrResource) === "number" ? localIdOrResource : undefined;
var resource;
if (localIdOrResource instanceof Object && localIdOrResource.constructor.name == "Resource") {
Function PhotoCtrl
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function PhotoCtrl($scope, $resource, $routeParams, Photo) {
var photoResource = Photo;
var routeArgs = {photoId: $routeParams.photoId};
Function calculateFlashes
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function calculateFlashes() {
// work out the scale of flash cards that need to be shown
var adjustedPPS = PPS * $scope.stepResults.compression,
segmentDuration = $scope.SPECTROGRAM_WIDTH / adjustedPPS;
Method tags_are_strings
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def tags_are_strings
if self.tags.is_a?(Array)
unless self.tags.blank?
self.tags.each do |tag|
unless tag.is_a?(String)
- 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 copy_file
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def copy_file(source_path,full_move_paths)
unless source_path.nil? || full_move_paths.size < 1
success = []
fail = []
- 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 facebook_info
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def facebook_info(raw)
facebook_name = raw.info.include?(:name) ? raw.info.name : ''
facebook_nickname = raw.info.include?(:nickname) ? raw.info.nickname : ''
facebook_any_name = facebook_name.blank? ? (facebook_nickname.blank? ? '' : facebook_nickname) : facebook_name
- 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 params_are_hashes
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def params_are_hashes
self.pre_params = SavedSearchStorePre.new(self.pre_params) if self.pre_params.is_a?(Hash)
self.body_params = SavedSearchStoreBody.new(self.body_params) if self.body_params.is_a?(Hash)
self.post_params = SavedSearchStorePost.new(self.post_params) if self.post_params.is_a?(Hash)
- 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
Function mousemove
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
var mousemove = function (e) {
var $thisMouseMove = $(this);
var dataMouseMove = $thisMouseMove.data('drawboxes');
Method initialize
has 9 arguments (exceeds 4 allowed). Consider refactoring. Open
def initialize(host, port, config_file_name, login_email, login_password, endpoint_create, endpoint_login, endpoint_record_move, base_dir)
Method create_audio_segment
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.create_audio_segment(modify_parameters = {})
# first check if a cached audio file matches the request
target_file = Cache::cached_audio_file modify_parameters
target_existing_paths = Cache::existing_paths(Cache::cached_audio_storage_paths,target_file)
Function Angular
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
baw.angularCopies = new (function Angular() {
this.fixedEncodeURIComponent = function fixedEncodeURIComponent(str) {
str = str || "";
return encodeURIComponent(str)
.replace(/!/g, '%21')