Showing 231 of 371 total issues
Function d3_layout_packSiblings
has 62 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function d3_layout_packSiblings(node) {
function bound(node) {
xMin = Math.min(node.x - node.r, xMin);
xMax = Math.max(node.x + node.r, xMax);
yMin = Math.min(node.y - node.r, yMin);
Method graph
has a Cognitive Complexity of 18 (exceeds 5 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)
- 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 build_dic
has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring. Open
Open
def build_dic(person_id = nil, time_period = nil)
unless person_id.nil? then dictionary = "dic_#{person_id}" else dictionary = "dic_all" end
unless person_id.nil? then Ohm.redis.zremrangebyrank(dictionary, 0, -1) end
messages = {}
unless person_id.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 d3_transition
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function d3_transition(groups, id, time) {
d3_arraySubclass(groups, d3_transitionPrototype);
var tweens = new d3_Map, event = d3.dispatch("start", "end"), ease = d3_transitionEase;
groups.id = id;
groups.time = time;
Function interpolateString
has 60 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.interpolateString = function(a, b) {
var m, i, j, s0 = 0, s1 = 0, s = [], q = [], n, o;
d3_interpolate_number.lastIndex = 0;
for (i = 0; m = d3_interpolate_number.exec(b); ++i) {
if (m.index) s.push(b.substring(s0, s1 = m.index));
Function tick
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
force.tick = function() {
if ((alpha *= .99) < .005) {
event.end({
type: "end",
alpha: alpha = 0
Function hierarchy
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.layout.hierarchy = function() {
function recurse(data, depth, nodes) {
var childs = children.call(hierarchy, data, depth), node = d3_layout_hierarchyInline ? data : {
data: data
};
Function drag
has 58 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.behavior.drag = function() {
function drag() {
this.on("mousedown.drag", mousedown).on("touchstart.drag", mousedown);
}
function mousedown() {
Function ajaxConvert
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function ajaxConvert( s, response ) {
// Apply the dataFilter if provided
if ( s.dataFilter ) {
response = s.dataFilter( response, s.dataType );
Function dispatch
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dispatch: function( event ) {
// Make a writable jQuery.Event from the native event object
event = jQuery.event.fix( event || window.event );
Function bind
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function bind(group, groupData) {
var i, n = group.length, m = groupData.length, n0 = Math.min(n, m), n1 = Math.max(n, m), updateNodes = [], enterNodes = [], exitNodes = [], node, nodeData;
if (key) {
var nodeByKeyValue = new d3_Map, keyValues = [], keyValue, j = groupData.length;
for (i = -1; ++i < n; ) {
Function format
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.format = function(specifier) {
var match = d3_format_re.exec(specifier), fill = match[1] || " ", sign = match[3] || "", zfill = match[5], width = +match[6], comma = match[7], precision = match[8], type = match[9], scale = 1, suffix = "", integer = false;
if (precision) precision = +precision.substring(1);
if (zfill) {
fill = "0";
Function quadtree
has 56 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.geom.quadtree = function(points, x1, y1, x2, y2) {
function insert(n, p, x1, y1, x2, y2) {
if (isNaN(p.x) || isNaN(p.y)) return;
if (n.leaf) {
var v = n.point;
Function data
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
data: function( elem, name, data, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function offset
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
jQuery.fn.offset = function( options ) {
var elem = this[0];
if ( options ) {
return this.each(function( i ) {
Function removeData
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
removeData: function( elem, name, pvt /* Internal Use Only */ ) {
if ( !jQuery.acceptData( elem ) ) {
return;
}
Function stack
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.layout.stack = function() {
function stack(data, index) {
var series = data.map(function(d, i) {
return values.call(stack, d, i);
});
Function start
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
force.start = function() {
function position(dimension, size) {
var neighbors = neighbor(i), j = -1, m = neighbors.length, x;
while (++j < m) if (!isNaN(x = neighbors[j][dimension])) return x;
return Math.random() * size;
Function nest
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
d3.nest = function() {
function map(array, depth) {
if (depth >= keys.length) return rollup ? rollup.call(nest, array) : sortValues ? array.sort(sortValues) : array;
var i = -1, n = array.length, key = keys[depth++], keyValue, object, valuesByKey = new d3_Map, values, o = {};
while (++i < n) {
Function remove
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
remove: function( elem, types, handler, selector, mappedTypes ) {
var elemData = jQuery.hasData( elem ) && jQuery._data( elem ),
t, tns, type, origType, namespaces, origCount,
j, events, special, handle, eventType, handleObj;