codeforamerica/oakland_answers

View on GitHub

Showing 97 of 97 total issues

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

              , slide: function (type, next) {
                  var $active = this.$element.find('.item.active')
                    , $next = next || $active[type]()
                    , isCycling = this.interval
                    , direction = type == 'next' ? 'left' : 'right'
            Severity: Minor
            Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

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

                    var $this = $(this)
                      , data = $this.data('collapse')
                      , options = $.extend({}, $.fn.collapse.defaults, $this.data(), typeof option == 'object' && option)
              Severity: Major
              Found in app/assets/javascripts/bootstrap.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/bootstrap.js on lines 1004..1006

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

              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 $this = $(this)
                      , data = $this.data('modal')
                      , options = $.extend({}, $.fn.modal.defaults, $this.data(), typeof option == 'object' && option)
              Severity: Major
              Found in app/assets/javascripts/bootstrap.js and 1 other location - About 1 hr to fix
              app/assets/javascripts/bootstrap.js on lines 597..599

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

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

                    , show: function () {
                        var $tip
                          , pos
                          , actualWidth
                          , actualHeight
                  Severity: Minor
                  Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

                    Function balanceTags has 40 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        function balanceTags(html) {
                    
                            if (html == "")
                                return "";
                    
                    
                    Severity: Minor
                    Found in app/assets/javascripts/pagedown/Markdown.Sanitizer.js - About 1 hr to fix

                      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

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

                            function makeTables(text) {
                              var blockdata;
                              while ((blockdata = findNextBlock(text)) !== null) {
                                var block = blockdata.block,
                                    bounds = blockdata.bounds,
                        Severity: Minor
                        Found in app/assets/javascripts/Markdown.Extra.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 writeAnchorTag has 35 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                                    function writeAnchorTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
                                        if (m7 == undefined) m7 = "";
                                        var whole_match = m1;
                                        var link_text = m2.replace(/:\/\//g, "~P"); // to prevent auto-linking withing the link. will be converted back after the auto-linker runs
                                        var link_id = m3.toLowerCase();
                            Severity: Minor
                            Found in app/assets/javascripts/pagedown/Markdown.Converter.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

                                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

                                Severity
                                Category
                                Status
                                Source
                                Language