@@ -84,7 +84,7 @@ def self.perform_report
8484 put_route . verb == "PUT" # rails 5
8585 ) &&
8686 put_route . name . nil? &&
87- @@route_hit_count [ put_route ] == 0 &&
87+ @@route_hit_count [ put_route ] . zero? &&
8888 all_routes . any? do |patch_route |
8989 (
9090 patch_route . verb == /^PATCH$/ ||
@@ -97,21 +97,18 @@ def self.perform_report
9797 end
9898 end
9999
100- all_result = Result . new (
101- all_routes ,
102- @@route_hit_count ,
103- settings
104- )
100+ all_result = Result . new ( all_routes , @@route_hit_count , settings )
105101
106102 groups = settings . groups . map do |group_name , matcher |
107103 group_routes = all_routes . select do |route |
108104 if matcher . respond_to? ( :call )
109105 matcher . call ( route )
110106 elsif matcher . is_a? ( Hash )
111107 matcher . all? do |key , value |
112- if key == :path
108+ case key
109+ when :path
113110 route . path . spec . to_s =~ value
114- elsif key == :constraints
111+ when :constraints
115112 value . all? do |constraint_name , constraint_value |
116113 if constraint_value . present?
117114 route . constraints [ constraint_name ] && route . constraints [ constraint_name ] . match? ( constraint_value )
@@ -126,12 +123,7 @@ def self.perform_report
126123 end
127124 end
128125
129- [ group_name ,
130- Result . new (
131- group_routes ,
132- @@route_hit_count . slice ( group_routes ) ,
133- settings
134- ) ]
126+ [ group_name , Result . new ( group_routes , @@route_hit_count . slice ( group_routes ) , settings ) ]
135127 end . to_h
136128
137129 if groups . size > 1
@@ -151,7 +143,7 @@ def self.perform_report
151143 end
152144
153145 puts
154- puts settings . formatter_class . new ( all_result , groups , settings ) . format
146+ puts settings . formatter_class . new ( all_result , groups , settings ) . format # rubocop:disable Rails/Output
155147 end
156148
157149 def self . _touch_route ( route )
0 commit comments