Showing 34 of 97 total issues
File Chart.js
has 2453 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*!
* Chart.js
* http://chartjs.org/
*
Function notify
has 131 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
function notify(map) {
var options = getOptions(),
iconClass = map.iconClass || options.iconClass;
if (options.preventDuplicates) {
if (map.message === previousToast) {
Function showTooltip
has 112 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
showTooltip : function(ChartElements, forceRedraw){
// Only redraw the chart if we've actually changed what we're hovering on.
if (typeof this.activeElements === 'undefined') this.activeElements = [];
var isChanged = (function(Elements){
Function draw
has 89 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
draw: function(){
if (this.display){
var ctx = this.ctx;
each(this.yLabels, function(label, index){
// Don't draw a centre value
File toastr.js
has 314 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/*
* Toastr
* Copyright 2012-2014
* Authors: John Papa, Hans Fjällemark, and Tim Ferrell.
* All Rights Reserved.
Function initialize
has 69 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialize: function(data){
//Expose options as a scope variable here so we can access it in the ScaleClass
var options = this.options;
Function draw
has 68 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
draw : function(){
var ctx = this.ctx,
yLabelGap = (this.endPoint - this.startPoint) / this.steps,
xStart = Math.round(this.xScalePaddingLeft);
if (this.display){
File nprogress.js
has 270 lines of code (exceeds 250 allowed). Consider refactoring. Open
Open
/* NProgress, (c) 2013, 2014 Rico Sta. Cruz - http://ricostacruz.com/nprogress
* @license MIT */
;(function(root, factory) {
Function draw
has 59 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
draw : function(ease){
var easingDecimal = ease || 1;
this.clear();
var ctx = this.chart.ctx;
Function initialize
has 57 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialize: function(data){
//Declare the extension of the default point, to cater for the options passed in to the constructor
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
Function calculateScaleRange
has 55 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
calculateScaleRange = helpers.calculateScaleRange = function(valuesArray, drawingSize, textSize, startFromZero, integersOnly){
//Set a minimum step of two - a point at the top of the graph, and a point at the base
var minSteps = 2,
maxSteps = Math.floor(drawingSize/(textSize * 1.5)),
Function setScaleSize
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
setScaleSize: function(){
/*
* Right, this is really confusing and there is a lot of maths going on here
* The gist of the problem is here: https://gist.github.com/nnnick/696cc9c55f4b0beb8fe9
*
Function draw
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
draw : function(){
var ctx = this.chart.ctx;
ctx.font = fontString(this.fontSize,this.fontStyle,this.fontFamily);
Function initialize
has 53 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialize: function(data){
this.PointClass = Chart.Point.extend({
strokeWidth : this.options.pointDotStrokeWidth,
radius : this.options.pointDotRadius,
display: this.options.pointDot,
Function buildScale
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buildScale : function(labels){
var self = this;
var dataTotal = function(){
var values = [];
Function buildScale
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
buildScale : function(labels){
var self = this;
var dataTotal = function(){
var values = [];
Function initialize
has 50 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
initialize: function(data){
this.segments = [];
//Declare segment class as a chart instance specific class, so it can share props for this instance
this.SegmentArc = Chart.Arc.extend({
showStroke : this.options.segmentShowStroke,
Function css
has 40 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var css = (function() {
var cssPrefixes = [ 'Webkit', 'O', 'Moz', 'ms' ],
cssProps = {};
function camelCase(string) {
Method create
has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring. Open
Open
def create
build_resource(sign_up_params)
resource.name = params[:user][:name]
resource.save
yield resource if block_given?
- 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 calculateXLabelRotation
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
calculateXLabelRotation : function(){
//Get the width of each grid by calculating the difference
//between x offsets between 0 and 1.
this.ctx.font = this.font;