mysociety/alaveteli

View on GitHub

Showing 136 of 1,294 total issues

Method xapian_index has 82 lines of code (exceeds 25 allowed). Consider refactoring.
Open

    def xapian_index(terms = true, values = true, texts = true)
      # if we have a conditional function for indexing, call it and destroy object if failed
      if self.class.xapian_options.include?(:if)
        if_value = xapian_value(self.class.xapian_options[:if], :boolean)
        if not if_value
Severity: Major
Found in lib/acts_as_xapian/acts_as_xapian.rb - About 3 hrs to fix

    Function insertLegend has 81 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

            function insertLegend() {
    
                placeholder.find(".legend").remove();
    
                if (!options.legend.show)
    Severity: Major
    Found in app/assets/javascripts/jquery.flot.js - About 3 hrs to fix

      Function drawBar has 81 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              function drawBar(x, y, b, barLeft, barRight, fillStyleCallback, axisx, axisy, c, horizontal, lineWidth) {
                  var left, right, bottom, top,
                      drawLeft, drawRight, drawTop, drawBottom,
                      tmp;
      
      
      Severity: Major
      Found in app/assets/javascripts/jquery.flot.js - About 3 hrs to fix

        Function drawSeriesErrors has 77 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

            function drawSeriesErrors(plot, ctx, s){
        
                var points = s.datapoints.points,
                        ps = s.datapoints.pointsize,
                        ax = [s.xaxis, s.yaxis],
        Severity: Major
        Found in app/assets/javascripts/jquery.flot.errorbars.js - About 3 hrs to fix

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

                  onKeyDown: function(e) {
                      var isInput = e.target === this.$control_input[0];
                      var self = this;
              
                      if (self.isLocked) {
          Severity: Major
          Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 3 hrs to fix

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

                function init(plot) {
                    // This is kind of a hack. There are no hooks in Flot between
                    // the creation and measuring of the ticks (setTicks, measureTickLabels
                    // in setupGrid() ) and the drawing of the ticks and plot box
                    // (insertAxisLabels in setupGrid() ).
            Severity: Major
            Found in app/assets/javascripts/jquery.flot.axislabels.js - About 3 hrs to fix

              Method up has 74 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def up
                  default_locale = AlaveteliLocalization.default_locale
              
                  fields = {:title => :text,
                            :description => :text}
              Severity: Major
              Found in db/migrate/20140716131107_create_category_translation_tables.rb - About 2 hrs to fix

                Function findNearbyItem has 72 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                        function findNearbyItem(mouseX, mouseY, seriesFilter) {
                            var maxDistance = options.grid.mouseActiveRadius,
                                smallestDistance = maxDistance * maxDistance + 1,
                                item = null, foundPoint = false, i, j, ps;
                
                
                Severity: Major
                Found in app/assets/javascripts/jquery.flot.js - About 2 hrs to fix

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

                    def initialize(user)
                      # Define abilities for the passed in user here. For example:
                      #
                      #   user ||= User.new # guest user (not logged in)
                      #   if user.is_admin?
                  Severity: Major
                  Found in app/models/ability.rb - About 2 hrs to fix

                    Method add_correspondence has 70 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                      def add_correspondence
                        json = ActiveSupport::JSON.decode(params[:correspondence_json])
                        attachments = params[:attachments]
                    
                        direction = json["direction"]
                    Severity: Major
                    Found in app/controllers/api_controller.rb - About 2 hrs to fix

                      Method index has 67 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def index
                          # Tasks to do
                          @requires_admin_requests = InfoRequest.
                            find_in_state('requires_admin').
                              not_embargoed
                      Severity: Major
                      Found in app/controllers/admin_general_controller.rb - About 2 hrs to fix

                        Function getSortFunction has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                            Sifter.prototype.getSortFunction = function(search, options) {
                                var i, n, self, field, fields, fields_count, multiplier, multipliers, get_field, implicit_score, sort;
                        
                                self   = this;
                                search = self.prepareSearch(search, options);
                        Severity: Major
                        Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 2 hrs to fix

                          Function Selectize has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                              var Selectize = function($input, settings) {
                                  var key, i, n, dir, input, self = this;
                                  input = $input[0];
                                  input.selectize = self;
                              
                          Severity: Major
                          Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 2 hrs to fix

                            Method alert_overdue_requests has 65 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.alert_overdue_requests
                                info_requests = InfoRequest.where("described_state = 'waiting_response'
                                            AND awaiting_description = ?
                                            AND user_id is not null
                                            AND use_notifications = ?
                            Severity: Major
                            Found in app/mailers/request_mailer.rb - About 2 hrs to fix

                              Function plotLine has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                          function plotLine(datapoints, xoffset, yoffset, axisx, axisy) {
                                              var points = datapoints.points,
                                                  ps = datapoints.pointsize,
                                                  prevx = null, prevy = null;
                              
                              
                              Severity: Major
                              Found in app/assets/javascripts/jquery.flot.js - About 2 hrs to fix

                                Function init_select has 64 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                        var init_select = function($input, settings_element) {
                                            var i, n, tagName, $children, order = 0;
                                            var options = settings_element.options;
                                            var optionsMap = {};
                                    
                                Severity: Major
                                Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 2 hrs to fix

                                  Method render_new_compose has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def render_new_compose(batch)
                                      params[:info_request] = { } if !params[:info_request]
                                  
                                      # Reconstruct the params
                                      unless batch
                                  Severity: Major
                                  Found in app/controllers/request_controller.rb - About 2 hrs to fix

                                    Method import_csv_from_file has 62 lines of code (exceeds 25 allowed). Consider refactoring.
                                    Open

                                      def self.import_csv_from_file(csv_filename, tag, tag_behaviour, dry_run, editor, available_locales = [])
                                        errors = []
                                        notes = []
                                        begin
                                          ActiveRecord::Base.transaction do
                                    Severity: Major
                                    Found in app/models/public_body.rb - About 2 hrs to fix

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

                                          MicroPlugin.mixin = function(Interface) {
                                              Interface.plugins = {};
                                      
                                              /**
                                               * Initializes the listed plugins (with options).
                                      Severity: Major
                                      Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 2 hrs to fix

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

                                            Sifter.prototype.getScoreFunction = function(search, options) {
                                                var self, fields, tokens, token_count, nesting;
                                        
                                                self        = this;
                                                search      = self.prepareSearch(search, options);
                                        Severity: Major
                                        Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source