Showing 419 of 859 total issues
Function eq
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var eq = function(a, b, aStack, bStack) {
// Identical objects are equal. `0 === -0`, but they aren't identical.
// See the Harmony `egal` proposal: http://wiki.ecmascript.org/doku.php?id=harmony:egal.
if (a === b) return a !== 0 || 1 / a == 1 / b;
// A strict comparison is necessary because `null == undefined`.
Function _generatePosition
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_generatePosition: function(event) {
var containment, co, top, left,
o = this.options,
scroll = this.cssPosition === "absolute" && !( this.scrollParent[ 0 ] !== document && $.contains( this.scrollParent[ 0 ], this.offsetParent[ 0 ] ) ) ? this.offsetParent : this.scrollParent,
File garlic.js
has 263 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
Garlic.js allows you to automatically persist your forms' text field values locally,
until the form is submitted. This way, your users don't lose any precious data if they
accidentally close their tab or browser.
Function keydown
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
keydown: function( event ) {
/*jshint maxcomplexity:25*/
var allowed, curVal, newVal, step,
index = $( event.target ).data( "ui-slider-handle-index" );
Function _generateMonthYearHeader
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_generateMonthYearHeader: function(inst, drawMonth, drawYear, minDate, maxDate,
secondary, monthNames, monthNamesShort) {
var inMinYear, inMaxYear, month, years, thisYear, determineYear, year, endYear,
changeMonth = this._get(inst, "changeMonth"),
Method find_by_ids
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.find_by_ids(story_ids, current_user)
stories = Story.where(id: story_ids)
.for_user(current_user)
.preload(:target, substories: %i(target))
.includes(:user, :substories,
File bootstrap-tooltip.js
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* ===========================================================
* bootstrap-tooltip.js v2.3.2
* http://twitter.github.com/bootstrap/javascript.html#tooltips
* Inspired by the original jQuery.tipsy by Jason Frame
* ===========================================================
File anime.rb
has 258 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
class Anime < ActiveRecord::Base
PG_TITLE_SCOPE = %i(title alt_title)
AGE_RATINGS = %w(G PG13 PG R18+)
Function refresh
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
refresh: function(init) {
var el = this.element;
var o = this.options;
var menu = this.menu;
var checkboxContainer = this.checkboxContainer;
Function _mouseStart
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_mouseStart: function(event) {
var that = this,
options = this.options;
this.opos = [event.pageX, event.pageY];
Method create_or_update_from_hash
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def self.create_or_update_from_hash hash
# First the creation logic
# TODO: stop hard-coding the ID column
manga = Manga.find_by(mal_id: hash[:external_id])
if manga.nil? && Manga.where(romaji_title: hash[:romaji_title]).count > 1
- 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 myanimelist
has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring. Open
Open
def myanimelist
file = params.require(:file)
# Prepare the file
# Check the magic number for gzip because some browsers are stupid
- 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 keydown
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
keydown: function( event ) {
/*jshint maxcomplexity:15*/
if ( this.element.prop( "readOnly" ) ) {
suppressKeyPress = true;
suppressInput = true;
Function _refreshValue
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_refreshValue: function() {
var lastValPercent, valPercent, value, valueMin, valueMax,
oRange = this.options.range,
o = this.options,
that = this,
Function _processTabs
has 52 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_processTabs: function() {
var that = this;
this.tablist = this._getList()
.addClass( "ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all" )
Function onTouchEnd
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
FastClick.prototype.onTouchEnd = function(event) {
'use strict';
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
if (!this.trackingClick) {
Function onTouchEnd
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
FastClick.prototype.onTouchEnd = function(event) {
'use strict';
var forElement, trackingClickStart, targetTagName, scrollParent, touch, targetElement = this.targetElement;
if (!this.trackingClick) {
Method apply!
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def apply!
table = (list == "manga") ? Manga : Anime
media_list = table.where(mal_id: data.map {|x| x[:mal_id] }).index_by(&:mal_id)
failures = []
count = 0
Function _touchMove
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Flipsnap.prototype._touchMove = function(event) {
var self = this;
if (!self.scrolling || gestureStart) {
return;
Function _touchMove
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Flipsnap.prototype._touchMove = function(event) {
var self = this;
if (!self.scrolling || gestureStart) {
return;