Skip to content

Instantly share code, notes, and snippets.

@backus
Created March 14, 2016 00:03
Show Gist options
  • Save backus/644bbfe9c411e227b63a to your computer and use it in GitHub Desktop.
Save backus/644bbfe9c411e227b63a to your computer and use it in GitHub Desktop.
class SomeModel < ActiveRecord::Base
scope :my_scope, lambda do |param|
where(blah: param)
end
end
#!/bin/sh
bundle exec ruby -v
bundle list
bundle exec rubocop --rails --only Rails/ScopeArgs app/models/example.rb
source 'https://rubygems.org'
ruby '2.3.0'
gem 'rubocop', '0.38.0'
GEM
remote: https://rubygems.org/
specs:
ast (2.2.0)
parser (2.3.0.6)
ast (~> 2.2)
powerpack (0.1.1)
rainbow (2.1.0)
rubocop (0.38.0)
parser (>= 2.3.0.6, < 3.0)
powerpack (~> 0.1)
rainbow (>= 1.99.1, < 3.0)
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.7.5)
unicode-display_width (1.0.2)
PLATFORMS
ruby
DEPENDENCIES
rubocop (= 0.38.0)
BUNDLED WITH
1.11.2
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin15]
Gems included by the bundle:
* ast (2.2.0)
* bundler (1.11.2)
* parser (2.3.0.6)
* powerpack (0.1.1)
* rainbow (2.1.0)
* rubocop (0.38.0)
* ruby-progressbar (1.7.5)
* unicode-display_width (1.0.2)
Inspecting 1 file
C
Offenses:
app/models/example.rb:2:20: C: Use lambda/proc instead of a plain method call.
scope :my_scope, lambda do |param|
^^^^^^
1 file inspected, 1 offense detected
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment