holderdeord/hdo-site

View on GitHub

Showing 302 of 302 total issues

Function template has 60 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  function template(templateSpec, env) {
    if (!env) {
      throw new Exception("No environment passed to template");
    }

Severity: Major
Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 2 hrs to fix

    Function __module3__ has 59 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

    var __module3__ = (function(__dependency1__) {
      "use strict";
      var __exports__ = {};
      /*jshint -W004 */
      var SafeString = __dependency1__;
    Severity: Major
    Found in app/assets/javascripts/lib/handlebars-v1.3.0.js - About 2 hrs to fix

      Function createCart has 59 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              createCart: function (el) {
                  var items, template, callbacks;
      
                  items = [];
                  template = this.templates['shopping-cart-template'];
      Severity: Major
      Found in app/assets/javascripts/issueEditor.js - About 2 hrs to fix

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

                  $.support.transition && modal.$element.hasClass('fade')?
                    modal.$backdrop.one($.support.transition.end, function () { that.destroyModal(modal) }) :
                    that.destroyModal(modal);
        app/assets/javascripts/twitter/bootstrap/bootstrap-modalmanager.js on lines 247..249

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 82.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

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

                $.support.transition && modal.$element.hasClass('fade')?
                  modal.$backdrop.one($.support.transition.end, function () { that.removeBackdrop(modal) }) :
                  that.removeBackdrop(modal);
        app/assets/javascripts/twitter/bootstrap/bootstrap-modalmanager.js on lines 99..101

        Duplicated Code

        Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

        Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

        When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

        Tuning

        This issue has a mass of 82.

        We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

        The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

        If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

        See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

        Refactorings

        Further Reading

        Function 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/lib/pagedown/Markdown.Editor.js - About 2 hrs to fix

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

            function onTouchStart(event) {
          
              //Exit if slider is already was touched
              if (_this.isTouched || params.onlyExternal) {
                return false
          Severity: Major
          Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js - About 2 hrs to fix

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

                    facetSearch: function (opts) {
                        var baseUrl, root, template, spinner, query, cart, issueId;
            
                        baseUrl  = opts.baseUrl;
                        root     = opts.root;
            Severity: Major
            Found in app/assets/javascripts/issueEditor.js - About 2 hrs to fix

              Method import_vote has a Cognitive Complexity of 17 (exceeds 5 allowed). Consider refactoring.
              Open

                    def import_vote(xvote)
                      log_import xvote
                      xvote.validate!
              
                      vote = Vote.find_by_external_id xvote.external_id
              Severity: Minor
              Found in lib/hdo/import/persister.rb - About 2 hrs to fix

              Cognitive Complexity

              Cognitive Complexity is a measure of how difficult a unit of code is to intuitively understand. Unlike Cyclomatic Complexity, which determines how difficult your code will be to test, Cognitive Complexity tells you how difficult your code will be to read and comprehend.

              A method's cognitive complexity is based on a few simple rules:

              • Code is not considered more complex when it uses shorthand that the language provides for collapsing multiple statements into one
              • Code is considered more complex for each "break in the linear flow of the code"
              • Code is considered more complex when "flow breaking structures are nested"

              Further reading

              Function pushTag has 55 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                  var pushTag = function (tag) {
                    if (!tag || (!tagIsValid) || tag.length <= 0) return;
              
                    if (tagManagerOptions.CapitalizeFirstLetter && tag.length > 1) {
                      tag = tag.charAt(0).toUpperCase() + tag.slice(1).toLowerCase();
              Severity: Major
              Found in app/assets/javascripts/lib/bootstrap-tagsmanager.js - About 2 hrs to fix

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

                    if(isNaN(newHeight) || _this.ie8 && (_height.indexOf('%')>0) ) {
                      newHeight = _this.container.offsetHeight - parseInt(window.getComputedStyle(_this.container, null).getPropertyValue('padding-top'),10) - parseInt(window.getComputedStyle(_this.container, null).getPropertyValue('padding-bottom'),10)
                    }
                Severity: Major
                Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 394..396

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

                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(isNaN(newWidth) || _this.ie8 && (_width.indexOf('%')>0)  ) {
                      newWidth = _this.container.offsetWidth - parseInt(window.getComputedStyle(_this.container, null).getPropertyValue('padding-left'),10) - parseInt(window.getComputedStyle(_this.container, null).getPropertyValue('padding-right'),10)
                    }
                Severity: Major
                Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 2 hrs to fix
                app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 397..399

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

                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

                Class VoteCounts has 21 methods (exceeds 20 allowed). Consider refactoring.
                Open

                    class VoteCounts
                      attr_reader :for_count, :against_count, :absent_count
                
                      def initialize(vote)
                        @for_count     = vote.for_count     || 0
                Severity: Minor
                Found in lib/hdo/stats/vote_counts.rb - About 2 hrs to fix

                  Class IssueUpdater has 21 methods (exceeds 20 allowed). Consider refactoring.
                  Open

                    class IssueUpdater
                  
                      class Unauthorized < StandardError
                      end
                  
                  
                  Severity: Minor
                  Found in lib/hdo/issue_updater.rb - About 2 hrs to fix

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

                      function get(options, callbacks) {
                        var opts = $.extend({ type: 'GET', dataType: 'html' }, options);
                        opts.success = successHandler(callbacks);
                        opts.error = errorHandler(callbacks);
                        $.ajax(opts);
                    Severity: Major
                    Found in app/assets/javascripts/lib/ajax-wrapper.js and 2 other locations - About 2 hrs to fix
                    app/assets/javascripts/lib/ajax-wrapper.js on lines 32..37
                    app/assets/javascripts/lib/ajax-wrapper.js on lines 46..51

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                                v = partial.length === 0
                                    ? '{}'
                                    : gap
                                    ? '{\n' + gap + partial.join(',\n' + gap) + '\n' + mind + '}'
                                    : '{' + partial.join(',') + '}';
                    Severity: Major
                    Found in app/assets/javascripts/conditional/json2.js and 1 other location - About 2 hrs to fix
                    app/assets/javascripts/conditional/json2.js on lines 307..311

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                      function postJSON(options, callbacks) {
                        var opts = $.extend({ type: 'POST', dataType: 'json' }, options);
                        opts.success = successHandler(callbacks);
                        opts.error = errorHandler(callbacks);
                        $.ajax(opts);
                    Severity: Major
                    Found in app/assets/javascripts/lib/ajax-wrapper.js and 2 other locations - About 2 hrs to fix
                    app/assets/javascripts/lib/ajax-wrapper.js on lines 39..44
                    app/assets/javascripts/lib/ajax-wrapper.js on lines 46..51

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                      _this.prependSlide = function (html, slideClassList, el) {
                        if (!html) return;
                        if (html.nodeType) {
                          return _this._extendSwiperSlide(html).prepend()
                        }
                    Severity: Major
                    Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js and 1 other location - About 2 hrs to fix
                    app/assets/javascripts/lib/idangerous.swiper-1.8.7.js on lines 267..275

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                      function getJSON(options, callbacks) {
                        var opts = $.extend({ type: 'GET', dataType: 'json' }, options);
                        opts.success = successHandler(callbacks);
                        opts.error = errorHandler(callbacks);
                        $.ajax(opts);
                    Severity: Major
                    Found in app/assets/javascripts/lib/ajax-wrapper.js and 2 other locations - About 2 hrs to fix
                    app/assets/javascripts/lib/ajax-wrapper.js on lines 32..37
                    app/assets/javascripts/lib/ajax-wrapper.js on lines 39..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 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

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

                                    v = partial.length === 0
                                        ? '[]'
                                        : gap
                                        ? '[\n' + gap + partial.join(',\n' + gap) + '\n' + mind + ']'
                                        : '[' + partial.join(',') + ']';
                    Severity: Major
                    Found in app/assets/javascripts/conditional/json2.js and 1 other location - About 2 hrs to fix
                    app/assets/javascripts/conditional/json2.js on lines 346..350

                    Duplicated Code

                    Duplicated code can lead to software that is hard to understand and difficult to change. The Don't Repeat Yourself (DRY) principle states:

                    Every piece of knowledge must have a single, unambiguous, authoritative representation within a system.

                    When you violate DRY, bugs and maintenance problems are sure to follow. Duplicated code has a tendency to both continue to replicate and also to diverge (leaving bugs as two similar implementations differ in subtle ways).

                    Tuning

                    This issue has a mass of 78.

                    We set useful threshold defaults for the languages we support but you may want to adjust these settings based on your project guidelines.

                    The threshold configuration represents the minimum mass a code block must have to be analyzed for duplication. The lower the threshold, the more fine-grained the comparison.

                    If the engine is too easily reporting duplication, try raising the threshold. If you suspect that the engine isn't catching enough duplication, try lowering the threshold. The best setting tends to differ from language to language.

                    See codeclimate-duplication's documentation for more information about tuning the mass threshold in your .codeclimate.yml.

                    Refactorings

                    Further Reading

                    Severity
                    Category
                    Status
                    Source
                    Language