Showing 93 of 184 total issues
Method get_parameter
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
def self.get_parameter(parameter, modify_parameters, include_separator = true, format = :string)
# need to cater for the situation where modify_parameters contains strings (we want symbols)
modify_parameters.keys.each do |key|
modify_parameters[(key.to_sym rescue key) || key] = modify_parameters.delete(key)
end
- 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 open_id_info
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
def open_id_info(raw)
open_id_name = raw.info.include?(:name) ? raw.info.name : ''
open_id_nickname = raw.info.include?(:nickname) ? raw.info.nickname : ''
open_id_any_name = open_id_nickname.blank? ?
Function popUpWindow
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
baw.popUpWindow = function popUpWindow(provider_url, width, height, callback) {
var screenX = typeof window.screenX != 'undefined' ? window.screenX : window.screenLeft,
screenY = typeof window.screenY != 'undefined' ? window.screenY : window.screenTop,
outerWidth = typeof window.outerWidth != 'undefined' ? window.outerWidth : document.body.clientWidth,
outerHeight = typeof window.outerHeight != 'undefined' ? window.outerHeight : (document.body.clientHeight - 22),
Function secondsToDurationFormat
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
baw.secondsToDurationFormat = function secondsToDurationFormat(seconds) {
if (typeof seconds != 'number') {
seconds = parseFloat(seconds);
}
Function ProjectCtrl
has 8 arguments (exceeds 4 allowed). Consider refactoring. Open
function ProjectCtrl($scope, $location, $resource, $routeParams, Project, Site, Photo, AudioEvent) {
Method browser_id
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def browser_id
# https://developer.mozilla.org/en-US/docs/Persona/Remote_Verification_API
# this callback will have an assertion included. The assertion should be POST'ed with the
# audience to the remote verification API
- 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 qualified_const_get
has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring. Open
def qualified_const_get(str)
path = str.to_s.split('::')
from_root = path[0].empty?
if from_root
from_root = []
- 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 SiteCtrl
has 7 arguments (exceeds 4 allowed). Consider refactoring. Open
function SiteCtrl($scope, $resource, $routeParams, Project, Site, AudioRecording, AudioEvent) {
Function ensureMapDisplayedCorrectlyNoTimeout
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$scope.ensureMapDisplayedCorrectlyNoTimeout = function (map, latLng, zoom, marker, markerContent, markerTitle) {
Function open
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
infoWindow.open = function open(a1, a2, a3, a4, a5, a6) {
Method run_once
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
def run_once(script_name, script_version, script_content, script_file, script_settings, audio_full_paths)
Method download
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def download
project_id = nil
if params[:project_id]
project_id = Integer(params[:project_id].to_s, 10)
- 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 LoginCtrl
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
Method create_audio_segment
has a Cognitive Complexity of 8 (exceeds 5 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)
- 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 ensureMapDisplayedCorrectly
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
$scope.ensureMapDisplayedCorrectly = function (map, latLng, zoom, marker, markerContent, markerTitle) {
Method generate_spectrogram
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.generate_spectrogram(modify_parameters = {})
# first check if a cached spectrogram matches the request
target_file = Cache::cached_spectrogram_file modify_parameters
- 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 createBox
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function createBox($parent, contextData, width, height, top, left) {
Function setBox
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
methods.setBox = function setBox(id, top, left, height, width, selected) {
Method create_new_audiorecording
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create_new_audiorecording(post_params)
Net::HTTP.start(@host, @port) do |http|
auth_token = request_login(http)
- 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 whenDefaults
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function whenDefaults(resourceName, singularResourceName, id, controllerMany, controllerOne) {