Skip to content

Commit 07c08f1

Browse files
committed
fix(perl): satisfy ameba in mojolicious analyzer
- Switch %w() to %w[] per Style/PercentLiteralDelimiters - Replace not_nil! ternary with explicit branch per Lint/NotNil
1 parent d00117d commit 07c08f1

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

src/analyzer/analyzers/perl/mojolicious.cr

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ require "../../engines/perl_engine"
22

33
module Analyzer::Perl
44
class Mojolicious < PerlEngine
5-
HTTP_VERBS = %w(get post put delete patch options head)
5+
HTTP_VERBS = %w[get post put delete patch options head]
66
LITE_VERB_RE = /^\s*(get|post|put|patch|delete|del|options|head|websocket)\s+['"]([^'"]+)['"]/
77
LITE_ANY_RE = /^\s*any\s+(?:\[([^\]]+)\]\s*=>\s*)?['"]([^'"]+)['"]/
88
FULL_VERB_RE = /->\s*(get|post|put|patch|delete|del|options|head|websocket)\s*\(\s*['"]([^'"]+)['"]/
@@ -38,7 +38,16 @@ module Analyzer::Perl
3838
endpoints << endpoint
3939
end
4040

41-
targets = line_endpoints.empty? ? (last_endpoint ? [last_endpoint.not_nil!] : [] of Endpoint) : line_endpoints
41+
targets = if line_endpoints.empty?
42+
if le = last_endpoint
43+
[le]
44+
else
45+
[] of Endpoint
46+
end
47+
else
48+
line_endpoints
49+
end
50+
4251
targets.each do |target|
4352
extract_params_from_line(line, target.method).each do |param|
4453
push_unique_param(target, param)

0 commit comments

Comments
 (0)