Showing 419 of 859 total issues
Function onMouse
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
FastClick.prototype.onMouse = function(event) {
'use strict';
// If a target element was never set (because a touch event was never fired) allow the event
if (!this.targetElement) {
- 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
Avoid deeply nested control flow statements. Open
if ((callback && callback !== ev.callback && callback !== ev.callback._callback) ||
(context && context !== ev.context)) {
retain.push(ev);
}
Avoid deeply nested control flow statements. Open
if (type == _click) {
operate(self, false, true);
// Hover state
} else if (labelHover) {
Function section
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
function section(nodes, id, method, start, end, tags) {
Avoid deeply nested control flow statements. Open
if (lookAhead("'")) {
output += "'";
} else {
literal = true;
}
Avoid deeply nested control flow statements. Open
switch (col) {
case 0: calender += " ui-datepicker-group-first";
cornerClass = " ui-corner-" + (isRTL ? "right" : "left"); break;
case numMonths[1]-1: calender += " ui-datepicker-group-last";
cornerClass = " ui-corner-" + (isRTL ? "left" : "right"); break;
Function avatar
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
export function avatar(user, size) {
var avatarUrl = user.get("avatarTemplate").replace('{size}', size);
if (size !== "thumb") {
const pattern = /\.[a-zA-Z]+\?/;
// handle Facebook/weird case
- 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
Avoid deeply nested control flow statements. Open
if(data) { data.key = key; }
Avoid deeply nested control flow statements. Open
if (this.terminals_[p] && p > 2) {
expected.push("'" + this.terminals_[p] + "'");
}
Function invokePartial
has 6 arguments (exceeds 4 allowed). Consider refactoring. Open
invokePartial: function(partial, name, context, helpers, partials, data) {
Function franchiseAnime
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
franchiseAnime: function() {
var anime = [];
this.getEach("anime").forEach(function(animeSet) {
anime = anime.concat(animeSet.toArray());
});
- 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 8 (exceeds 5 allowed). Consider refactoring. Open
def create
return error! "Invalid message type", 400 unless params[:type].in?(['message', 'action', 'notice', nil])
return error! "Message is required", 400 unless params.has_key?(:message)
return error! "Not an administrator", 403 if params[:type] == 'notice' && !current_user.admin?
return error! "User is banned", 403 if current_user.ninja_banned?
- 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 destroy
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def destroy
return error! "Mods can only remove regular users from the group", 403 unless current_user.admin? || current_member.admin? || (current_member.mod? && membership.pleb?) || current_user.id == membership.user_id
return error! "You must promote another admin", 400 if membership.admin? && !group.can_admin_resign?
return error! "Wrong user", 403 if current_member.pleb? && current_user.id != membership.user_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
Method create
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def create
params.permit(:token, :plan_id, :gift, :gift_to, :gift_message)
if params[:token].blank?
return render(text: "Didn't get credit card details from Stripe", status: 400)
- 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 embed_media
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def embed_media
html = Nokogiri::HTML.fragment(@processed)
html.css("a").each do |a|
href = a["href"]
next if href =~ IMAGE_REGEX && filesize(href) > MAX_IMAGE_FILE_SIZE
- 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 index
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def index
if params[:followed_by] || params[:followers_of]
if params[:followed_by]
users = User.find(params[:followed_by]).following
elsif params[:followers_of]
- 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
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def update
authenticate_user!
user = User.find(params[:id])
changes = params[:current_user] || params[: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 8 (exceeds 5 allowed). Consider refactoring. Open
def self.create_or_update_from_hash(hash)
person = Person.create_or_update_from_hash(hash) unless hash[:name].blank?
if hash[:character] ### Voice Actor
# TODO: overwrite castings when adding the first voice actor if there's already a casting
- 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 each
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def each
status_map = "ListImport::MyAnimeList::#{@media_type.upcase}_STATUS_MAP".constantize
@data.each do |row|
mal_id = (row['series_animedb_id'] || row['manga_mangadb_id']).to_i
media = @db.where(mal_id: mal_id).first
- 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 recompute_bayesian_ratings!
has a Cognitive Complexity of 8 (exceeds 5 allowed). Consider refactoring. Open
def recompute_bayesian_ratings!
#
# Bayesian rating:
#
# r * v / (v + m) + c * m / (v + m)
- 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"