puffer/puffer_pages

View on GitHub

Showing 219 of 219 total issues

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

  resizing: function(callback) {
    var controller = this.tab.main;

    if (controller.__working) { return this.resizing.bind(this, callback).delay(100); }

Severity: Major
Found in app/assets/javascripts/puffer/right-tabs-src.js - About 3 hrs to fix

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

      function registerEventHandlers(cm) {
        var d = cm.display;
        on(d.scroller, "mousedown", operation(cm, onMouseDown));
        on(d.scroller, "dblclick", operation(cm, e_preventDefault));
        on(d.lineSpace, "selectstart", function(e) {
    Severity: Major
    Found in app/assets/javascripts/puffer/codemirror.js - About 2 hrs to fix

      Function updateSelectionRange has 65 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function updateSelectionRange(cm) {
          var display = cm.display, doc = cm.view.doc, sel = cm.view.sel;
          var fragment = document.createDocumentFragment();
          var clientWidth = display.lineSpace.offsetWidth, pl = paddingLeft(cm.display);
      
      
      Severity: Major
      Found in app/assets/javascripts/puffer/codemirror.js - About 2 hrs to fix

        Method read_template_file has a Cognitive Complexity of 18 (exceeds 5 allowed). Consider refactoring.
        Open

              def read_template_file template_path, context
                source = case template_type(template_path)
                when :snippet then
                  template_path = template_path.gsub(/^snippets\//, '')
                  snippet = snippet(template_path)
        Severity: Minor
        Found in lib/puffer_pages/liquid/file_system.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

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

            if (this.current()) {
              var enabled = this.main.enabled();
              var sibling = enabled[enabled.indexOf(this) + 1] || enabled[enabled.indexOf(this)-1];
        
              if (sibling) {
        Severity: Major
        Found in app/assets/javascripts/puffer/right-tabs-src.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/puffer/puffer_pages.js on lines 56..63

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

        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

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

                  if (this.current()) {
                    var enabled = this.main.enabled();
                    var sibling = enabled[enabled.indexOf(this) + 1] || enabled[enabled.indexOf(this)-1];
        
                    if (sibling) {
        Severity: Major
        Found in app/assets/javascripts/puffer/puffer_pages.js and 1 other location - About 2 hrs to fix
        app/assets/javascripts/puffer/right-tabs-src.js on lines 404..411

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

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

          function tokenBase(stream, state) {
            var ch = stream.next();
            if (ch == "@") {stream.eatWhile(/[\w\\\-]/); return ret("def", stream.current());}
            else if (ch == "/" && stream.eat("*")) {
              state.tokenize = tokenCComment;
        Severity: Major
        Found in app/assets/javascripts/puffer/codemirror/css.js - About 2 hrs to fix

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

            function css(stream, state) {
              if (stream.match(/^<\/\s*style\s*>/i, false)) {
                state.token = html;
                state.localState = null;
                return html(stream, state);
          Severity: Major
          Found in app/assets/javascripts/puffer/codemirror/htmlmixed.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/puffer/codemirror/htmlmixed.js on lines 30..38

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

          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 javascript(stream, state) {
              if (stream.match(/^<\/\s*script\s*>/i, false)) {
                state.token = html;
                state.localState = null;
                return html(stream, state);
          Severity: Major
          Found in app/assets/javascripts/puffer/codemirror/htmlmixed.js and 1 other location - About 2 hrs to fix
          app/assets/javascripts/puffer/codemirror/htmlmixed.js on lines 39..47

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

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

            function insertLineContent(line, builder, styles) {
              var spans = line.markedSpans;
              if (!spans) {
                for (var i = 1; i < styles.length; i+=2)
                  builder.addToken(builder, styles[i], styleToClass(styles[i+1]));
          Severity: Major
          Found in app/assets/javascripts/puffer/codemirror.js - About 2 hrs to fix

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

                var inTag = function(stream, state) {
                  var token = null;
            
                  if (stream.match('%}')) {
                    state.tokenizer = tokenize;
            Severity: Major
            Found in app/assets/javascripts/puffer/codemirror/liquid.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/puffer/codemirror/liquid.js on lines 54..65

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

            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

                var inVariable = function(stream, state) {
                  var token = null;
            
                  if (stream.match('}}')) {
                    state.tokenizer = tokenize;
            Severity: Major
            Found in app/assets/javascripts/puffer/codemirror/liquid.js and 1 other location - About 2 hrs to fix
            app/assets/javascripts/puffer/codemirror/liquid.js on lines 67..78

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

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

                    token: function(stream, state) {
                        var ch = stream.peek();
                        var esc = state.escaped;
                        state.escaped = false;
                        /* comments */
            Severity: Major
            Found in app/assets/javascripts/puffer/codemirror/yaml.js - About 2 hrs to fix

              Function inText has 51 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                function inText(stream, state) {
                  function chain(parser) {
                    state.tokenize = parser;
                    return parser(stream, state);
                  }
              Severity: Major
              Found in app/assets/javascripts/puffer/codemirror/xml.js - About 2 hrs to fix

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

                    display.inputDiv.style.top = Math.max(0, Math.min(display.wrapper.clientHeight - 10,
                                                                      headPos.top + lineOff.top - wrapOff.top)) + "px";
                Severity: Major
                Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/puffer/codemirror.js on lines 694..695

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

                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

                    display.inputDiv.style.left = Math.max(0, Math.min(display.wrapper.clientWidth - 10,
                                                                       headPos.left + lineOff.left - wrapOff.left)) + "px";
                Severity: Major
                Found in app/assets/javascripts/puffer/codemirror.js and 1 other location - About 1 hr to fix
                app/assets/javascripts/puffer/codemirror.js on lines 692..693

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

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

                  function onScrollWheel(cm, e) {
                    var dx = e.wheelDeltaX, dy = e.wheelDeltaY;
                    if (dx == null && e.detail && e.axis == e.HORIZONTAL_AXIS) dx = e.detail;
                    if (dy == null && e.detail && e.axis == e.VERTICAL_AXIS) dy = e.detail;
                    else if (dy == null) dy = e.wheelDelta;
                Severity: Minor
                Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                  Function jsTokenBase has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                    function jsTokenBase(stream, state) {
                      var ch = stream.next();
                      if (ch == '"' || ch == "'")
                        return chain(stream, state, jsTokenString(ch));
                      else if (/[\[\]{}\(\),;\:\.]/.test(ch))
                  Severity: Minor
                  Found in app/assets/javascripts/puffer/codemirror/javascript.js - About 1 hr to fix

                    Function makeDisplay has 46 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      function makeDisplay(place) {
                        var d = {};
                        var input = d.input = elt("textarea", null, null, "position: absolute; padding: 0; width: 1px; height: 1em; outline: none;");
                        if (webkit) input.style.width = "1000px";
                        else input.setAttribute("wrap", "off");
                    Severity: Minor
                    Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

                      Function patchDisplay has 44 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        function patchDisplay(cm, from, to, intact, updateNumbersFrom) {
                          var dims = getDimensions(cm);
                          var display = cm.display, lineNumbers = cm.options.lineNumbers;
                          if (!intact.length && (!webkit || !cm.display.currentWheelTarget))
                            removeChildren(display.lineDiv);
                      Severity: Minor
                      Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix
                        Severity
                        Category
                        Status
                        Source
                        Language