codeforamerica/oakland_answers

View on GitHub
app/assets/javascripts/pagedown/Markdown.Editor.js

Summary

Maintainability
F
1 wk
Test Coverage

File Markdown.Editor.js has 1512 lines of code (exceeds 250 allowed). Consider refactoring.
Open

// needs Markdown.Converter.js at the moment

(function () {

    var util = {},
Severity: Major
Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 4 days to fix

    Function UIManager has 237 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

        function UIManager(postfix, panels, undoManager, previewManager, commandManager, helpOptions, getString) {
    
            var inputBox = panels.input,
                buttons = {}; // buttons.undo, buttons.link, etc. The actual DOM elements.
    
    
    Severity: Major
    Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 day to fix

      Function UndoManager has 171 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

          function UndoManager(callback, panels) {
      
              var undoObj = this;
              var undoStack = []; // A stack of undo states
              var stackPtr = 0; // The index of the current state
      Severity: Major
      Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 6 hrs to fix

        Function PreviewManager has 139 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function PreviewManager(converter, panels, previewRefreshCallback) {
        
                var managerObj = this;
                var timeout;
                var elapsedTime;
        Severity: Major
        Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 5 hrs to fix

          Function prompt has 102 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              ui.prompt = function (text, defaultInputText, callback) {
          
                  // These variables need to be declared at this level since they are used
                  // in multiple functions.
                  var dialog;         // The dialog box.
          Severity: Major
          Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 4 hrs to fix

            Function TextareaState has 96 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                function TextareaState(panels, isInitialState) {
            
                    // Aliases
                    var stateObj = this;
                    var inputArea = panels.input;
            Severity: Major
            Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 3 hrs to fix

              Function doBlockquote has 94 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  commandProto.doBlockquote = function (chunk, postProcessing) {
              
                      chunk.selection = chunk.selection.replace(/^(\n*)([^\r]+?)(\n*)$/,
                          function (totalMatch, newlinesBefore, text, newlinesAfter) {
                              chunk.before += newlinesBefore;
              Severity: Major
              Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 3 hrs to fix

                Function makeSpritedButtonRow has 76 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function makeSpritedButtonRow() {
                
                            var buttonBar = panels.buttonBar;
                
                            var normalYShift = "0px";
                Severity: Major
                Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 3 hrs to fix

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

                      commandProto.doList = function (chunk, postProcessing, isNumberedList) {
                  
                          // These are identical except at the very beginning and end.
                          // Should probably use the regex extension function to make this clearer.
                          var previousItemsRegex = /(\n|^)(([ ]{0,3}([*+-]|\d+[.])[ \t]+.*)(\n.+|\n{2,}([*+-].*|\d+[.])[ \t]+.*|\n{2,}[ \t]+\S.*)*)\n*$/;
                  Severity: Major
                  Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 2 hrs to fix

                    Function createDialog has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                            var createDialog = function () {
                    
                                // The main dialog box.
                                dialog = doc.createElement("div");
                                dialog.className = "wmd-prompt-dialog";
                    Severity: Major
                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 2 hrs to fix

                      Function doCode has 50 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          commandProto.doCode = function (chunk, postProcessing) {
                      
                              var hasTextBefore = /\S[ ]*$/.test(chunk.before);
                              var hasTextAfter = /^[ ]*\S/.test(chunk.after);
                      
                      
                      Severity: Minor
                      Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 2 hrs to fix

                        Function doLinkOrImage has 45 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            commandProto.doLinkOrImage = function (chunk, postProcessing, isImage) {
                        
                                chunk.trimWhitespace();
                                chunk.findTags(/\s*!?\[/, /\][ ]?(?:\n[ ]*)?(\[.*?\])?/);
                                var background;
                        Severity: Minor
                        Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

                          Function Editor has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              Markdown.Editor = function (markdownConverter, idPostfix, options) {
                                  
                                  options = options || {};
                          
                                  if (typeof options.handler === "function") { //backwards compatible behavior
                          Severity: Minor
                          Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

                            Function skipLines has 43 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                Chunks.prototype.skipLines = function (nLinesBefore, nLinesAfter, findExtraNewlines) {
                            
                                    if (nLinesBefore === undefined) {
                                        nLinesBefore = 1;
                                    }
                            Severity: Minor
                            Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                  commandProto.addLinkDef = function (chunk, linkDef) {
                              
                                      var refNumber = 0; // The current reference number
                                      var defsToAdd = {}; //
                                      // Start with a clean slate by removing all previous link definitions.
                              Severity: Minor
                              Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                        function setupButton(button, isEnabled) {
                                
                                            var normalYShift = "0px";
                                            var disabledYShift = "-20px";
                                            var highlightYShift = "-40px";
                                Severity: Minor
                                Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                      commandProto.doHeading = function (chunk, postProcessing) {
                                  
                                          // Remove leading/trailing whitespace and reduce internal spaces to single spaces.
                                          chunk.selection = chunk.selection.replace(/\s+/g, " ");
                                          chunk.selection = chunk.selection.replace(/(^\s+|\s+$)/g, "");
                                  Severity: Minor
                                  Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                            this.setInputAreaSelectionStartEnd = function () {
                                    
                                                if (!panels.ieCachedRange && (inputArea.selectionStart || inputArea.selectionStart === 0)) {
                                    
                                                    stateObj.start = inputArea.selectionStart;
                                    Severity: Minor
                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                          Chunks.prototype.findTags = function (startRegex, endRegex) {
                                      
                                              var chunkObj = this;
                                              var regex;
                                      
                                      
                                      Severity: Minor
                                      Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                            commandProto.doAutoindent = function (chunk, postProcessing) {
                                        
                                                var commandMgr = this,
                                                    fakeSelection = false;
                                        
                                        
                                        Severity: Minor
                                        Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                              position.getPageSize = function () {
                                          
                                                  var scrollWidth, scrollHeight;
                                                  var innerWidth, innerHeight;
                                          
                                          
                                          Severity: Minor
                                          Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                                    var handleCtrlYZ = function (event) {
                                            
                                                        var handled = false;
                                            
                                                        if (event.ctrlKey || event.metaKey) {
                                            Severity: Minor
                                            Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

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

                                                      function doClick(button) {
                                              
                                                          inputBox.focus();
                                              
                                                          if (button.textOp) {
                                              Severity: Minor
                                              Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 1 hr to fix

                                                Function UIManager has 7 arguments (exceeds 4 allowed). Consider refactoring.
                                                Open

                                                    function UIManager(postfix, panels, undoManager, previewManager, commandManager, helpOptions, getString) {
                                                Severity: Major
                                                Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 50 mins to fix

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

                                                          var getLink = function (wholeMatch, before, inner, afterInner, id, end) {
                                                  Severity: Minor
                                                  Found in app/assets/javascripts/pagedown/Markdown.Editor.js - About 45 mins to fix

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

                                                        var defaultsStrings = {
                                                            bold: "Strong <strong> Ctrl+B",
                                                            boldexample: "strong text",
                                                    
                                                            italic: "Emphasis <em> Ctrl+I",
                                                    Severity: Major
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 4 hrs to fix
                                                    app/assets/javascripts/pagedown/local/Markdown.local.fr.js on lines 7..42

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

                                                    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

                                                        util.addEvent = function (elem, event, listener) {
                                                            if (elem.attachEvent) {
                                                                // IE only.  The "on" is mandatory.
                                                                elem.attachEvent("on" + event, listener);
                                                            }
                                                    Severity: Major
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 1 hr to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 337..346

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

                                                    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

                                                        util.removeEvent = function (elem, event, listener) {
                                                            if (elem.detachEvent) {
                                                                // IE only.  The "on" is mandatory.
                                                                elem.detachEvent("on" + event, listener);
                                                            }
                                                    Severity: Major
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 1 hr to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 323..332

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

                                                    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 (chunk.startTag) {
                                                                    chunk.startTag = chunk.startTag.replace(/\n((>|\s)*)\n$/,
                                                                        function (totalMatch, markdown) {
                                                                            return "\n" + markdown.replace(/^[ ]{0,3}>?[ \t]*$/gm, replacement) + "\n";
                                                                        });
                                                    Severity: Major
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 1 hr to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1940..1945

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

                                                    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 (chunk.endTag) {
                                                                    chunk.endTag = chunk.endTag.replace(/^\n((>|\s)*)\n/,
                                                                        function (totalMatch, markdown) {
                                                                            return "\n" + markdown.replace(/^[ ]{0,3}>?[ \t]*$/gm, replacement) + "\n";
                                                                        });
                                                    Severity: Major
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 1 hr to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1934..1939

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

                                                    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 (!/^(\n|^)[ ]{0,3}>/.test(chunk.selection) && chunk.startTag) {
                                                                    chunk.startTag = chunk.startTag.replace(/\n{0,2}$/, "\n\n");
                                                                }
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 55 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1962..1964

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

                                                    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 (!/(\n|^)[ ]{0,3}>.*$/.test(chunk.selection) && chunk.endTag) {
                                                                    chunk.endTag = chunk.endTag.replace(/^\n{0,2}/, "\n\n");
                                                                }
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 55 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1958..1960

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

                                                    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

                                                                this.selection = this.selection.replace(regex,
                                                                    function (match) {
                                                                        chunkObj.startTag = chunkObj.startTag + match;
                                                                        return "";
                                                                    });
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 50 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 167..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 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

                                                                this.before = this.before.replace(regex,
                                                                    function (match) {
                                                                        chunkObj.startTag = chunkObj.startTag + match;
                                                                        return "";
                                                                    });
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 50 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 175..179

                                                    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

                                                                this.after = this.after.replace(regex,
                                                                    function (match) {
                                                                        chunkObj.endTag = match + chunkObj.endTag;
                                                                        return "";
                                                                    });
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 50 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 186..190

                                                    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

                                                                this.selection = this.selection.replace(regex,
                                                                    function (match) {
                                                                        chunkObj.endTag = match + chunkObj.endTag;
                                                                        return "";
                                                                    });
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 50 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 194..198

                                                    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

                                                                buttons.image = makeButton("wmd-image-button", getString("image"), "-100px", bindCommand(function (chunk, postProcessing) {
                                                                    return this.doLinkOrImage(chunk, postProcessing, true);
                                                                }));
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 35 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1468..1470

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

                                                    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

                                                                buttons.ulist = makeButton("wmd-ulist-button", getString("ulist"), "-140px", bindCommand(function (chunk, postProcessing) {
                                                                    this.doList(chunk, postProcessing, false);
                                                                }));
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 35 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1477..1479

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

                                                    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

                                                                buttons.link = makeButton("wmd-link-button", getString("link"), "-40px", bindCommand(function (chunk, postProcessing) {
                                                                    return this.doLinkOrImage(chunk, postProcessing, false);
                                                                }));
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 35 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1473..1475

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

                                                    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

                                                                buttons.olist = makeButton("wmd-olist-button", getString("olist"), "-120px", bindCommand(function (chunk, postProcessing) {
                                                                    this.doList(chunk, postProcessing, true);
                                                                }));
                                                    Severity: Minor
                                                    Found in app/assets/javascripts/pagedown/Markdown.Editor.js and 1 other location - About 35 mins to fix
                                                    app/assets/javascripts/pagedown/Markdown.Editor.js on lines 1480..1482

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

                                                    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

                                                    There are no issues that match your filters.

                                                    Category
                                                    Status