Showing 56 of 138 total issues
Function setValues
has 54 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, setValues: function(time) {
if (this.showMeridian) {
var arr = time.split(' ');
var timeArray = arr[0].split(':');
this.meridian = arr[1];
Function update
has 51 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
update: function(){
if (!this._allow_update)
return this;
var oldDates = this.dates.copy(),
Function addedfile
has 49 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
addedfile: function(file) {
var node, removeFileEvent, removeLink, _i, _j, _k, _len, _len1, _len2, _ref, _ref1, _ref2, _results;
if (this.element === this.previewsContainer) {
this.element.classList.add("dz-started");
}
Function show
has 43 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, show: function () {
var $tip
, inside
, pos
, actualWidth
Function Datepicker
has 42 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var Datepicker = function(element, options){
this._process_options(options);
this.dates = new DateArray();
this.viewDate = this.o.defaultViewDate;
Function fnUpdate
has 41 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
"fnUpdate": function ( oSettings, fnDraw ) {
var iListLength = 5;
var oPaging = oSettings.oInstance.fnPagingInfo();
var an = oSettings.aanFeatures.p;
var i, j, sClass, iStart, iEnd, iHalf=Math.floor(iListLength/2);
Method form_attributes
has 39 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def self.form_attributes
[
{
'name' => {
'type' => 'text_field',
Function getClassNames
has 38 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
getClassNames: function(date){
var cls = [],
year = this.viewDate.getUTCFullYear(),
month = this.viewDate.getUTCMonth(),
today = new Date();
Function slide
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, slide: function (type, next) {
var $active = this.$element.find('.item.active')
, $next = next || $active[type]()
, isCycling = this.interval
, direction = type == 'next' ? 'left' : 'right'
Function moveMonth
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
moveMonth: function(date, dir){
if (!date)
return undefined;
if (!dir)
return date;
Function DateArray
has 37 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var DateArray = (function(){
var extras = {
get: function(i){
return this.slice(i)[0];
},
Function updateNavArrows
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
updateNavArrows: function(){
if (!this._allow_update)
return;
var d = new Date(this.viewDate),
Function setDefaultTime
has 36 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, setDefaultTime: function(defaultTime){
if (defaultTime) {
if (defaultTime === 'current') {
var dTime = new Date();
var hours = dTime.getHours();
Function init
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
, init: function () {
if (this.$element.parent().hasClass('input-append')) {
this.$element.parent('.input-append').find('.add-on').on('click', $.proxy(this.showWidget, this));
this.$element.on({
focus: $.proxy(this.highlightUnit, this),
Function resize
has 34 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
resize: function(file) {
var info, srcRatio, trgRatio;
info = {
srcX: 0,
srcY: 0,
Method field_value
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
def field_value(attr_type, attribute, object)
case attr_type
when 'select'
belong_to_object_name(object, attribute.gsub('_id', ''))
when 'checkbox'
Function datepickerPlugin
has 32 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
var datepickerPlugin = function(option){
var args = Array.apply(null, arguments);
args.shift();
var internal_return;
this.each(function(){
Method initialize
has a Cognitive Complexity of 11 (exceeds 5 allowed). Consider refactoring. Open
Open
def initialize(user)
if user.nil?
elsif user.role.name == 'Admin'
can :manage, :all
- 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 discover
has 31 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Dropzone.discover = function() {
var checkElements, dropzone, dropzones, _i, _len, _results;
if (document.querySelectorAll) {
dropzones = document.querySelectorAll(".dropzone");
} else {
Function createThumbnailFromUrl
has 30 lines of code (exceeds 25 allowed). Consider refactoring. Open
Open
Dropzone.prototype.createThumbnailFromUrl = function(file, imageUrl, callback) {
var img;
img = document.createElement("img");
img.onload = (function(_this) {
return function() {