codeforamerica/oakland_answers

View on GitHub

Showing 97 of 97 total issues

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

          $.support.transition && this.$element.hasClass('fade')?
            this.$backdrop.one($.support.transition.end, callback) :
            callback()
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 578..580

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

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

      $.support.transition && this.$element.hasClass('collapse') ?
        this.$element.one($.support.transition.end, complete) :
        complete()
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 986..988

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

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

        function _FormParagraphs(text, doNotUnhash) {
            //
            //  Params:
            //    $text - string to process with html <p> tags
            //
Severity: Minor
Found in app/assets/javascripts/pagedown/Markdown.Converter.js - About 1 hr to fix

    Function applyPlacement has 31 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      , applyPlacement: function(offset, placement){
          var $tip = this.tip()
            , width = $tip[0].offsetWidth
            , height = $tip[0].offsetHeight
            , actualWidth
    Severity: Minor
    Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

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

        Markdown.Extra.init = function(converter, options) {
          // Each call to init creates a new instance of Markdown.Extra so it's
          // safe to have multiple converters on a single page
          var extra = new Markdown.Extra();
      
      
      Severity: Minor
      Found in app/assets/javascripts/Markdown.Extra.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 Autocomplete has 30 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

              $.Indextank.Autocomplete = function(el, options){
                  // To avoid scope issues, use 'base' instead of 'this'
                  // to reference this class from internal events and functions.
                  var base = this;
                  
          Severity: Minor
          Found in app/assets/javascripts/indextank/jquery.indextank.autocomplete.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 writeImageTag has 29 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          function writeImageTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
                              var whole_match = m1;
                              var alt_text = m2;
                              var link_id = m3.toLowerCase();
                              var url = m4;
                  Severity: Minor
                  Found in app/assets/javascripts/pagedown/Markdown.Converter.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

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

                            if (options.extensions.indexOf("fencedCodeBlocks") != -1) {
                              converter.hooks.chain("preConversion", function(text) {
                                return extra.fencedCodeBlocks(text);
                              });
                            }
                      Severity: Major
                      Found in app/assets/javascripts/Markdown.Extra.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/Markdown.Extra.js on lines 35..39

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

                      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 (options.extensions.indexOf("tables") != -1) {
                              converter.hooks.chain("preConversion", function(text) {
                                return extra.tables(text);
                              });
                            }
                      Severity: Major
                      Found in app/assets/javascripts/Markdown.Extra.js and 1 other location - About 1 hr to fix
                      app/assets/javascripts/Markdown.Extra.js on lines 40..44

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

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

                        Markdown.Extra.prototype.fencedCodeBlocks = function(text) {
                          function encodeCode(code) {
                            code = code.replace(/&/g, "&amp;");
                            code = code.replace(/</g, "&lt;");
                            code = code.replace(/>/g, "&gt;");
                      Severity: Minor
                      Found in app/assets/javascripts/Markdown.Extra.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 _ProcessListItems has 26 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                                  function _ProcessListItems(list_str, list_type) {
                                      //
                                      //  Process the contents of a single ordered or unordered list, splitting it
                                      //  into individual list items.
                                      //
                          Severity: Minor
                          Found in app/assets/javascripts/pagedown/Markdown.Converter.js - About 1 hr to fix

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

                              , keydown: function (e) {
                                  var $this
                                    , $items
                                    , $active
                                    , $parent
                            Severity: Minor
                            Found in app/assets/javascripts/bootstrap.js - About 1 hr to fix

                              Function writeImageTag has 8 arguments (exceeds 4 allowed). Consider refactoring.
                              Open

                                      function writeImageTag(wholeMatch, m1, m2, m3, m4, m5, m6, m7) {
                              Severity: Major
                              Found in app/assets/javascripts/pagedown/Markdown.Converter.js - About 1 hr to fix
                                Severity
                                Category
                                Status
                                Source
                                Language