Showing 93 of 184 total issues
Method initialize
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
def initialize(user)
# The can method is used to define permissions and requires two arguments.
# The first one is the action you're setting the permission for, the second one
# is the class of object you're setting it on.
- 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 init
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
methods.init = function (options) {
if (options && !(options instanceof Object)) {
throw new Error("If defined, eventMap should be an object");
}
Class CallbacksController
has 22 methods (exceeds 20 allowed). Consider refactoring. Open
class Api::CallbacksController < Devise::OmniauthCallbacksController
# this may be needed, but haven't needed it yet.
#skip_before_filter :verify_authenticity_token, :only => [:open_id]
# NOTES
Function LoginCtrl
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
// WARNING: Cookies required for this to work
function checkLogin() {
Authenticator.checkLogin();
Function link
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function (scope, $element, attributes, controller) {
// assign a unique id to scope
scope.id = Number.Unique();
Method modify_mp3splt
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.modify_mp3splt(source, target, modify_parameters = {})
raise ArgumentError, "Source is not a mp3 file: #{File.basename(source)}" unless source.match(/\.mp3$/)
raise ArgumentError, "Target is not a mp3 file: : #{File.basename(target)}" unless target.match(/\.mp3$/)
raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
raise ArgumentError, "Target exists: #{File.basename(target)}" if File.exists? target
- 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 modify_ffmpeg
has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring. Open
def self.modify_ffmpeg(source, target, modify_parameters = {})
# ffmpeg is the catch-all, so it will do anything specified in modify_parameters.
raise ArgumentError, "Source is a wavpack file, use wavpack to convert to .wav first instead: #{File.basename(source)}" if source.match(/\.wv$/)
- 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 modify_sox
has a Cognitive Complexity of 17 (exceeds 5 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
- 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 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
function createBox($parent, contextData, width, height, top, left) {
if (contextData === undefined) {
throw "Context data must be given";
}
Function LoginCtrl
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
function LoginCtrl($scope, $http, $location, authService, AuthenticationProviders, Authenticator) {
// WARNING: Cookies required for this to work
function checkLogin() {
Authenticator.checkLogin();
- 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 a Cognitive Complexity of 16 (exceeds 5 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? ?
- 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 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create
success = nil
post_data = request.raw_post
Method twitter_info
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def twitter_info(raw)
twitter_name = raw['info'].include?('name') ? raw['info']['name'] : ''
twitter_nickname = raw['info'].include?('nickname') ? raw['info']['nickname'] : ''
twitter_any_name = twitter_name.blank? ? (twitter_nickname.blank? ? '' : twitter_nickname) : twitter_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 modify
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
def self.modify(source, target, modify_parameters)
raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
raise ArgumentError, "Target exists: #{File.basename(target)}" unless !File.exists? target
raise ArgumentError "Source and Target are the same file: #{File.basename(target)}" unless source != target
- 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_or_update_user
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
def create_or_update_user(canonical_data, user=nil)
authorization = nil
#uid = canonical_data[:canonical][:uid] # very likely to be present
#name = canonical_data[:canonical][:name] # might be present
Function link
has 44 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function (scope, element, attrs) {
var $control = element,
$player = $control.children('div'),
cls = 'pause';
Method modify_wavpack
has a Cognitive Complexity of 14 (exceeds 5 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
- 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 link
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
link: function (scope, elem, attrs) {
//once Angular is started, remove class:
elem.removeClass('waiting-for-angular');
var login = elem.find('#login-holder');
Method modify_mp3splt
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.modify_mp3splt(source, target, modify_parameters = {})
raise ArgumentError, "Source is not a mp3 file: #{File.basename(source)}" unless source.match(/\.mp3$/)
raise ArgumentError, "Target is not a mp3 file: : #{File.basename(target)}" unless target.match(/\.mp3$/)
raise ArgumentError, "Source does not exist: #{File.basename(source)}" unless File.exists? source
raise ArgumentError, "Target exists: #{File.basename(target)}" if File.exists? target
Function filter
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Array.prototype.filter = function (fun /*, thisp */) {
"use strict";
if (this == null)
throw new TypeError();
- 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"