Showing 181 of 292 total issues
Function pathBBox
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var pathDimensions = R.pathBBox = function (path) {
var pth = paths(path);
if (pth.bbox) {
return clone(pth.bbox);
}
Function drawSeries
has 46 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Bar.prototype.drawSeries = function() {
var barWidth, bottom, groupWidth, idx, lastTop, left, leftPadding, numBars, row, sidx, size, top, ypos, zeroPos;
groupWidth = this.width / this.options.data.length;
numBars = this.options.stacked != null ? 1 : this.options.ykeys.length;
barWidth = (groupWidth * this.options.barSizeRatio - this.options.barGap * (numBars - 1)) / numBars;
Method bootstrap_flash_fixed
has a Cognitive Complexity of 14 (exceeds 5 allowed). Consider refactoring. Open
Open
def bootstrap_flash_fixed
flash_messages = []
flash.each do |type, message|
type = type.to_sym # this is needed because it comes in as a String for some reason...
# Skip empty messages, e.g. for devise messages set to nothing in a locale file.
- 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 create
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
R._engine.create = function () {
var con = R._getContainer.apply(0, arguments),
container = con && con.container,
x = con.x,
y = con.y,
Function generatePaths
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Line.prototype.generatePaths = function() {
var c, coords, i, r, smooth;
return this.paths = (function() {
var _i, _ref, _ref1, _results;
_results = [];
Consider simplifying this complex logical expression. Open
Open
if (rgb[5]) {
values = rgb[5][split](commaSpaces);
red = toFloat(values[0]);
values[0].slice(-1) == "%" && (red *= 2.55);
green = toFloat(values[1]);
Consider simplifying this complex logical expression. Open
Open
if (rgb[6]) {
values = rgb[6][split](commaSpaces);
red = toFloat(values[0]);
values[0].slice(-1) == "%" && (red *= 2.55);
green = toFloat(values[1]);
Function _calc
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Grid.prototype._calc = function() {
var bottomOffsets, gridLine, h, i, w, yLabelWidths;
w = this.el.width();
h = this.el.height();
if (this.elementWidth !== w || this.elementHeight !== h || this.dirty) {
Function curveDim
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
curveDim = cacher(function (p1x, p1y, c1x, c1y, c2x, c2y, p2x, p2y) {
var a = (c2x - 2 * c1x + p1x) - (p2x - 2 * c2x + c1x),
b = 2 * (c1x - p1x) - 2 * (c2x - c1x),
c = p1x - c1x,
t1 = (-b + math.sqrt(b * b - 4 * a * c)) / 2 / a,
Function create
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
R._engine.create = function () {
var con = R._getContainer.apply(0, arguments),
container = con.container,
height = con.height,
s,
Function transform
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
elproto.transform = function (tstr) {
if (tstr == null) {
return this._.transform;
}
var vbs = this.paper._viewBoxShift,
Function text
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
R._engine.text = function (vml, x, y, text) {
var el = createNode("shape"),
path = createNode("path"),
o = createNode("textpath");
x = x || 0;
Function getLengthFactory
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getLengthFactory = function (istotal, subpath) {
return function (path, length, onlystart) {
path = path2curve(path);
var x, y, p, l, sp = "", subpaths = {}, point,
len = 0;
Function setCoords
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setCoords = function (p, sx, sy, dx, dy, deg) {
var _ = p._,
m = p.matrix,
fillpos = _.fillpos,
o = p.node,
Function paths
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return this.paths = (function() {
var _i, _ref, _ref1, _results;
_results = [];
for (i = _i = 0, _ref = this.options.ykeys.length; 0 <= _ref ? _i < _ref : _i > _ref; i = 0 <= _ref ? ++_i : --_i) {
smooth = this.options.smooth === true || (_ref1 = this.options.ykeys[i], __indexOf.call(this.options.smooth, _ref1) >= 0);
Function dragMove
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
dragMove = function (e) {
var x = e.clientX,
y = e.clientY,
scrollY = g.doc.documentElement.scrollTop || g.doc.body.scrollTop,
scrollX = g.doc.documentElement.scrollLeft || g.doc.body.scrollLeft,
Function bars
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
return this.bars = (function() {
var _i, _len, _ref, _results;
_ref = this.data;
_results = [];
for (idx = _i = 0, _len = _ref.length; _i < _len; idx = ++_i) {
Function registerFont
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
R.registerFont = function (font) {
if (!font.face) {
return font;
}
this.fonts = this.fonts || {};
Function print
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
paperproto.print = function (x, y, string, font, size, origin, letter_spacing, line_spacing) {
origin = origin || "middle"; // baseline|middle
letter_spacing = mmax(mmin(letter_spacing || 0, 1), -1);
line_spacing = mmax(mmin(line_spacing || 1, 3), 1);
var letters = Str(string)[split](E),
Function parsePathString
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
R.parsePathString = function (pathString) {
if (!pathString) {
return null;
}
var pth = paths(pathString);