Showing 419 of 859 total issues
Method create_or_update_from_hash
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def self.create_or_update_from_hash(hash)
character = Character.find_by(mal_id: hash[:external_id])
# NOTE: Ideally we'd find by name+series but that doesn't seem possible
# Should we name+role?
- 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
Consider simplifying this complex logical expression. Open
if (options.data == null && model && (method === 'create' || method === 'update' || method === 'patch')) {
params.contentType = 'application/json';
params.data = JSON.stringify(options.attrs || model.toJSON(options));
}
Consider simplifying this complex logical expression. Open
if(
inst.options.greedy &&
!inst.options.disabled &&
inst.options.scope === draggable.options.scope &&
inst.accept.call(inst.element[0], (draggable.currentItem || draggable.element)) &&
Consider simplifying this complex logical expression. Open
if ( ( this.options.values.length === 2 && this.options.range === true ) &&
( ( index === 0 && newVal > otherVal) || ( index === 1 && newVal < otherVal ) )
) {
newVal = otherVal;
}
Consider simplifying this complex logical expression. Open
if ( tab.hasClass( "ui-state-disabled" ) ||
// tab is already loading
tab.hasClass( "ui-tabs-loading" ) ||
// can't switch durning an animation
this.running ||
Consider simplifying this complex logical expression. Open
similar_anime.push(sim) if sim &&
similar_anime.length < limit &&
(!self.sfw? || (self.sfw? && sim.sfw?)) &&
!exclude.include?(sim)
Function init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
init : function (scope, libraries, method, options, response) {
Function ho
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
ho: function(val, cx, partials, text, tags) {
Function _dialogDatepicker
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
_dialogDatepicker: function(input, date, onSelect, settings, pos) {
Function init
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
init : function (scope, libraries, method, options, response) {
Function substituteTimeAgo
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
function substituteTimeAgo(string, number, withoutSuffix, isFuture, lang) {
Function popEmberData
has 5 arguments (exceeds 4 allowed). Consider refactoring. Open
popEmberData: function(key, path, object, store, edQuery) {
Function scrollHandler
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
scrollHandler: function() {
var amount, top;
top = $(window).scrollTop();
amount = Math.abs(top - this.lastScroll);
if (top > this.detachPoint) {
- 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 toggleLike
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
toggleLike: function() {
if (!this.get('currentUser.isSignedIn')) {
return this.transitionTo('sign-up');
}
- 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 update_manga_library_entry_using_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_manga_library_entry_using_params(manga_library_entry, params)
[:status, :rating, :private, :notes, :chapters_read, :volumes_read, :rereading, :reread_count].each do |x|
if params[:manga_library_entry].has_key? x
manga_library_entry[x] = params[:manga_library_entry][x]
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 check_user_authentication
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def check_user_authentication
if cookies[OLD_COOKIE]
user = User.where(authentication_token: cookies[OLD_COOKIE]).first
cookies.delete("auth_token", domain: :all)
sign_in(user) if user
- 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 find_for_facebook_oauth
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.find_for_facebook_oauth(auth, signed_in_resource=nil)
# Try to find a user already associated with the Facebook ID.
user = User.where(facebook_id: auth.uid).first
return user if user
- 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_from_hash
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def self.create_or_update_from_hash(hash)
person = Person.find_by(mal_id: hash[:external_id])
if person.nil? && Person.where(name: hash[:name]).count > 1
logger.error "Count not find unique Person by name='#{hash[:name]}'."
return
- 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 update_library_entry_using_params
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def update_library_entry_using_params(library_entry, params)
[:status, :rating, :private, :episodes_watched, :rewatching, :rewatch_count, :notes].each do |x|
if params[:library_entry].has_key? x
library_entry[x] = params[:library_entry][x]
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 follow
has a Cognitive Complexity of 7 (exceeds 5 allowed). Consider refactoring. Open
def follow
authenticate_user!
user = User.find(params[:user_id])
if user != current_user
- 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"