mysociety/alaveteli

View on GitHub

Showing 136 of 1,294 total issues

File subscriptions_controller_spec.rb has 560 lines of code (exceeds 250 allowed). Consider refactoring.
Open

require File.expand_path(File.dirname(__FILE__) + '/../../spec_helper')
require 'stripe_mock'

describe AlaveteliPro::SubscriptionsController do
  let(:stripe_helper) { StripeMock.create_test_helper }
Severity: Major
Found in spec/controllers/alaveteli_pro/subscriptions_controller_spec.rb - About 1 day to fix

    File routes.rb has 547 lines of code (exceeds 250 allowed). Consider refactoring.
    Open

    include AlaveteliFeatures::Constraints
    
    # Allow easy extension from themes. Note these will have the highest priority.
    $alaveteli_route_extensions.each do |f|
      load File.join('config', f)
    Severity: Major
    Found in config/routes.rb - About 1 day to fix

      File admin_public_body_categories_controller_spec.rb has 521 lines of code (exceeds 250 allowed). Consider refactoring.
      Open

      require 'spec_helper'
      
      describe AdminPublicBodyCategoriesController do
      
        describe 'GET index' do
      Severity: Major
      Found in spec/controllers/admin_public_body_categories_controller_spec.rb - About 1 day to fix

        Method get_language_name has 191 lines of code (exceeds 25 allowed). Consider refactoring.
        Open

          def self.get_language_name(locale)
            language_names = {
              'ab'    => 'аҧсуа',
              'aa'    => 'Afaraf',
              'af'    => 'Afrikaans',
        Severity: Major
        Found in lib/languages.rb - About 7 hrs to fix

          Function drawSeriesLines has 187 lines of code (exceeds 25 allowed). Consider refactoring.
          Open

                  function drawSeriesLines(series) {
                      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 7 hrs to fix

            Function drawGrid has 177 lines of code (exceeds 25 allowed). Consider refactoring.
            Open

                    function drawGrid() {
                        var i, axes, bw, bc;
            
                        ctx.save();
                        ctx.translate(plotOffset.left, plotOffset.top);
            Severity: Major
            Found in app/assets/javascripts/jquery.flot.js - About 7 hrs to fix

              Function processData has 167 lines of code (exceeds 25 allowed). Consider refactoring.
              Open

                      function processData() {
                          var topSentry = Number.POSITIVE_INFINITY,
                              bottomSentry = Number.NEGATIVE_INFINITY,
                              fakeInfinity = Number.MAX_VALUE,
                              i, j, k, m, length,
              Severity: Major
              Found in app/assets/javascripts/jquery.flot.js - About 6 hrs to fix

                Function d3TimeSeries has 158 lines of code (exceeds 25 allowed). Consider refactoring.
                Open

                function d3TimeSeries(selector, data, title, metric_name) {
                
                  // Add the title
                  var wrapper_element = document.querySelectorAll(selector)[0];
                
                
                Severity: Major
                Found in app/assets/javascripts/time_series.js - About 6 hrs to fix

                  Function setup has 141 lines of code (exceeds 25 allowed). Consider refactoring.
                  Open

                          setup: function() {
                              var self      = this;
                              var settings  = self.settings;
                              var eventNS   = self.eventNS;
                              var $window   = $(window);
                  Severity: Major
                  Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 5 hrs to fix

                    Function selectize has 118 lines of code (exceeds 25 allowed). Consider refactoring.
                    Open

                        $.fn.selectize = function(settings_user) {
                            var defaults             = $.fn.selectize.defaults;
                            var settings             = $.extend({}, defaults, settings_user);
                            var attr_data            = settings.dataAttr;
                            var field_label          = settings.labelField;
                    Severity: Major
                    Found in app/assets/javascripts/alaveteli_pro/selectize.js - About 4 hrs to fix

                      Method list has 114 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                        def list
                          long_cache
                          # TODO: move some of these tag SQL queries into has_tag_string.rb
                      
                          like_query = params[:public_body_query]
                      Severity: Major
                      Found in app/controllers/public_body_controller.rb - About 4 hrs to fix

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

                            function init(plot) {
                                // Taken from flot-axislabels.
                                // 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
                        Severity: Major
                        Found in app/assets/javascripts/jquery.flot.tickrotor.js - About 4 hrs to fix

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