Showing 419 of 859 total issues
Consider simplifying this complex logical expression. Open
Open
if ( ( ( $target[0].id !== $.datepicker._mainDivId &&
$target.parents("#" + $.datepicker._mainDivId).length === 0 &&
!$target.hasClass($.datepicker.markerClassName) &&
!$target.closest("." + $.datepicker._triggerClass).length &&
$.datepicker._datepickerShowing && !($.datepicker._inDialog && $.blockUI) ) ) ||
Consider simplifying this complex logical expression. Open
Open
if(!(/^(document|window|parent)$/).test(o.containment)) {
ce = $(o.containment)[0];
co = $(o.containment).offset();
over = ($(ce).css("overflow") !== "hidden");
Consider simplifying this complex logical expression. Open
Open
if (this.floating && horizontalDirection) {
return ((horizontalDirection === "right" && isOverRightHalf) || (horizontalDirection === "left" && !isOverRightHalf));
} else {
return verticalDirection && ((verticalDirection === "down" && isOverBottomHalf) || (verticalDirection === "up" && !isOverBottomHalf));
}
Function template
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_.template = function(text, data, settings) {
var render;
settings = _.defaults({}, settings, _.templateSettings);
// Combine delimiters into one regular expression via alternation.
Function _makeResizable
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_makeResizable: function() {
var that = this,
options = this.options,
handles = options.resizable,
// .ui-resizable has position: relative defined in the stylesheet
Function _eventHandler
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_eventHandler: function( event ) {
var options = this.options,
active = this.active,
clicked = $( event.currentTarget ),
clickedIsActive = clicked[ 0 ] === active[ 0 ],
Function setupParams
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setupParams: function(paramSize, params, useRegister) {
var options = [], contexts = [], types = [], param, inverse, program;
options.push("hash:" + this.popStack());
Method characters
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def characters
featured_chars = @main_noko.css('table div.picSurround a[href*="character/"]').map {|x|
x['href'].scan(/character\/(\d+)/)
}.flatten.map(&:to_i)
Function lifeSpentOnAnimeFmt
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
lifeSpentOnAnimeFmt: function () {
var days, hours, minutes, months, str, years;
minutes = this.get('userInfo.lifeSpentOnAnime');
if (minutes === 0) { return "0 minutes"; }
Function _attachments
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_attachments: function(input, inst) {
var showOn, buttonText, buttonImage,
appendText = this._get(inst, "appendText"),
isRTL = this._get(inst, "isRTL");
Function purchasePro
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
purchasePro: function() {
if (this.get('disablePurchase')) { return; }
var self = this;
var tokenCallback = function(res) {
Method br_to_p
has a Cognitive Complexity of 13 (exceeds 5 allowed). Consider refactoring. Open
Open
def br_to_p(src)
src = '<p>' + src.gsub(/<br>\s*<br>/, '</p><p>') + '</p>'
doc = Nokogiri::HTML.fragment src
doc.traverse do |x|
next x.remove if x.name == 'br' && x.previous.nil?
- 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 reposition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
tip.css('visibility', 'hidden').show();
Function bridge
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.widget.bridge = function( name, object ) {
var fullName = object.prototype.widgetFullName || name;
$.fn[ name ] = function( options ) {
var isMethodCall = typeof options === "string",
args = slice.call( arguments, 1 ),
Function init
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
init : function (scope, method, options) {
Foundation.inherit(this, 'data_options');
var self = this;
if (typeof method === 'object') {
Function reposition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
tip.css('visibility', 'hidden').show();
Function reposition
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
reposition : function (target, tip, classes) {
var width, nub, nubHeight, nubWidth, column, objPos;
tip.css('visibility', 'hidden').show();
Function _optionDatepicker
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_optionDatepicker: function(target, name, value) {
var settings, date, minDate, maxDate,
inst = this._getInst(target);
if (arguments.length === 2 && typeof name === "string") {
Method broadcast
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.broadcast(data)
if data[:action_type] == "created_profile_comment"
# Create the story and substory for this action,
# TODO: generate notifications
# and return the story.
Method search
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def search
respond_to do |format|
format.json do
query = params.require(:query)