agilejzl/blog-eye

View on GitHub

Showing 35 of 78 total issues

File bootstrap.js has 1387 lines of code (exceeds 250 allowed). Consider refactoring.
Open

/*!
 * Bootstrap v3.2.0 (http://getbootstrap.com)
 * Copyright 2011-2014 Twitter, Inc.
 * Licensed under MIT (https://github.com/twbs/bootstrap/blob/master/LICENSE)
 */
Severity: Major
Found in app/assets/javascripts/shared/bootstrap.js - About 3 days to fix

File backbone.js has 956 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//     Backbone.js 1.1.2

//     (c) 2010-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Backbone may be freely distributed under the MIT license.
//     For all details and documentation:
Severity: Major
Found in app/assets/javascripts/shared/backbone.js - About 2 days to fix

File underscore.js has 931 lines of code (exceeds 250 allowed). Consider refactoring.
Open

//     Underscore.js 1.6.0
//     http://underscorejs.org
//     (c) 2009-2014 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
//     Underscore may be freely distributed under the MIT license.

Severity: Major
Found in app/assets/javascripts/shared/underscore.js - About 2 days to fix

Function editorConfig has 71 lines of code (exceeds 25 allowed). Consider refactoring.
Open

CKEDITOR.editorConfig = function (config) {
  // Define changes to default configuration here. For example:
  config.language = 'zh-cn';
  // config.uiColor = '#AADC6E';

Severity: Major
Found in app/assets/javascripts/ckeditor/config.js - About 2 hrs to fix

Function set has 67 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    set: function(models, options) {
      options = _.defaults({}, options, setOptions);
      if (options.parse) models = this.parse(models, options);
      var singular = !_.isArray(models);
      models = singular ? (models ? [models] : []) : _.clone(models);
Severity: Major
Found in app/assets/javascripts/shared/backbone.js - About 2 hrs to fix

Function eq has 59 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  var eq = function(a, b, aStack, bStack) {
    // Identical objects are equal. `0 === -0`, but they aren't identical.
    // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal).
    if (a === b) return a !== 0 || 1 / a == 1 / b;
    // A strict comparison is necessary because `null == undefined`.
Severity: Major
Found in app/assets/javascripts/shared/underscore.js - About 2 hrs to fix

Method validate_each has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
Open

  def validate_each(record, attribute, value)
    raise(ArgumentError, "A CarrierWave::Uploader::Base object was expected") unless value.kind_of? CarrierWave::Uploader::Base
    
    value = (options[:tokenizer] || DEFAULT_TOKENIZER).call(value) if value.kind_of?(String)
 
Severity: Minor
Found in lib/file_size_validator.rb - About 2 hrs to fix

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 editorConfig has a Cognitive Complexity of 16 (exceeds 5 allowed). Consider refactoring.
Open

CKEDITOR.editorConfig = function (config) {
  // Define changes to default configuration here. For example:
  config.language = 'zh-cn';
  // config.uiColor = '#AADC6E';

Severity: Minor
Found in app/assets/javascripts/ckeditor/config.js - About 2 hrs to fix

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 52 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.show = function () {
    var e = $.Event('show.bs.' + this.type)

    if (this.hasContent() && this.enabled) {
      this.$element.trigger(e)
Severity: Major
Found in app/assets/javascripts/shared/bootstrap.js - About 2 hrs to fix

Function slide has 49 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Carousel.prototype.slide = function (type, next) {
    var $active   = this.$element.find('.item.active')
    var $next     = next || $active[type]()
    var isCycling = this.interval
    var direction = type == 'next' ? 'left' : 'right'
Severity: Minor
Found in app/assets/javascripts/shared/bootstrap.js - About 1 hr to fix

Function set has 48 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    set: function(key, val, options) {
      var attr, attrs, unset, changes, silent, changing, prev, current;
      if (key == null) return this;

      // Handle both `"key", value` and `{key: value}` -style arguments.
Severity: Minor
Found in app/assets/javascripts/shared/backbone.js - About 1 hr to fix

Function template has 41 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  _.template = function(text, data, settings) {
    var render;
    settings = _.defaults({}, settings, _.templateSettings);

    // Combine delimiters into one regular expression via alternation.
Severity: Minor
Found in app/assets/javascripts/shared/underscore.js - About 1 hr to fix

Function sync has 37 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Backbone.sync = function(method, model, options) {
    var type = methodMap[method];

    // Default options, unless specified.
    _.defaults(options || (options = {}), {
Severity: Minor
Found in app/assets/javascripts/shared/backbone.js - About 1 hr to fix

Function start has 36 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    start: function(options) {
      if (History.started) throw new Error("Backbone.history has already been started");
      History.started = true;

      // Figure out the initial configuration. Do we need an iframe?
Severity: Minor
Found in app/assets/javascripts/shared/backbone.js - About 1 hr to fix

Function save has 35 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    save: function(key, val, options) {
      var attrs, method, xhr, attributes = this.attributes;

      // Handle both `"key", value` and `{key: value}` -style arguments.
      if (key == null || typeof key === 'object') {
Severity: Minor
Found in app/assets/javascripts/shared/backbone.js - About 1 hr to fix

Function show has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Modal.prototype.show = function (_relatedTarget) {
    var that = this
    var e    = $.Event('show.bs.modal', { relatedTarget: _relatedTarget })

    this.$element.trigger(e)
Severity: Minor
Found in app/assets/javascripts/shared/bootstrap.js - About 1 hr to fix

Function backdrop has 34 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Modal.prototype.backdrop = function (callback) {
    var that = this
    var animate = this.$element.hasClass('fade') ? 'fade' : ''

    if (this.isShown && this.options.backdrop) {
Severity: Minor
Found in app/assets/javascripts/shared/bootstrap.js - About 1 hr to fix

Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Tooltip.prototype.applyPlacement = function (offset, placement) {
    var $tip   = this.tip()
    var width  = $tip[0].offsetWidth
    var height = $tip[0].offsetHeight

Severity: Minor
Found in app/assets/javascripts/shared/bootstrap.js - About 1 hr to fix

Function checkPosition has 30 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Affix.prototype.checkPosition = function () {
    if (!this.$element.is(':visible')) return

    var scrollHeight = $(document).height()
    var scrollTop    = this.$target.scrollTop()
Severity: Minor
Found in app/assets/javascripts/shared/bootstrap.js - About 1 hr to fix

Function show has 29 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  Collapse.prototype.show = function () {
    if (this.transitioning || this.$element.hasClass('in')) return

    var startEvent = $.Event('show.bs.collapse')
    this.$element.trigger(startEvent)
Severity: Minor
Found in app/assets/javascripts/shared/bootstrap.js - About 1 hr to fix
Severity
Category
Status
Source
Language