rubocop-rails 2.7.0 → 2.7.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5a83fc9ded75b4055903b32234c6c9b878e76b22ee64b7e0d88cf2f54ac690d5
4
- data.tar.gz: cb9cbde85b8117645e16c66d1670cffc61893eba8b5d5e3f530e7e42d81b147f
3
+ metadata.gz: 8cffb4c138d270540b5821e23b2c5450a1939d4b01a2720ce400a8bb510ff90c
4
+ data.tar.gz: e0702c6ae4a7a43a01034b32d64ad67bac55659d6a5ec471685bda3c6d2a43fe
5
5
  SHA512:
6
- metadata.gz: 9df513d510b7a71d81bcf655088528ca642599702eca3f20d83eac18adcc15a3d2ab277760b78b9f86fc90df474409eaee454c6857623a2f459304fb74fdde00
7
- data.tar.gz: 252a9b09c51b33b4ff53454fcc6ccaec41e719c283939475e643074305221a33652a9ab5649b9b2c51f36784bb67eeef5dbceee9b3852de936fed78073241dc0
6
+ metadata.gz: 0ce7f6953d24239b8ce71a2e759da5007eb94a752f34ccb8d738273f5f75c63f57664042964f9766652c16e076996bb294edafc7d687a923c60ae2f56328afd3
7
+ data.tar.gz: b810b20d35548b34813946fff138c204fe0ce4f64a68b2f09e63a69c102ad44cf476a543b8bcf87f9caf42d5312ec277e14d23650100df21fb27fb14cc246216
@@ -417,7 +417,7 @@ Rails/Pluck:
417
417
  Rails/PluckId:
418
418
  Description: 'Use `ids` instead of `pluck(:id)` or `pluck(primary_key)`.'
419
419
  StyleGuide: 'https://rails.rubystyle.guide/#ids'
420
- Enabled: 'pending'
420
+ Enabled: false
421
421
  Safe: false
422
422
  VersionAdded: '2.7'
423
423
 
@@ -77,6 +77,8 @@ module RuboCop
77
77
  [via.value]
78
78
  elsif via.array_type?
79
79
  via.values.map(&:value)
80
+ else
81
+ []
80
82
  end
81
83
  end
82
84
 
@@ -54,7 +54,7 @@ module RuboCop
54
54
 
55
55
  def correct_task_dependency(task_name)
56
56
  if task_name.sym_type?
57
- task_name.source.delete(':|\'|"') + ': :environment'
57
+ "#{task_name.source.delete(':|\'|"')}: :environment"
58
58
  else
59
59
  "#{task_name.source} => :environment"
60
60
  end
@@ -27,20 +27,12 @@ module RuboCop
27
27
  class RenderInline < Cop
28
28
  MSG = 'Prefer using a template over inline rendering.'
29
29
 
30
- def_node_matcher :render_with_options?, <<~PATTERN
31
- (send nil? :render $(hash ...))
30
+ def_node_matcher :render_with_inline_option?, <<~PATTERN
31
+ (send nil? :render (hash <(pair {(sym :inline) (str "inline")} _) ...>))
32
32
  PATTERN
33
33
 
34
34
  def on_send(node)
35
- render_with_options?(node) do |options|
36
- add_offense(node) if includes_inline_key?(options)
37
- end
38
- end
39
-
40
- private
41
-
42
- def includes_inline_key?(node)
43
- node.keys.find { |key| key.value.to_sym == :inline }
35
+ add_offense(node) if render_with_inline_option?(node)
44
36
  end
45
37
  end
46
38
  end
@@ -5,6 +5,9 @@ module RuboCop
5
5
  module Rails
6
6
  # This cop checks that environments called with `Rails.env` predicates
7
7
  # exist.
8
+ # By default the cop allows three environments which Rails ships with:
9
+ # `development`, `test`, and `production`.
10
+ # More can be added to the `Environments` config parameter.
8
11
  #
9
12
  # @example
10
13
  # # bad
@@ -56,8 +59,16 @@ module RuboCop
56
59
  def message(name)
57
60
  name = name.to_s.chomp('?')
58
61
 
59
- spell_checker = DidYouMean::SpellChecker.new(dictionary: environments)
60
- similar_names = spell_checker.correct(name)
62
+ # DidYouMean::SpellChecker is not available in all versions of Ruby,
63
+ # and even on versions where it *is* available (>= 2.3), it is not
64
+ # always required correctly. So we do a feature check first. See:
65
+ # https://github.com/rubocop-hq/rubocop/issues/7979
66
+ similar_names = if defined?(DidYouMean::SpellChecker)
67
+ spell_checker = DidYouMean::SpellChecker.new(dictionary: environments)
68
+ spell_checker.correct(name)
69
+ else
70
+ []
71
+ end
61
72
 
62
73
  if similar_names.empty?
63
74
  format(MSG, name: name)
@@ -178,6 +178,8 @@ module RuboCop
178
178
  attr_reader :table_name
179
179
 
180
180
  def initialize(node)
181
+ super(node)
182
+
181
183
  @table_name = node.first_argument.value
182
184
  @columns, @expression = build_columns_or_expr(node.arguments[1])
183
185
  @unique = nil
@@ -4,7 +4,7 @@ module RuboCop
4
4
  module Rails
5
5
  # This module holds the RuboCop Rails version information.
6
6
  module Version
7
- STRING = '2.7.0'
7
+ STRING = '2.7.1'
8
8
  end
9
9
  end
10
10
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: rubocop-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.7.0
4
+ version: 2.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bozhidar Batsov
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2020-07-20 00:00:00.000000000 Z
13
+ date: 2020-07-26 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: activesupport