zeiv/caseadilla

View on GitHub

Showing 100 of 100 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/caseadilla/bootstrap.js - About 3 days to fix

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      Tooltip.prototype.enter = function (obj) {
        var self = obj instanceof this.constructor ?
          obj : $(obj.currentTarget).data('bs.' + this.type)
    
        if (!self) {
    Severity: Major
    Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 1 day to fix
    app/assets/javascripts/caseadilla/bootstrap.js on lines 1222..1240

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 249.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    Similar blocks of code found in 2 locations. Consider refactoring.
    Open

      Tooltip.prototype.leave = function (obj) {
        var self = obj instanceof this.constructor ?
          obj : $(obj.currentTarget).data('bs.' + this.type)
    
        if (!self) {
    Severity: Major
    Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 1 day to fix
    app/assets/javascripts/caseadilla/bootstrap.js on lines 1202..1220

    Duplicated Code

    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

    Tuning

    This issue has a mass of 249.

    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

    Refactorings

    Further Reading

    File jquery.wymeditor.table.js has 504 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    /* global rangy */
    "use strict";
    
    // Fugue icons by Yusuke Kamiyamane http://p.yusukekamiyamane.com/
    // and licensed under Creative Commons Attribution

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      StructuredHeadingsManager.prototype.canRaiseHeadingLevel = function (heading) {
          var shm = this,
              headingLevel = getHeadingLevel(heading),
              headingLevelDifference,
              nextHeading,
      app/assets/javascripts/caseadilla/wymeditor/plugins/structured_headings/jquery.wymeditor.structured_headings.js on lines 273..298

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 157.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

      StructuredHeadingsManager.prototype.canLowerHeadingLevel = function (heading) {
          var shm = this,
              headingLevel = getHeadingLevel(heading),
              headingLevelDifference,
              prevHeading,
      app/assets/javascripts/caseadilla/wymeditor/plugins/structured_headings/jquery.wymeditor.structured_headings.js on lines 235..260

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 157.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        function Plugin(option) {
          return this.each(function () {
            var $this   = $(this)
            var data    = $this.data('bs.tooltip')
            var options = typeof option == 'object' && option
      Severity: Major
      Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/caseadilla/bootstrap.js on lines 1645..1655

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        function Plugin(option) {
          return this.each(function () {
            var $this   = $(this)
            var data    = $this.data('bs.popover')
            var options = typeof option == 'object' && option
      Severity: Major
      Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/caseadilla/bootstrap.js on lines 1531..1541

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 133.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        function Plugin(option) {
          return this.each(function () {
            var $this   = $(this)
            var data    = $this.data('bs.scrollspy')
            var options = typeof option == 'object' && option
      Severity: Major
      Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/caseadilla/bootstrap.js on lines 2071..2080

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 118.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        function Plugin(option) {
          return this.each(function () {
            var $this   = $(this)
            var data    = $this.data('bs.affix')
            var options = typeof option == 'object' && option
      Severity: Major
      Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 4 hrs to fix
      app/assets/javascripts/caseadilla/bootstrap.js on lines 1806..1815

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 118.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        function Plugin(option) {
          return this.each(function () {
            var $this = $(this)
            var data  = $this.data('bs.alert')
      
      
      Severity: Major
      Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/caseadilla/bootstrap.js on lines 784..792

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 105.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Similar blocks of code found in 2 locations. Consider refactoring.
      Open

        function Plugin(option) {
          return this.each(function () {
            var $this = $(this)
            var data  = $this.data('bs.dropdown')
      
      
      Severity: Major
      Found in app/assets/javascripts/caseadilla/bootstrap.js and 1 other location - About 3 hrs to fix
      app/assets/javascripts/caseadilla/bootstrap.js on lines 130..138

      Duplicated Code

      Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

      Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

      When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

      Tuning

      This issue has a mass of 105.

      We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

      The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

      If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

      See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

      Refactorings

      Further Reading

      Function mergeRow has 87 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      TableEditor.prototype.mergeRow = function () {
          var tableEditor = this,
              wym = tableEditor._wym,
              // Get all of the affected nodes in the range
              nodes = wym._getSelectedNodes(),

        Method install_flavor has a Cognitive Complexity of 24 (exceeds 5 allowed). Consider refactoring.
        Open

            def install_flavor
              @flavor = self.flavor
              if @flavor == "auto"
                puts "\nWelcome to Caseadilla! Please enter a flavor to install:"
                puts "\n[steak] This is recommended for a fresh Rails app.  Caseadilla will set up Devise and Declarative Authorization for you, along with an admin user and various authorization roles."
        Severity: Minor
        Found in lib/generators/caseadilla/install/install_generator.rb - About 3 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

        Method install_flavor has 84 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            def install_flavor
              @flavor = self.flavor
              if @flavor == "auto"
                puts "\nWelcome to Caseadilla! Please enter a flavor to install:"
                puts "\n[steak] This is recommended for a fresh Rails app.  Caseadilla will set up Devise and Declarative Authorization for you, along with an admin user and various authorization roles."
        Severity: Major
        Found in lib/generators/caseadilla/install/install_generator.rb - About 3 hrs to fix

          Function fullscreen has 72 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

          WYMeditor.editor.prototype.fullscreen = function() {
              var wym = this,
                  $box = jQuery(wym._box),
                  $iframe = jQuery(wym._iframe),
                  $overlay = null,

            Function changeSelectedHeadingsLevel has a Cognitive Complexity of 20 (exceeds 5 allowed). Consider refactoring.
            Open

            StructuredHeadingsManager.prototype.changeSelectedHeadingsLevel = function (
                selection, upOrDown
            ) {
                var shm = this,
                    wym = shm._wym,

            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

            File jquery.wymeditor.structured_headings.js has 275 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            /* jshint maxlen: 90 */
            "use strict";
            
            // In case the script is included on a page without WYMeditor, define the
            // WYMeditor and WYMeditor.editor objects to hold the constants used.

              Function TableEditor has 61 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

              function TableEditor(options, wym) {
                  var tableEditor = this;
                  options = jQuery.extend({
                      sMergeRowButtonHtml: String() +
                          '<li class="wym_tools_merge_row">' +

                Function getCellXIndex has 56 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                TableEditor.prototype.getCellXIndex = function (cell) {
                    var tableEditor = this,
                        i,
                        parentTr,
                        baseRowColumns,
                  Severity
                  Category
                  Status
                  Source
                  Language