Fix all Layout/SpaceInLambdaLiteral rubocop issues and remove files from rubocop_todo list
This commit is contained in:
@@ -557,17 +557,6 @@ Style/RescueModifier:
|
|||||||
- 'app/controllers/concerns/commentable_actions.rb'
|
- 'app/controllers/concerns/commentable_actions.rb'
|
||||||
- 'app/controllers/verification/sms_controller.rb'
|
- 'app/controllers/verification/sms_controller.rb'
|
||||||
|
|
||||||
# Offense count: 9
|
|
||||||
# Cop supports --auto-correct.
|
|
||||||
# Configuration parameters: EnforcedStyle, SupportedStyles.
|
|
||||||
# SupportedStyles: require_no_space, require_space
|
|
||||||
Layout/SpaceInLambdaLiteral:
|
|
||||||
Exclude:
|
|
||||||
- 'app/models/concerns/filterable.rb'
|
|
||||||
- 'app/models/spending_proposal.rb'
|
|
||||||
- 'app/models/user.rb'
|
|
||||||
- 'app/models/verified_user.rb'
|
|
||||||
|
|
||||||
# Offense count: 8
|
# Offense count: 8
|
||||||
# Cop supports --auto-correct.
|
# Cop supports --auto-correct.
|
||||||
Layout/SpaceInsideParens:
|
Layout/SpaceInsideParens:
|
||||||
|
|||||||
@@ -2,8 +2,8 @@ module Filterable
|
|||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
scope :by_official_level, -> (official_level) { where(users: { official_level: official_level }).joins(:author) }
|
scope :by_official_level, ->(official_level) { where(users: { official_level: official_level }).joins(:author) }
|
||||||
scope :by_date_range, -> (date_range) { where(created_at: date_range) }
|
scope :by_date_range, ->(date_range) { where(created_at: date_range) }
|
||||||
end
|
end
|
||||||
|
|
||||||
class_methods do
|
class_methods do
|
||||||
|
|||||||
@@ -31,9 +31,9 @@ class SpendingProposal < ActiveRecord::Base
|
|||||||
scope :not_unfeasible, -> { where("feasible IS ? OR feasible = ?", nil, true) }
|
scope :not_unfeasible, -> { where("feasible IS ? OR feasible = ?", nil, true) }
|
||||||
scope :with_supports, -> { where('cached_votes_up > 0') }
|
scope :with_supports, -> { where('cached_votes_up > 0') }
|
||||||
|
|
||||||
scope :by_admin, -> (admin) { where(administrator_id: admin.presence) }
|
scope :by_admin, ->(admin) { where(administrator_id: admin.presence) }
|
||||||
scope :by_tag, -> (tag_name) { tagged_with(tag_name) }
|
scope :by_tag, ->(tag_name) { tagged_with(tag_name) }
|
||||||
scope :by_valuator, -> (valuator) { where("valuation_assignments.valuator_id = ?", valuator.presence).joins(:valuation_assignments) }
|
scope :by_valuator, ->(valuator) { where("valuation_assignments.valuator_id = ?", valuator.presence).joins(:valuation_assignments) }
|
||||||
|
|
||||||
scope :for_render, -> { includes(:geozone) }
|
scope :for_render, -> { includes(:geozone) }
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ class User < ActiveRecord::Base
|
|||||||
scope :officials, -> { where("official_level > 0") }
|
scope :officials, -> { where("official_level > 0") }
|
||||||
scope :newsletter, -> { where(newsletter: true) }
|
scope :newsletter, -> { where(newsletter: true) }
|
||||||
scope :for_render, -> { includes(:organization) }
|
scope :for_render, -> { includes(:organization) }
|
||||||
scope :by_document, -> (document_type, document_number) { where(document_type: document_type, document_number: document_number) }
|
scope :by_document, ->(document_type, document_number) { where(document_type: document_type, document_number: document_number) }
|
||||||
scope :email_digest, -> { where(email_digest: true) }
|
scope :email_digest, -> { where(email_digest: true) }
|
||||||
scope :active, -> { where(erased_at: nil) }
|
scope :active, -> { where(erased_at: nil) }
|
||||||
scope :erased, -> { where.not(erased_at: nil) }
|
scope :erased, -> { where.not(erased_at: nil) }
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
class VerifiedUser < ActiveRecord::Base
|
class VerifiedUser < ActiveRecord::Base
|
||||||
scope :by_user, -> (user) { where(document_number: user.document_number) }
|
scope :by_user, ->(user) { where(document_number: user.document_number) }
|
||||||
|
|
||||||
scope :by_email, -> (email) { where(email: email) }
|
scope :by_email, ->(email) { where(email: email) }
|
||||||
scope :by_phone, -> (phone) { where(phone: phone) }
|
scope :by_phone, ->(phone) { where(phone: phone) }
|
||||||
|
|
||||||
def self.phone?(user)
|
def self.phone?(user)
|
||||||
by_user(user).by_phone(user.unconfirmed_phone).first.present?
|
by_user(user).by_phone(user.unconfirmed_phone).first.present?
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ module GraphQL
|
|||||||
field(field_name, SCALAR_TYPES[field_type], model.human_attribute_name(field_name))
|
field(field_name, SCALAR_TYPES[field_type], model.human_attribute_name(field_name))
|
||||||
when :singular_association
|
when :singular_association
|
||||||
field(field_name, -> { created_types[field_type] }) do
|
field(field_name, -> { created_types[field_type] }) do
|
||||||
resolve -> (object, arguments, context) do
|
resolve ->(object, arguments, context) do
|
||||||
association_target = object.send(field_name)
|
association_target = object.send(field_name)
|
||||||
association_target.present? ? field_type.public_for_api.find_by(id: association_target.id) : nil
|
association_target.present? ? field_type.public_for_api.find_by(id: association_target.id) : nil
|
||||||
end
|
end
|
||||||
@@ -50,7 +50,7 @@ module GraphQL
|
|||||||
when :multiple_association
|
when :multiple_association
|
||||||
field_type = field_type.first
|
field_type = field_type.first
|
||||||
connection(field_name, -> { created_types[field_type].connection_type }, max_page_size: 50, complexity: 1000) do
|
connection(field_name, -> { created_types[field_type].connection_type }, max_page_size: 50, complexity: 1000) do
|
||||||
resolve -> (object, arguments, context) { object.send(field_name).public_for_api }
|
resolve ->(object, arguments, context) { object.send(field_name).public_for_api }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -14,13 +14,13 @@ module GraphQL
|
|||||||
type created_type
|
type created_type
|
||||||
description model.graphql_field_description
|
description model.graphql_field_description
|
||||||
argument :id, !types.ID
|
argument :id, !types.ID
|
||||||
resolve -> (object, arguments, context) { model.public_for_api.find_by(id: arguments['id'])}
|
resolve ->(object, arguments, context) { model.public_for_api.find_by(id: arguments['id'])}
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
connection(model.graphql_pluralized_field_name, created_type.connection_type, max_page_size: 50, complexity: 1000) do
|
connection(model.graphql_pluralized_field_name, created_type.connection_type, max_page_size: 50, complexity: 1000) do
|
||||||
description model.graphql_pluralized_field_description
|
description model.graphql_pluralized_field_description
|
||||||
resolve -> (object, arguments, context) { model.public_for_api }
|
resolve ->(object, arguments, context) { model.public_for_api }
|
||||||
end
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ describe 'HasOrders' do
|
|||||||
controller(FakeController) do
|
controller(FakeController) do
|
||||||
include HasOrders
|
include HasOrders
|
||||||
has_orders ['created_at', 'votes_count', 'flags_count', 'relevance'], only: :index
|
has_orders ['created_at', 'votes_count', 'flags_count', 'relevance'], only: :index
|
||||||
has_orders -> (c) { ['votes_count', 'flags_count'] }, only: :new
|
has_orders ->(c) { ['votes_count', 'flags_count'] }, only: :new
|
||||||
|
|
||||||
def index
|
def index
|
||||||
render text: "#{@current_order} (#{@valid_orders.join(' ')})"
|
render text: "#{@current_order} (#{@valid_orders.join(' ')})"
|
||||||
|
|||||||
Reference in New Issue
Block a user