puffer/puffer_pages

View on GitHub

Showing 219 of 219 total issues

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

  function highlightLine(cm, line, state) {
    // A styles array always starts with a number identifying the
    // mode/overlays that it is based on (for easy invalidation).
    var st = [cm.view.modeGen];
    // Compute the base array of styles
Severity: Minor
Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

    Function addChange has 9 arguments (exceeds 4 allowed). Consider refactoring.
    Open

      function addChange(cm, start, added, old, origin, fromBefore, toBefore, fromAfter, toAfter) {
    Severity: Major
    Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

      Function CodeMirror has 28 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

        function CodeMirror(place, options) {
          if (!(this instanceof CodeMirror)) return new CodeMirror(place, options);
          
          this.options = options = options || {};
          // Determine effective options based on given values and defaults.
      Severity: Minor
      Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

        Method read_template_file has 28 lines of code (exceeds 25 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 1 hr to fix

          Function addWidget has 26 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              addWidget: function(pos, node, scroll, vert, horiz) {
                var display = this.display;
                pos = cursorCoords(this, clipPos(this.view.doc, pos));
                var top = pos.top, left = pos.left;
                node.style.position = "absolute";
          Severity: Minor
          Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

            Function findMatchingBracket has 26 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

              function findMatchingBracket(cm) {
                var cur = cm.getCursor(), line = cm.getLineHandle(cur.line), pos = cur.ch - 1;
                var match = (pos >= 0 && matching[line.text.charAt(pos)]) || matching[line.text.charAt(++pos)];
                if (!match) return null;
                var forward = match.charAt(1) == ">", d = forward ? 1 : -1;
            Severity: Minor
            Found in app/assets/javascripts/puffer/matchbrackets.js - About 1 hr to fix

              Function select has 26 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                select: function() {
                  if (this.dogPiling(arguments)) { return this; }
              
                  var result  = old_select.apply(this, arguments);
                  var url     = R(this.link.get('href'));
              Severity: Minor
              Found in app/assets/javascripts/puffer/right-tabs-src.js - About 1 hr to fix

                Consider simplifying this complex logical expression.
                Open

                    if (cm.options.dragDrop && dragAndDrop && !isReadOnly(cm) && !posEq(sel.from, sel.to) &&
                        !posLess(start, sel.from) && !posLess(sel.to, start) && type == "single") {
                      var dragEnd = operation(cm, function(e2) {
                        if (webkit) display.scroller.draggable = false;
                        view.draggingText = false;
                Severity: Major
                Found in app/assets/javascripts/puffer/codemirror.js - About 1 hr to fix

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

                    function pass() {
                      for (var i = arguments.length - 1; i >= 0; i--) curState.cc.push(arguments[i]);
                    }
                  Severity: Major
                  Found in app/assets/javascripts/puffer/codemirror/xml.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/puffer/codemirror/javascript.js on lines 191..193

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

                  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

                        if (this.display.scroller.scrollWidth > sLeft)
                          this.display.scrollbarH.scrollLeft = this.display.scroller.scrollLeft = sLeft;
                  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 2845..2846

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

                  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

                        if (this.display.scroller.scrollHeight > sTop)
                          this.display.scrollbarV.scrollTop = this.display.scroller.scrollTop = sTop;
                  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 2847..2848

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

                  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 pass() {
                      for (var i = arguments.length - 1; i >= 0; i--) cx.cc.push(arguments[i]);
                    }
                  Severity: Major
                  Found in app/assets/javascripts/puffer/codemirror/javascript.js and 1 other location - About 1 hr to fix
                  app/assets/javascripts/puffer/codemirror/xml.js on lines 169..171

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

                  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

                  Method expires_in has a Cognitive Complexity of 9 (exceeds 5 allowed). Consider refactoring.
                  Open

                          def expires_in expiration
                            fragments = expiration.to_s.split(' ').map(&:strip)
                            times = fragments.map do |fragment|
                              TIME_FORMATS.inject(nil) do |result, (format, multiplier)|
                                break result if result
                  Severity: Minor
                  Found in lib/puffer_pages/liquid/tags/cache.rb - About 55 mins 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

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

                      var one = cm.markText(found.from, {line: found.from.line, ch: found.from.ch + 1},
                                            {className: style});
                  Severity: Minor
                  Found in app/assets/javascripts/puffer/matchbrackets.js and 1 other location - About 50 mins to fix
                  app/assets/javascripts/puffer/matchbrackets.js on lines 39..40

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

                  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 two = found.to && cm.markText(found.to, {line: found.to.line, ch: found.to.ch + 1},
                                                        {className: style});
                  Severity: Minor
                  Found in app/assets/javascripts/puffer/matchbrackets.js and 1 other location - About 50 mins to fix
                  app/assets/javascripts/puffer/matchbrackets.js on lines 37..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 52.

                  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 updateDoc has 6 arguments (exceeds 4 allowed). Consider refactoring.
                  Open

                    function updateDoc(cm, from, to, newText, selUpdate, origin) {
                  Severity: Minor
                  Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                    Function updateDocNoUndo has 6 arguments (exceeds 4 allowed). Consider refactoring.
                    Open

                      function updateDocNoUndo(cm, from, to, lines, selUpdate, origin) {
                    Severity: Minor
                    Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                      Avoid deeply nested control flow statements.
                      Open

                                  if (posEq(newPos, curPos)) {
                                    newPos.ch += dir;
                                    if (newPos.ch < 0) {
                                      if (newPos.line) newPos = clipPos(doc, {line: newPos.line - 1});
                                      else newPos = null;
                      Severity: Major
                      Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                        Avoid deeply nested control flow statements.
                        Open

                                    if (m.className) spanStyle += " " + m.className;
                        Severity: Major
                        Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix

                          Avoid deeply nested control flow statements.
                          Open

                                        if (pos < j) order.splice(at, 0, {from: pos, to: j, level: 1});
                          Severity: Major
                          Found in app/assets/javascripts/puffer/codemirror.js - About 45 mins to fix
                            Severity
                            Category
                            Status
                            Source
                            Language