File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -146,6 +146,10 @@ const log_parsers = [
146146 type : 'callout' ,
147147 regex : / c a l l o u t l i s t i t e m i n d e x : e x p e c t e d (?< expected > \d + ) , g o t (?< got > \d + ) /
148148 } ,
149+ {
150+ type : 'existing' ,
151+ regex : / P a g e a l i a s c a n n o t r e f e r e n c e a n e x i s t i n g p a g e : (?< coordinate > .* ) \n \s * s o u r c e : (?< source > .* ) \n \s * e x i s t i n g p a g e : (?< existing > .* ) / m
152+ } ,
149153]
150154
151155const files = { }
@@ -163,26 +167,29 @@ var log_other = fs.createWriteStream("other.log", {flags:'w'});
163167
164168var obj
165169rl . on ( 'line' , ( line ) => {
166- let ret
167170 if ( ( line . match ( / ^ \{ / ) && line . match ( / \} $ / ) ) ) {
168171 obj = JSON . parse ( line )
169172
173+ const filepath = obj ?. file ?. path
170174 // increment file counter
171- files [ obj . file . path ] ||= 0
172- files [ obj . file . path ] ++
175+ if ( filepath ) {
176+ files [ filepath ] ||= 0
177+ files [ filepath ] ++
178+ }
173179
174180 const msg = obj . msg
175181
176182 // for string messages, try each parser and *return early* if found
177183 if ( typeof msg == 'string' ) {
178- const prefix = path . basename ( obj . source . url , '.git' )
184+ const prefix = path . basename ( obj ? .source ? .url || '' , '.git' )
179185
180186 flash ( msg , prefix )
187+ let match
181188 for ( const parser of log_parsers ) {
182- if ( ret = parser . regex . exec ( msg ) ) {
189+ if ( match = parser . regex . exec ( msg ) ) {
183190 errors [ parser . type ] ++ ;
184191 obj . type = parser . type
185- if ( ret . groups ) { obj . details = ret . groups }
192+ if ( match . groups ) { obj . details = { ... match . groups } }
186193 log_main . write ( JSON . stringify ( obj ) + "\n" )
187194 return
188195 }
You can’t perform that action at this time.
0 commit comments