Skip to content

Commit c3aacdd

Browse files
committed
use PRISM_PARSER in rails/convert_configs_7_0_to_7_1
1 parent 2be83e6 commit c3aacdd

File tree

1 file changed

+11
-5
lines changed

1 file changed

+11
-5
lines changed

lib/rails/convert_configs_7_0_to_7_1.rb

+11-5
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# frozen_string_literal: true
22

33
Synvert::Rewriter.new 'rails', 'convert_configs_7_0_to_7_1' do
4-
configure(parser: Synvert::PARSER_PARSER)
4+
configure(parser: Synvert::PRISM_PARSER)
55

66
description <<~EOS
77
It converts rails configs from 7.0 to 7.1
@@ -17,12 +17,18 @@
1717
call_helper 'rails/set_load_defaults', rails_version: '7.1'
1818

1919
within_files 'config/environments/*.rb' do
20-
find_node '.send[receiver=.send[receiver=.send[receiver=nil][message=config][arguments.size=0]][message=action_dispatch][arguments.size=0]][message=show_exceptions=][arguments.size=1][arguments.0=true]' do
21-
replace :arguments, with: ':all'
20+
with_node node_type: 'call_node',
21+
receiver: { node_type: 'call_node', receiver: 'config', name: 'action_dispatch' },
22+
name: 'show_exceptions=',
23+
arguments: { node_type: 'arguments_node', arguments: { size: 1, first: true } } do
24+
replace 'arguments.arguments', with: ':all'
2225
end
2326

24-
find_node '.send[receiver=.send[receiver=.send[receiver=nil][message=config][arguments.size=0]][message=action_dispatch][arguments.size=0]][message=show_exceptions=][arguments.size=1][arguments.0=false]' do
25-
replace :arguments, with: ':none'
27+
with_node node_type: 'call_node',
28+
receiver: { node_type: 'call_node', receiver: 'config', name: 'action_dispatch' },
29+
name: 'show_exceptions=',
30+
arguments: { node_type: 'arguments_node', arguments: { size: 1, first: false } } do
31+
replace 'arguments.arguments', with: ':none'
2632
end
2733
end
2834
end

0 commit comments

Comments
 (0)