File tree Expand file tree Collapse file tree 1 file changed +10
-2
lines changed
Expand file tree Collapse file tree 1 file changed +10
-2
lines changed Original file line number Diff line number Diff line change 7979 continue ;
8080 }
8181
82+ let has_parens = |sig : & str | {
83+ let sig = sig. trim ( ) ;
84+ match ( sig. find ( '(' ) , sig. rfind ( ')' ) ) {
85+ ( Some ( open) , Some ( close) ) if open < close && close == sig. len ( ) - 1 => true ,
86+ _ => false ,
87+ }
88+ } ;
89+
8290 // Validate function signatures
8391 for func in & monitor. match_conditions . functions {
84- if !func . signature . contains ( '(' ) || ! func. signature . contains ( ')' ) {
92+ if !has_parens ( & func. signature ) {
8593 validation_errors. push ( format ! (
8694 "Monitor '{}' has invalid function signature '{}' for {} network '{}' \
8795 (expected format: 'functionName(type1,type2)')",
92100
93101 // Validate event signatures
94102 for event in & monitor. match_conditions . events {
95- if !event . signature . contains ( '(' ) || ! event. signature . contains ( ')' ) {
103+ if !has_parens ( & event. signature ) {
96104 validation_errors. push ( format ! (
97105 "Monitor '{}' has invalid event signature '{}' for {} network '{}' \
98106 (expected format: 'EventName(type1,type2)')",
You can’t perform that action at this time.
0 commit comments