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 +4 -4
- data/config/default.yml +1 -1
- data/lib/rubocop/cop/rails/match_route.rb +2 -0
- data/lib/rubocop/cop/rails/rake_environment.rb +1 -1
- data/lib/rubocop/cop/rails/render_inline.rb +3 -11
- data/lib/rubocop/cop/rails/unknown_env.rb +13 -2
- data/lib/rubocop/rails/schema_loader/schema.rb +2 -0
- data/lib/rubocop/rails/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8cffb4c138d270540b5821e23b2c5450a1939d4b01a2720ce400a8bb510ff90c
|
4
|
+
data.tar.gz: e0702c6ae4a7a43a01034b32d64ad67bac55659d6a5ec471685bda3c6d2a43fe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0ce7f6953d24239b8ce71a2e759da5007eb94a752f34ccb8d738273f5f75c63f57664042964f9766652c16e076996bb294edafc7d687a923c60ae2f56328afd3
|
7
|
+
data.tar.gz: b810b20d35548b34813946fff138c204fe0ce4f64a68b2f09e63a69c102ad44cf476a543b8bcf87f9caf42d5312ec277e14d23650100df21fb27fb14cc246216
|
data/config/default.yml
CHANGED
@@ -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 :
|
31
|
-
(send nil? :render
|
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
|
-
|
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
|
-
|
60
|
-
|
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)
|
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.
|
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-
|
13
|
+
date: 2020-07-26 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: activesupport
|