Class: RuboCop::Cop::PollEverywhere::NullableBoolean
- Inherits:
-
RuboCop::Cop
- Object
- RuboCop::Cop
- RuboCop::Cop::PollEverywhere::NullableBoolean
- Defined in:
- lib/rubocop/cop/polleverywhere/nullable_boolean.rb
Constant Summary collapse
- MSG =
"Boolean database columns cannot be nullable. (https://playbook.polleverywhere.com/conventions/ruby/#migrations)".freeze
Instance Method Summary collapse
Instance Method Details
#on_send(node) ⇒ Object
9 10 11 12 13 |
# File 'lib/rubocop/cop/polleverywhere/nullable_boolean.rb', line 9 def on_send(node) if adding_boolean?(node) && nullable?(node) add_offense(node, location: :expression, message: MSG) end end |
#relevant_file?(file) ⇒ Boolean
15 16 17 |
# File 'lib/rubocop/cop/polleverywhere/nullable_boolean.rb', line 15 def relevant_file?(file) super && file =~ %r(/db/migrate/.+\.rb\z) end |