AgileVentures/LocalSupport

View on GitHub

Showing 792 of 792 total issues

Method has too many lines. [12/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

  def populate_vol_op_attributes(op, model, coordinates)
    location = Location.create coordinates
    model.source = 'reachskills'
    model.latitude  = location.latitude
    model.longitude = location.longitude

This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

Function initMap has 56 lines of code (exceeds 25 allowed). Consider refactoring.
Open

  initMap: function initMap() {
    Settings.zoom = parseInt($("#marker_data").data().zoom || '12', 10)
    Settings.lat = parseFloat($("#marker_data").data().latitude || '51.5978')
    Settings.lng = parseFloat($("#marker_data").data().longitude || '-0.3370')
    Settings.geojsonUrl1 = $("#marker_data").data().geojsonUrl1 
Severity: Major
Found in app/assets/javascripts/maps.js - About 2 hrs to fix

    Assignment Branch Condition size for after_sign_in_path_for is too high. [19.42/15] (http://c2.com/cgi/wiki?AbcMetric)
    Open

      def after_sign_in_path_for(resource)
        set_flash_warning_reminder_to_update_details resource
        return edit_user_path id: current_user.id if session[:pending_organisation_id]
        return organisation_path(current_user.organisation) if current_user.organisation
        return session[:previous_url] if session[:previous_url]

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [11/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def self.import(filename, limit, validation)
        csv_text = File.open(filename, 'r:ISO-8859-1')
        count = 0
        CSV.parse(csv_text, headers: true).each do |row|
          break if count >= limit
    Severity: Minor
    Found in app/models/organisation.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Assignment Branch Condition size for populate_vol_op_attributes is too high. [19.21/15] (http://c2.com/cgi/wiki?AbcMetric)
    Open

      def populate_vol_op_attributes model, op
        location = Location.new longitude: op['lng'], latitude: op['lat']
        model.source        = 'doit'
        model.latitude      = location.latitude
        model.longitude     = location.longitude

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for devise_error_messages! is too high. [19.52/15] (http://c2.com/cgi/wiki?AbcMetric)
    Open

      def devise_error_messages!
        return "" if resource.errors.empty?
    
        errors = resource.errors
        reset_token_error = errors.to_hash.fetch(:reset_password_token,'')
    Severity: Minor
    Found in app/helpers/devise_helper.rb by rubocop

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Assignment Branch Condition size for populate_vol_op_attributes is too high. [19.21/15] (http://c2.com/cgi/wiki?AbcMetric)
    Open

      def populate_vol_op_attributes(op, model, coordinates)
        location = Location.create coordinates
        model.source = 'reachskills'
        model.latitude  = location.latitude
        model.longitude = location.longitude

    This cop checks that the ABC size of methods is not higher than the configured maximum. The ABC size is based on assignments, branches (method calls), and conditions. See http://c2.com/cgi/wiki?AbcMetric

    Method has too many lines. [11/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def render_error(status, error)
        raise error unless Rails.env.production?
    
        Rails.logger.error error.message
        error.backtrace.each_with_index { |line, index| Rails.logger.error line; break if index >= 5 }
    Severity: Minor
    Found in lib/custom_errors.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [10/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def parse
        address = value.to_s
        postcode = ''
        match = value.to_s.match(/(.*)(,\s*(\w\w\d\s* \d\w\w))/)
        if match
    Severity: Minor
    Found in app/models/address.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [10/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def serialize_invitations
    
        User.invited_not_accepted.select do |user|
          user.organisation.present? # because invitation data may be 'dirty'
        end.map do |user|

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [10/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def create(validate)
        return nil if @csv_organisation.is_organisation_removed? 
        return nil if organisation_already_exists?
        create_method = validate ? :create_and_validate : :create_and_substitute_with_empty
        @organisation_repository.send(create_method,

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [10/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

        def after_inactive_sign_up_path_for(resource)
          if session[:pending_organisation_id]
            UserOrganisationClaimer.new(self, resource, resource).call(session[:pending_organisation_id])
            return organisation_path resource.pending_organisation 
          elsif session[:proposed_org]

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [10/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def create_response_object(usr)
        return Response.new(Response::SUCCESS, nil) if usr.errors.empty?
        status =  case usr.errors.full_messages.first
          when "Email can't be blank"
            Response::NO_EMAIL

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [10/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

        def self.search_by_keyword_and_category(parsed_params)
          organisations = order_by_most_recent.search_by_keyword(
            parsed_params.query_term
          )
    
    

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [9/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def gmaps4rails_marker_attrs
        if has_been_updated_recently?
          ['marker.png',
            'data-id' => id,
           class: 'marker']
    Severity: Minor
    Found in app/models/base_organisation.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [9/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def self.build
        new({
          name: 'Title',
          address: 'Contact Address',
          description: 'Activities',
    Severity: Minor
    Found in app/models/csv_header.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Cyclomatic complexity for <=> is too high. [8/6]
    Open

        def <=> other
          if (@sym == :what_they_do && other.sym == :how_they_help) || (@sym == :what_they_do && other.sym == :who_they_help) ||
            (@sym == :who_they_help && other.sym == :how_they_help)
            -1
          elsif @sym == other.sym
    Severity: Minor
    Found in app/models/category.rb by rubocop

    This cop checks that the cyclomatic complexity of methods is not higher than the configured maximum. The cyclomatic complexity is the number of linearly independent paths through a method. The algorithm counts decision points and adds one.

    An if statement (or unless or ?:) increases the complexity by one. An else branch does not, since it doesn't add a decision point. The && operator (or keyword and) can be converted to a nested if statement, and ||/or is shorthand for a sequence of ifs, so they also add one. Loops can be said to have an exit condition, so they add one.

    Perceived complexity for <=> is too high. [9/7]
    Open

        def <=> other
          if (@sym == :what_they_do && other.sym == :how_they_help) || (@sym == :what_they_do && other.sym == :who_they_help) ||
            (@sym == :who_they_help && other.sym == :how_they_help)
            -1
          elsif @sym == other.sym
    Severity: Minor
    Found in app/models/category.rb by rubocop

    This cop tries to produce a complexity score that's a measure of the complexity the reader experiences when looking at a method. For that reason it considers when nodes as something that doesn't add as much complexity as an if or a &&. Except if it's one of those special case/when constructs where there's no expression after case. Then the cop treats it as an if/elsif/elsif... and lets all the when nodes count. In contrast to the CyclomaticComplexity cop, this cop considers else nodes as adding complexity.

    Example:

    def my_method                   # 1
      if cond                       # 1
        case var                    # 2 (0.8 + 4 * 0.2, rounded)
        when 1 then func_one
        when 2 then func_two
        when 3 then func_three
        when 4..10 then func_other
        end
      else                          # 1
        do_something until a && b   # 2
      end                           # ===
    end                             # 7 complexity points

    Method has too many lines. [9/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def run
        #for the future this from the devis wiki might be relevant
        #When skip_invitation is used, you must also then set the invitation_sent_at field when the user is sent
        # their token. Failure to do so will yield “Invalid invitation token” errors when the user attempts to
        # accept the invite. You can set it like so:

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Method has too many lines. [9/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
    Open

      def self.from(value)
        [
          '1',
          1,
          'y',
    Severity: Minor
    Found in lib/boolean.rb by rubocop

    This cop checks if the length of a method exceeds some maximum value. Comment lines can optionally be ignored. The maximum allowed length is configurable.

    Severity
    Category
    Status
    Source
    Language