holderdeord/hdo-site

View on GitHub

Showing 195 of 302 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/lib/pagedown/Markdown.Editor.js - About 3 hrs to fix

    Function onTouchMove has 75 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      function onTouchMove(event) {
    
        // If slider is not touched - exit
        if (!_this.isTouched || params.onlyExternal) return
    
    
    Severity: Major
    Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js - About 3 hrs to fix

      Method generate has 71 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

            def self.generate
              categories = [
                'Arbeidsliv',
                'Arbeidsmiljø',
                'Arbeidsvilkår',
      Severity: Major
      Found in lib/hdo/stats/agenda.rb - About 2 hrs to fix

        Function str has 70 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function str(key, holder) {
        
        // Produce a string from holder[key].
        
                var i,          // The loop counter.
        Severity: Major
        Found in app/assets/javascripts/conditional/json2.js - About 2 hrs to fix

          Method generate_agreement_stats has 69 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                def generate_agreement_stats
                  all_categories = !!ENV['ALL_CATEGORIES']
                  exclude_budget = !!ENV['EXCLUDE_BUDGET']
          
                  sessions     = ParliamentSession.where('start_date > ?', Time.parse('2009-08-31')).order(:start_date).to_a
          Severity: Major
          Found in lib/hdo/import/cli.rb - About 2 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/lib/pagedown/Markdown.Editor.js - About 2 hrs to fix

              Class Proposition has 23 methods (exceeds 20 allowed). Consider refactoring.
              Open

              class Proposition < ActiveRecord::Base
                include Hdo::Search::Index
              
                settings(SearchSettings.default) {
                  mappings {
              Severity: Minor
              Found in app/models/proposition.rb - About 2 hrs to fix

                Function _extendSwiperSlide has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  _this._extendSwiperSlide = function  (el) {
                      el.append = function () {
                        _this.wrapper.appendChild(el);
                        _this.reInit();
                        return el;
                Severity: Major
                Found in app/assets/javascripts/lib/idangerous.swiper-1.8.7.js - About 2 hrs to fix

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

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

                                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

                                    Method import_vote has 52 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

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

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

                                              setupCarts: function () {
                                                  var toggleRow, promiseTemplate, propositionTemplate;
                                      
                                                  this.promiseCart = this.createCart($('.cart[data-type=promises]'));
                                                  this.propositionCart = this.createCart($('.cart[data-type=propositions]'));
                                      Severity: Minor
                                      Found in app/assets/javascripts/issueEditor.js - About 2 hrs to fix
                                        Severity
                                        Category
                                        Status
                                        Source
                                        Language