Showing 231 of 371 total issues
Function find
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
find: function( selector ) {
var self = this,
i, l;
if ( typeof selector !== "string" ) {
Function apportion
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function apportion(node, previousSibling, ancestor) {
if (previousSibling) {
var vip = node, vop = node, vim = previousSibling, vom = node.parent.children[0], sip = vip._tree.mod, sop = vop._tree.mod, sim = vim._tree.mod, som = vom._tree.mod, shift;
while (vim = d3_layout_treeRight(vim), vip = d3_layout_treeLeft(vip), vim && vip) {
vom = d3_layout_treeLeft(vom);
Function diagonal
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.svg.diagonal = function() {
function diagonal(d, i) {
var p0 = source.call(this, d, i), p3 = target.call(this, d, i), m = (p0.y + p3.y) / 2, p = [ p0, {
x: p0.x,
y: m
Function brush
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function brush(g) {
g.each(function() {
var g = d3.select(this), bg = g.selectAll(".background").data([ 0 ]), fg = g.selectAll(".extent").data([ 0 ]), tz = g.selectAll(".resize").data(resizes, String), e;
g.style("pointer-events", "all").on("mousedown.brush", brushstart).on("touchstart.brush", brushstart);
bg.enter().append("rect").attr("class", "background").style("visibility", "hidden").style("cursor", "crosshair");
Function d3_geo_greatArcInterpolator
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function d3_geo_greatArcInterpolator() {
function interpolate(t) {
var B = Math.sin(t *= d) * k, A = Math.sin(d - t) * k, x = A * kx0 + B * kx1, y = A * ky0 + B * ky1, z = A * sy0 + B * sy1;
return [ Math.atan2(y, x) / d3_geo_radians, Math.atan2(z, Math.sqrt(x * x + y * y)) / d3_geo_radians ];
}
Function position
has 28 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function position(row, u, rect, flush) {
var i = -1, n = row.length, x = rect.x, y = rect.y, v = u ? round(row.area / u) : 0, o;
if (u == rect.dx) {
if (flush || v > rect.dy) v = rect.dy;
while (++i < n) {
Method generate_sip_corpus
has a Cognitive Complexity of 10 (exceeds 5 allowed). Consider refactoring. Open
Open
def generate_sip_corpus
sip_corpus = {}
Person.all.each do |person|
unless person.id == "1"
@dictionary = sips_for(person.id, false)
- 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 show
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
show: function( speed, easing, callback ) {
var elem, display;
if ( speed || speed === 0 ) {
return this.animate( genFx("show", 3), speed, easing, callback );
Function html
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
Function setup
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setup: function() {
if ( rformElems.test( this.nodeName ) ) {
// IE doesn't fire change on a check/radio until blur; trigger it on click
// after a propertychange. Eat the blur-change in special.change.handle.
Function addClass
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addClass: function( value ) {
var classNames, i, l, elem,
setClass, c, cl;
if ( jQuery.isFunction( value ) ) {
Function brushmove
has 27 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function brushmove() {
var point = mouse(), moved = false;
if (offset) {
point[0] += offset[0];
point[1] += offset[1];
Function buildFragment
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.buildFragment = function( args, nodes, scripts ) {
var fragment, cacheable, cacheresults, doc,
first = args[ 0 ];
// nodes may contain either an explicit document object,
Function d3_selection_on
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function d3_selection_on(type, listener, capture) {
function onRemove() {
var wrapper = this[name];
if (wrapper) {
this.removeEventListener(type, wrapper, wrapper.$);
Function cloneFixAttributes
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function cloneFixAttributes( src, dest ) {
var nodeName;
// We do not need to do anything for non-Elements
if ( dest.nodeType !== 1 ) {
Function >
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
">": function( checkSet, part ) {
var elem,
isPartStr = typeof part === "string",
i = 0,
l = checkSet.length;
Function timer
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.timer = function(callback, delay, then) {
var found = false, t0, t1 = d3_timer_queue;
if (arguments.length < 3) {
if (arguments.length < 2) delay = 0; else if (!isFinite(delay)) return;
then = Date.now();
Function albersUsa
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.geo.albersUsa = function() {
function albersUsa(coordinates) {
var lon = coordinates[0], lat = coordinates[1];
return (lat > 50 ? alaska : lon < -140 ? hawaii : lat < 21 ? puertoRico : lower48)(coordinates);
}
Method graph
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def graph
sip_hash = {}
sips = get_sip_corpus(false)
sips.each do |word|
sip_hash[word] = who_has_sip(word)
Function contour
has 26 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.geom.contour = function(grid, start) {
var s = start || d3_geom_contourStart(grid), c = [], x = s[0], y = s[1], dx = 0, dy = 0, pdx = NaN, pdy = NaN, i = 0;
do {
i = 0;
if (grid(x - 1, y - 1)) i += 1;