mysociety/alaveteli

View on GitHub

Showing 120 of 632 total issues

Method create has 68 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  def create
    begin
      @token = Stripe::Token.retrieve(params[:stripeToken])

      customer = current_user.pro_account.try(:stripe_customer)
Severity: Major
Found in app/controllers/alaveteli_pro/subscriptions_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 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

                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

                  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

                    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

                      Method public_bodies has 59 lines of code (exceeds 25 allowed). Consider refactoring.
                      Open

                          def public_bodies
                            per_graph = 10
                            minimum_requests = AlaveteliConfiguration::minimum_requests_for_statistics
                            # Make sure minimum_requests is > 0 to avoid division-by-zero
                            minimum_requests = [minimum_requests, 1].max
                      Severity: Major
                      Found in app/models/statistics.rb - About 2 hrs to fix

                        Method body_request_events has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                        Open

                          def body_request_events
                            feed_type = params[:feed_type]
                            raise PermissionDenied.new("#{@public_body.id} != #{params[:id]}") if @public_body.id != params[:id].to_i
                        
                            since_date_str = params[:since_date]
                        Severity: Major
                        Found in app/controllers/api_controller.rb - About 2 hrs to fix

                          Method alert_comment_on_request has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                          Open

                            def self.alert_comment_on_request
                          
                              # We only check comments made in the last month - this means if the
                              # cron jobs broke for more than a month events would be lost, but no
                              # matter. I suspect the performance gain will be needed (with an index on updated_at)
                          Severity: Major
                          Found in app/mailers/request_mailer.rb - About 2 hrs to fix

                            Method alert_tracks has 58 lines of code (exceeds 25 allowed). Consider refactoring.
                            Open

                              def self.alert_tracks
                                done_something = false
                                now = Time.zone.now
                                one_week_ago = now - 7.days
                                User.where(["last_daily_track_email < ?", now - 1.day ]).find_each do |user|
                            Severity: Major
                            Found in app/mailers/track_mailer.rb - About 2 hrs to fix

                              Method show has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                              Open

                                def show
                                  long_cache
                                  @page = get_search_page_from_params
                                  requests_per_page = 25
                              
                              
                              Severity: Major
                              Found in app/controllers/public_body_controller.rb - About 2 hrs to fix

                                Method get_attachment_text_one_file has 57 lines of code (exceeds 25 allowed). Consider refactoring.
                                Open

                                  def get_attachment_text_one_file(content_type, body, charset = 'utf-8')
                                    # note re. charset: TMail always tries to convert email bodies
                                    # to UTF8 by default, so normally it should already be that.
                                    text = ''
                                    # TODO: - tell all these command line tools to return utf-8
                                Severity: Major
                                Found in lib/mail_handler/mail_handler.rb - About 2 hrs to fix

                                  Method down has 54 lines of code (exceeds 25 allowed). Consider refactoring.
                                  Open

                                    def down
                                      # reinstate the columns
                                      add_column :public_body_categories, :locale, :string
                                      add_column :public_body_headings, :locale, :string
                                      add_column :public_body_headings, :name, :string
                                  Severity: Major
                                  Found in db/migrate/20140716131107_create_category_translation_tables.rb - About 2 hrs to fix

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

                                      def self.up
                                        create_table :holidays do |t|
                                          t.column :day, :date
                                          t.column :description, :text
                                        end
                                    Severity: Major
                                    Found in db/migrate/074_create_holidays.rb - About 2 hrs to fix

                                      Function fillInSeriesOptions has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                      Open

                                              function fillInSeriesOptions() {
                                      
                                                  var neededColors = series.length, maxIndex = -1, i;
                                      
                                                  // Subtract the number of series that already have fixed colors or
                                      Severity: Major
                                      Found in app/assets/javascripts/jquery.flot.js - About 2 hrs to fix

                                        Function deparam has 51 lines of code (exceeds 25 allowed). Consider refactoring.
                                        Open

                                            var deparam = function( params, coerce ) {
                                                var obj = {},
                                                coerce_types = { 'true': !0, 'false': !1, 'null': null };
                                        
                                                // If params is an empty string or otherwise falsy, return obj.
                                        Severity: Major
                                        Found in app/assets/javascripts/jquery.deparam.js - About 2 hrs to fix
                                          Severity
                                          Category
                                          Status
                                          Source
                                          Language