puffer/puffer_pages

View on GitHub

Showing 219 of 219 total issues

Function CodeMirror has a Cognitive Complexity of 2984 (exceeds 5 allowed). Consider refactoring.
Open

window.CodeMirror = (function() {
  "use strict";

  // BROWSER SNIFFING

Severity: Minor
Found in app/assets/javascripts/puffer/codemirror.js - About 2 mos 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 CodeMirror has 3916 lines of code (exceeds 25 allowed). Consider refactoring.
Open

window.CodeMirror = (function() {
  "use strict";

  // BROWSER SNIFFING

Severity: Major
Found in app/assets/javascripts/puffer/codemirror.js - About 2 wks to fix

    File codemirror.js has 3919 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    // CodeMirror version 3.01
    //
    // CodeMirror is the only global var we claim
    window.CodeMirror = (function() {
      "use strict";
    Severity: Major
    Found in app/assets/javascripts/puffer/codemirror.js - About 1 wk to fix

      Function Tabs has a Cognitive Complexity of 275 (exceeds 5 allowed). Consider refactoring.
      Open

      var Tabs = RightJS.Tabs = (function(document, parseInt, RightJS) {
      /**
       * This module defines the basic widgets constructor
       * it creates an abstract proxy with the common functionality
       * which then we reuse and override in the actual widgets
      Severity: Minor
      Found in app/assets/javascripts/puffer/right-tabs-src.js - About 5 days 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 Tabs has 638 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

      var Tabs = RightJS.Tabs = (function(document, parseInt, RightJS) {
      /**
       * This module defines the basic widgets constructor
       * it creates an abstract proxy with the common functionality
       * which then we reuse and override in the actual widgets
      Severity: Major
      Found in app/assets/javascripts/puffer/right-tabs-src.js - About 3 days to fix

        Function multiplexingMode has a Cognitive Complexity of 72 (exceeds 5 allowed). Consider refactoring.
        Open

        CodeMirror.multiplexingMode = function(outer /*, others */) {
          // Others should be {open, close, mode [, delimStyle]} objects
          var others = Array.prototype.slice.call(arguments, 1);
          var n_others = others.length;
        
        
        Severity: Minor
        Found in app/assets/javascripts/puffer/multiplex.js - About 1 day 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

        File right-tabs-src.js has 640 lines of code (exceeds 250 allowed). Consider refactoring.
        Open

        /**
         * Tabs widget for RightJS (http://rightjs.org/ui/tabs)
         *
         * Copyright (C) 2009-2010 Nikolay Nemshilov
         */
        Severity: Major
        Found in app/assets/javascripts/puffer/right-tabs-src.js - About 1 day to fix

          File css.js has 392 lines of code (exceeds 250 allowed). Consider refactoring.
          Open

          CodeMirror.defineMode("css", function(config) {
            var indentUnit = config.indentUnit, type;
            
            var atMediaTypes = keySet([
              "all", "aural", "braille", "handheld", "print", "projection", "screen",
          Severity: Minor
          Found in app/assets/javascripts/puffer/codemirror/css.js - About 5 hrs to fix

            File javascript.js has 370 lines of code (exceeds 250 allowed). Consider refactoring.
            Open

            // TODO actually recognize syntax of TypeScript constructs
            
            CodeMirror.defineMode("javascript", function(config, parserConfig) {
              var indentUnit = config.indentUnit;
              var jsonMode = parserConfig.json;
            Severity: Minor
            Found in app/assets/javascripts/puffer/codemirror/javascript.js - About 4 hrs to fix

              Function onMouseDown has 114 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function onMouseDown(e) {
                  var cm = this, display = cm.display, view = cm.view, sel = view.sel, doc = view.doc;
                  sel.shift = e_prop(e, "shiftKey");
              
                  if (eventInWidget(display, e)) {
              Severity: Major
              Found in app/assets/javascripts/puffer/codemirror.js - About 4 hrs to fix

                Function updateDocNoUndo has 103 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
                    var view = cm.view, doc = view.doc, display = cm.display;
                    if (view.suppressEdits) return;
                
                    var nlines = to.line - from.line, firstLine = getLine(doc, from.line), lastLine = getLine(doc, to.line);
                Severity: Major
                Found in app/assets/javascripts/puffer/codemirror.js - About 4 hrs to fix

                  Class Page has 31 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                  class PufferPages::Backends::Page < ActiveRecord::Base
                    include ActiveUUID::UUID
                    include PufferPages::Backends::Mixins::Renderable
                    include PufferPages::Backends::Mixins::Importable
                    include PufferPages::Backends::Mixins::Localable
                  Severity: Minor
                  Found in lib/puffer_pages/backends/models/page.rb - About 3 hrs to fix

                    Function bidiOrdering has 92 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      var bidiOrdering = (function() {
                        // Character types for codepoints 0 to 0xff
                        var lowTypes = "bbbbbbbbbtstwsbbbbbbbbbbbbbbssstwNN%%%NNNNNN,N,N1111111111NNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNNNLLLLLLLLLLLLLLLLLLLLLLLLLLNNNNbbbbbbsbbbbbbbbbbbbbbbbbbbbbbbbbb,N%%%%NNNNLNNNNN%%11NLNNN1LNNNNNLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLLNLLLLLLLL";
                        // Character types for codepoints 0x600 to 0x6ff
                        var arabicTypes = "rrrrrrrrrrrr,rNNmmmmmmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmrrrrrrrnnnnnnnnnn%nnrrrmrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrrmmmmmmmmmmmmmmmmmmmNmmmmrrrrrrrrrrrrrrrrrr";
                    Severity: Major
                    Found in app/assets/javascripts/puffer/codemirror.js - About 3 hrs to fix

                      Function token has 89 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          token: function(stream, state) {
                            
                            // Use these terms when applicable (see http://www.xanthir.com/blog/b4E50)
                            // 
                            // rule** or **ruleset:
                      Severity: Major
                      Found in app/assets/javascripts/puffer/codemirror/css.js - About 3 hrs to fix

                        Function multiplexingMode has 84 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                        CodeMirror.multiplexingMode = function(outer /*, others */) {
                          // Others should be {open, close, mode [, delimStyle]} objects
                          var others = Array.prototype.slice.call(arguments, 1);
                          var n_others = others.length;
                        
                        
                        Severity: Major
                        Found in app/assets/javascripts/puffer/multiplex.js - About 3 hrs to fix

                          File xml.js has 306 lines of code (exceeds 250 allowed). Consider refactoring.
                          Open

                          CodeMirror.defineMode("xml", function(config, parserConfig) {
                            var indentUnit = config.indentUnit;
                            var Kludges = parserConfig.htmlMode ? {
                              autoSelfClosers: {'area': true, 'base': true, 'br': true, 'col': true, 'command': true,
                                                'embed': true, 'frame': true, 'hr': true, 'img': true, 'input': true,
                          Severity: Minor
                          Found in app/assets/javascripts/puffer/codemirror/xml.js - About 3 hrs to fix

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

                            CodeMirror.defineMode("text/x-liquid-html", function(config) {
                              return CodeMirror.multiplexingMode(
                                CodeMirror.getMode(config, "text/html"),
                                {
                                  open: "{{", close: "}}",
                            Severity: Major
                            Found in app/assets/javascripts/puffer/liquid.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/puffer/liquid.js on lines 17..31

                            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 100.

                            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

                            CodeMirror.defineMode("text/x-liquid-yaml", function(config) {
                              return CodeMirror.multiplexingMode(
                                CodeMirror.getMode(config, "text/x-yaml"),
                                {
                                  open: "{{", close: "}}",
                            Severity: Major
                            Found in app/assets/javascripts/puffer/liquid.js and 1 other location - About 3 hrs to fix
                            app/assets/javascripts/puffer/liquid.js on lines 1..15

                            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 100.

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

                              function updateDisplayInner(cm, changes, viewPort) {
                                var display = cm.display, doc = cm.view.doc;
                                if (!display.wrapper.clientWidth) {
                                  display.showingFrom = display.showingTo = display.viewOffset = 0;
                                  return;
                            Severity: Major
                            Found in app/assets/javascripts/puffer/codemirror.js - About 3 hrs to fix

                              Function charOrdering has 78 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                  return function charOrdering(str) {
                                    if (!bidiRE.test(str)) return false;
                                    var len = str.length, types = [];
                                    for (var i = 0, type; i < len; ++i)
                                      types.push(type = charType(str.charCodeAt(i)));
                              Severity: Major
                              Found in app/assets/javascripts/puffer/codemirror.js - About 3 hrs to fix
                                Severity
                                Category
                                Status
                                Source
                                Language