Showing 840 of 1,637 total issues
Function chord
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.svg.chord = function() {
var source = d3_source, target = d3_target, radius = d3_svg_chordRadius, startAngle = d3_svg_arcStartAngle, endAngle = d3_svg_arcEndAngle;
function chord(d, i) {
var s = subgroup(this, source, d, i), t = subgroup(this, target, d, i);
return "M" + s.p0 + arc(s.r, s.p1, s.a1 - s.a0) + (equals(s, t) ? curve(s.r, s.p1, s.r, s.p0) : curve(s.r, s.p1, t.r, t.p0) + arc(t.r, t.p1, t.a1 - t.a0) + curve(t.r, t.p1, s.r, s.p0)) + "Z";
Consider simplifying this complex logical expression. Open
Open
if ( ( mappedTypes || origType === handleObj.origType ) &&
( !handler || handler.guid === handleObj.guid ) &&
( !tmp || tmp.test( handleObj.namespace ) ) &&
( !selector || selector === handleObj.selector || selector === "**" && handleObj.selector ) ) {
handlers.splice( j, 1 );
Function render
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
render: function(args) {
var graph = this.graph;
var points = args.points;
var point = points.filter( function(p) { return p.active } ).shift();
Function stackData
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
this.stackData = function() {
var data = this.series.active()
.map( function(d) { return d.data } )
.map( function(d) { return d.filter( function(d) { return this._slice(d) }, this ) }, this);
Function _setOption
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_setOption: function( key, value ) {
var i,
valsLength = 0;
if ( key === "range" && this.options.range === true ) {
Function blind
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
$.effects.effect.blind = function( o, done ) {
// Create element
var el = $( this ),
props = [ "position", "top", "bottom", "left", "right", "height", "width" ],
mode = $.effects.setMode( el, o.mode || "hide" ),
Function _setOption
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_setOption: function( key, value ) {
/*jshint maxcomplexity:15*/
var isDraggable, isResizable,
uiDialog = this.uiDialog;
Function onMousemove
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function onMousemove(datum, index) {
drag.stop = self._getClientXFromEvent(d3.event, drag);
var distanceTraveled = drag.stop - drag.start;
var frameAfterDrag = self.frameBeforeDrag.slice(0);
Function internalRemoveData
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function internalRemoveData( elem, name, pvt ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function _animate
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_animate: function( toShow, toHide, data ) {
var total, easing, duration,
that = this,
adjust = 0,
down = toShow.length &&
Function _determineDate
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_determineDate: function(inst, date, defaultDate) {
var offsetNumeric = function(offset) {
var date = new Date();
date.setDate(date.getDate() + offset);
return date;
Function _fnAjaxParameters
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _fnAjaxParameters( oSettings )
{
var iColumns = oSettings.aoColumns.length;
var aoData = [], mDataProp, aaSort, aDataSort;
var i, j;
Function _mouseCapture
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_mouseCapture: function( event ) {
var position, normValue, distance, closestHandle, index, allowed, offset, mouseOverHandle,
that = this,
o = this.options;
Function _toggle
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
_toggle: function( event, eventData ) {
var that = this,
toShow = eventData.newPanel,
toHide = eventData.oldPanel;
Function addEvent
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addEvent = (function () {
if (g.doc.addEventListener) {
return function (obj, type, fn, element) {
var realName = supportsTouch && touchMap[type] ? touchMap[type] : type,
f = function (e) {
Function d3_time_scale
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function d3_time_scale(linear, methods, format) {
function scale(x) {
return linear(x);
}
scale.invert = function(x) {
Function Highlight
has 48 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Rickshaw.Graph.Behavior.Series.Highlight = function(args) {
this.graph = args.graph;
this.legend = args.legend;
Function alert
has a Cognitive Complexity of 15 (exceeds 5 allowed). Consider refactoring. Open
Open
def alert(self):
if not self.alerts_enabled:
return
if self.overall_status != self.PASSING_STATUS:
# Don't alert every time
- 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 resize
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
resize: function() {
var that = $(this).data("ui-resizable"),
o = that.options,
cs = that.size,
os = that.originalSize,
Function _fnAjaxUpdateDraw
has 47 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function _fnAjaxUpdateDraw ( oSettings, json )
{
if ( json.sEcho !== undefined )
{
/* Protect against old returns over-writing a new one. Possible when you get