mysociety/alaveteli

View on GitHub

Showing 120 of 632 total issues

Method world_foi_websites has 107 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def self.world_foi_websites
    world_foi_websites = [
      { :name => "WhatDoTheyKnow",
        :country_name => "United Kingdom",
        :country_iso_code => "GB",
Severity: Major
Found in lib/world_foi_websites.rb - About 4 hrs to fix

    Method search has 100 lines of code (exceeds 25 allowed). Consider refactoring.
    Open

      def search
        # TODO: Why is this so complicated with arrays and stuff? Look at the route
        # in config/routes.rb for comments.
    
        # 404 if the request is a format we don't support (e.g:.json)
    Severity: Major
    Found in app/controllers/general_controller.rb - About 4 hrs to fix

      Function refreshOptions has 99 lines of code (exceeds 25 allowed). Consider refactoring.
      Open

              refreshOptions: function(triggerDropdown) {
                  var i, j, k, n, groups, groups_order, option, option_html, optgroup, optgroups, html, html_children, has_create_option;
                  var $active, $active_before, $create;
          
                  if (typeof triggerDropdown === 'undefined') {
      Severity: Major
      Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 3 hrs to fix

        Function plotLineArea has 96 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

                    function plotLineArea(datapoints, axisx, axisy) {
                        var points = datapoints.points,
                            ps = datapoints.pointsize,
                            bottom = Math.min(Math.max(0, axisy.min), axisy.max),
                            i = 0, top, areaOpen = false,
        Severity: Major
        Found in app/assets/javascripts/jquery.flot.js - About 3 hrs to fix

          Function setupTickGeneration has 95 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function setupTickGeneration(axis) {
                      var opts = axis.options;
          
                      // estimate number of ticks
                      var noTicks;
          Severity: Major
          Found in app/assets/javascripts/jquery.flot.js - About 3 hrs to fix

            Function parseOptions has 89 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function parseOptions(opts) {
            
                        $.extend(true, options, opts);
            
                        // $.extend merges arrays, rather than replacing them.  When less
            Severity: Major
            Found in app/assets/javascripts/jquery.flot.js - About 3 hrs to fix

              Method new has 89 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                def new
                  # All new requests are of normal_sort
                  if !params[:outgoing_message].nil?
                    params[:outgoing_message][:what_doing] = 'normal_sort'
                  end
              Severity: Major
              Found in app/controllers/request_controller.rb - About 3 hrs to fix

                Method describe_state has 87 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                  def describe_state
                    info_request = InfoRequest.not_embargoed.find(params[:id].to_i)
                    set_last_request(info_request)
                
                    # If this is an external request, go to the request page - we don't allow
                Severity: Major
                Found in app/controllers/request_controller.rb - About 3 hrs to fix

                  Method initialize has 85 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 3 hrs to fix

                    Method xapian_index has 85 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 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

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

                                var setUpCorrespondenceCollapsing = function(){
                                  $('.js-collapsable').each(function(){
                                    var $collapsable = $(this);
                                    var $triggers = $(this).find('.js-collapsable-trigger');
                                    var $correspondenceHeader = $(this).find('.correspondence__header');
                                Severity: Major
                                Found in app/assets/javascripts/correspondence-collapse.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 index has 72 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

                                        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
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language