@@ -49,34 +49,41 @@ async function testCodeUtils() {
49
49
50
50
console . log ( '\n5. Testing match detail retrieval...' ) ;
51
51
try {
52
- const matchDetailResult = await codebolt . codeutils . matchDetail ( 'test-matcher ' ) ;
53
- console . log ( '✅ Match detail result:' , matchDetailResult ) ;
52
+ const matchDetailResult = await codebolt . codeutils . matchDetail ( 'xmllint ' ) ;
53
+ console . log ( '✅ Match detail result:' , matchDetailResult . payload ) ;
54
54
console . log ( ' - Type:' , matchDetailResult ?. type ) ;
55
55
console . log ( ' - Details available:' , ! ! matchDetailResult ?. details ) ;
56
56
} catch ( error ) {
57
57
console . log ( '⚠️ Match detail retrieval failed:' , error . message ) ;
58
58
}
59
-
60
59
console . log ( '\n6. Testing perform match operation...' ) ;
61
60
try {
62
61
const matcherDefinition = {
63
- name : 'test-matcher' ,
64
- pattern : 'function.*\\(' ,
65
- language : 'javascript'
62
+ owner : "eslint-compact" ,
63
+ pattern : [ {
64
+ regexp : "^(.+):\\sline\\s(\\d+),\\scol\\s(\\d+),\\s(Error|Warning|Info)\\s-\\s(.+)\\s\\((.+)\\)$" ,
65
+ file : 1 ,
66
+ line : 2 ,
67
+ column : 3 ,
68
+ severity : 4 ,
69
+ message : 5 ,
70
+ code : 6
71
+ } ]
66
72
} ;
67
- const problemPatterns = [
68
- { pattern : 'logger\\.info' , severity : 'warning' } ,
69
- { pattern : 'var\\s+' , severity : 'error' }
70
- ] ;
71
- const problems = [
72
- { line : 1 , message : 'Use const instead of var' } ,
73
- { line : 5 , message : 'Remove console.log' }
73
+
74
+ const testProblems = [
75
+ { line : "src/file1.js: line 10, col 5, Error - Unexpected console statement (no-console)" , source : "test" } ,
76
+ { line : "src/file2.js: line 25, col 8, Warning - 'var' used instead of 'let' or 'const' (no-var)" , source : "test" } ,
77
+ { line : "This should not match" , source : "test" } , // Invalid line
78
+ { } , // Empty object
79
+ { line : "src/file3.js: line 5, col 15, Info - Missing JSDoc comment (require-jsdoc)" , source : "test" }
74
80
] ;
81
+
75
82
76
83
const performMatchResult = await codebolt . codeutils . performMatch (
77
84
matcherDefinition ,
78
- problemPatterns ,
79
- problems
85
+ matcherDefinition . pattern ,
86
+ testProblems
80
87
) ;
81
88
console . log ( '✅ Perform match result:' , performMatchResult ) ;
82
89
console . log ( ' - Type:' , performMatchResult ?. type ) ;
0 commit comments