tansaku/LocalSupport

View on GitHub

Showing 943 of 943 total issues

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

  def search
    @parsed_params = SearchParamsParser.new(params)
    @cat_name_ids = Category.name_and_id_for_what_who_and_how
    @organisations = Queries::Organisations.search_by_keyword_and_category(
      @parsed_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. [8/5] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

    def self.build params
      params.permit(
          :id,
          :email,
          :password,
Severity: Minor
Found in app/controllers/users_controller.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. [8/5] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

  def destroy
    user = User.find(params[:id])
    if user == current_user
      flash[:error] = "You may not destroy your own account!"
    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/5] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

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

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

  def destroy
    unless current_user.try(:superadmin?)
      flash[:notice] = PERMISSION_DENIED
      redirect_to organisation_path(params[:id]) and return false
    end

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

  def show
    url = 'https://api.github.com/repos/AgileVentures/LocalSupport/contributors'
    uri = URI.parse url
    request = Net::HTTP::Get.new(uri.request_uri)
    http = Net::HTTP.new(uri.host, uri.port)

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

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

  def show
    render template: 'pages/404', status: 404 and return if @volunteer_op.nil?
    @organisation = Organisation.friendly.find(@volunteer_op.organisation_id)
    organisations = Organisation.where(id: @organisation.id)
    @editable = current_user.can_edit?(@organisation) if current_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. [7/5] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

    def self.add_recently_updated_and_has_owner(organisations)
      one_year_ago = Time.current.advance(years: -1)
      recently_updated = "organisations.updated_at > '#{one_year_ago.strftime(FORMAT)}'"
      has_owner = "organisations.id IN (SELECT users.organisation_id FROM users)"
      condition =

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

  def initialize(listener, params, model_klass, user_klass, mailer_klass)
    @listener = listener
    @params = params
    @organisation = params[:organisation]
    @editor = params[:editor]

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

  def self.run
    old = ActiveRecord::Base.record_timestamps
    ActiveRecord::Base.record_timestamps = false
    begin
      yield
Severity: Minor
Found in app/services/without_timestamps.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. [7/5] (https://github.com/bbatsov/ruby-style-guide#short-methods)
Open

  def open_graph_tags
    {
        title: meta_tag_title,
        site: 'Harrow Community Network',
        reverse: true,

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

  def white_listed
    %w(
        application
        contributors
        organisations

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

  def show
    render template: 'pages/404', status: 404 and return if @volunteer_op.nil?
    @organisation = Organisation.friendly.find(@volunteer_op.organisation_id)
    organisations = Organisation.where(id: @organisation.id)
    @editable = current_user.can_edit?(@organisation) if current_user

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

  def populate_vol_op_attributes(op, model, coordinates)
    model.source = 'reachskills'
    model.latitude = coordinates ? coordinates.latitude.to_f : 0.0
    model.longitude = coordinates ? coordinates.longitude.to_f : 0.0
    model.title = op['node']['title']

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.

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

  def restrict_by_feature_scope
    if Feature.active?(:doit_volunteer_opportunities) &&
       Feature.active?(:reachskills_volunteer_opportunities)
      return :all
    end

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

  def can_add_or_invite_admin?(email)
    return false if email.blank?
    usr = User.find_by_email(email)
    return add_and_notify(usr) if usr.present?
    result = ::SingleInviteJob.new(self, email).invite_user
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.

Severity
Category
Status
Source
Language