File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -7,6 +7,9 @@ module TargetRailsVersion
7
7
# Informs the base RuboCop gem that it the Rails version is checked via `requires_gem` API,
8
8
# without needing to call this `#support_target_rails_version` method.
9
9
USES_REQUIRES_GEM_API = true
10
+ # Look for `railties` instead of `rails`, to support apps that only use a subset of `rails`
11
+ # See https://github.com/rubocop/rubocop/pull/11289
12
+ TARGET_GEM_NAME = 'railties' # :nodoc:
10
13
11
14
def minimum_target_rails_version ( version )
12
15
if respond_to? ( :requires_gem )
@@ -33,11 +36,6 @@ def support_target_rails_version?(version)
33
36
@minimum_target_rails_version <= version
34
37
end
35
38
end
36
-
37
- # Look for `railties` instead of `rails`, to support apps that only use a subset of `rails`
38
- # See https://github.com/rubocop/rubocop/pull/11289
39
- TARGET_GEM_NAME = 'railties'
40
- private_constant :TARGET_GEM_NAME
41
39
end
42
40
end
43
41
end
Original file line number Diff line number Diff line change 12
12
13
13
task update_cops_documentation : :yard_for_generate_documentation do
14
14
deps = [ 'Rails' ]
15
+ # NOTE: Insert minimum_target_rails_version after ruby version
16
+ required_rails_version = lambda do |data |
17
+ return '' unless ( version = data . cop . gem_requirements [ RuboCop ::Cop ::TargetRailsVersion ::TARGET_GEM_NAME ] )
18
+
19
+ "NOTE: Required Rails version: #{ version . requirements [ 0 ] [ 1 ] } \n \n "
20
+ end
21
+ extra_info = { required_ruby_version : required_rails_version }
15
22
16
23
# NOTE: Update `<<next>>` version for docs/modules/ROOT/pages/cops_rails.adoc
17
24
# when running release tasks.
18
25
RuboCop ::Rails ::Inject . defaults!
19
26
20
- CopsDocumentationGenerator . new ( departments : deps ) . call
27
+ CopsDocumentationGenerator . new ( departments : deps , extra_info : extra_info ) . call
21
28
end
22
29
23
30
desc 'Syntax check for the documentation comments'
You can’t perform that action at this time.
0 commit comments