Showing 419 of 859 total issues
Function save
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
save: function(key, val, options) {
var attrs, method, xhr, attributes = this.attributes;
// Handle both `"key", value` and `{key: value}` -style arguments.
if (key == null || typeof key === 'object') {
Function left
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
left: function( position, data ) {
var within = data.within,
withinOffset = within.offset.left + within.scrollLeft,
outerWidth = within.width,
offsetLeft = within.isWindow ? within.scrollLeft : within.offset.left,
Function _refreshItems
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_refreshItems: function(event) {
this.items = [];
this.containers = [this];
Function _size
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
_size: function() {
// If the user has resized the dialog, the .ui-dialog and .ui-dialog-content
// divs will both have width and height set, so we need to reset them
var nonContentHeight, minContentHeight, maxContentHeight,
options = this.options;
Function adjust
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
function adjust() {
var height, original;
if (mirrored !== ta) {
initMirror();
Method as_json
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def as_json
resource_fields = {}
linked = {}
json = {
title => resource_fields,
Method myanimelist
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def myanimelist
file = params.require(:file)
# Prepare the file
# Check the magic number for gzip because some browsers are stupid
Method recompute_bayesian_ratings!
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def recompute_bayesian_ratings!
#
# Bayesian rating:
#
# r * v / (v + m) + c * m / (v + m)
Method from_library_entry
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
def self.from_library_entry(l)
return unless l.valid?
if l.persisted?
Function onTouchStart
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
FastClick.prototype.onTouchStart = function(event) {
'use strict';
var targetElement, touch, selection;
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
- 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 onTouchStart
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
FastClick.prototype.onTouchStart = function(event) {
'use strict';
var targetElement, touch, selection;
// Ignore multiple touches, otherwise pinch-to-zoom is prevented if both fingers are on the FastClick element (issue #111).
- 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 clean_desc
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def clean_desc(desc)
desc = Nokogiri::HTML.fragment br_to_p(desc)
desc.css('.spoiler').each do |x|
x.name = 'span'
x.inner_html = x.css('.spoiler_content').inner_html
- 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 data
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
def data
if @data.nil?
@data = []
# wrap+flatten+compact to ensure we get an array with no nils
- 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 events
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
events : function () {
var self = this;
if (Modernizr.touch) {
$(this.scope)
Function charCount
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
$.fn.charCount = function(options){
// default configuration properties
var defaults = {
allowed: 140,
Function initializeRatingInterface
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
this.initializeRatingInterface = function(element, type) {
var anime_slug, i, rating, star, _i;
return;
rating = parseInt(element.attr("data-rating"));
anime_slug = element.attr("data-anime-slug");
Function events
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
events : function () {
var self = this;
if (Modernizr.touch) {
$(this.scope)
Function option
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
option: function( key, value ) {
var options = key,
parts,
curOption,
i;
Function applyPlacement
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
, applyPlacement: function(offset, placement){
var $tip = this.tip()
, width = $tip[0].offsetWidth
, height = $tip[0].offsetHeight
, actualWidth
Function Duration
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
function Duration(duration) {
var data = this._data = {},
years = duration.years || duration.year || duration.y || 0,
months = duration.months || duration.month || duration.M || 0,
weeks = duration.weeks || duration.week || duration.w || 0,