AgileVentures/LocalSupport

View on GitHub

Showing 117 of 792 total issues

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

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. [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 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 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 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 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. [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.

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

  def create
    make_user_into_org_admin_of_new_proposed_org
    @proposed_organisation.check_geocode
    if @proposed_organisation.save
      session[:proposed_organisation_id] = @proposed_organisation.id

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.

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 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.

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.

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

  def build_single_marker(model, marker)
    location = model.first
    models = model.last
    if model.first.try(:source)
      source = VolunteerOp.get_source(models)

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 update is too high. [17.15/15] (http://c2.com/cgi/wiki?AbcMetric)
Open

  def update
    user = User.find_by_id(params[:id])
    if params[:pending_org_action] == "decline"
      UserOrganisationDecliner.new(self, user, current_user).call
    elsif params[:pending_org_action] == "approve"

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. [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.

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

  def update
    # UpdateProposedOrganisationEdit.with(observer: self, params: create_params)
    proposed_edit = ProposedOrganisationEdit.find(update_params.fetch(:id))
    if !proposed_edit_params.empty?
      proposed_edit.accept(proposed_edit_params)

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 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.

Assignment Branch Condition size for after_inactive_sign_up_path_for is too high. [16.16/15] (http://c2.com/cgi/wiki?AbcMetric)
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 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. [8/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

  def upgrade
    user = User.find(params[:id])
    if user.superadmin?
      flash[:error] = 'User already site admin!'
    else

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. [8/7] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

  def index
    @volunteer_ops = displayed_volunteer_ops unless iframe_map?
    @markers = BuildMarkersWithInfoWindow.with(VolunteerOp.build_by_coordinates, self)
    response.headers.delete 'X-Frame-Options' if iframe?

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