MCPcopy Create free account
hub / github.com/ChromeDevTools/devtools-frontend / extract

Function extract

scripts/extract_bugs.ts:38–87  ·  view source on GitHub ↗
(sourceFile: ts.SourceFile)

Source from the content-addressed store, hash-verified

36const bugToFile = new Map<string, string>();
37
38function extract(sourceFile: ts.SourceFile) {
39 extractBugs(sourceFile);
40
41 function isSkipCall(node: ts.Node) {
42 if (node.getChildAt(0).kind === ts.SyntaxKind.PropertyAccessExpression) {
43 const propAccess = node.getChildAt(0);
44 const skipCalls = new Set(['it.skip', 'describe.skip']);
45 if (skipCalls.has(propAccess.getText())) {
46 return true;
47 }
48 }
49 return false;
50 }
51
52 function isSkipOnPlatformsCall(node: ts.Node) {
53 if (node.getChildAt(0).kind === ts.SyntaxKind.PropertyAccessExpression) {
54 const propAccess = node.getChildAt(0);
55 const skipOnPlatformCalls = new Set(['it.skipOnPlatforms', 'describe.skipOnPlatforms']);
56 if (skipOnPlatformCalls.has(propAccess.getText())) {
57 return true;
58 }
59 }
60 return false;
61 }
62
63 function extractBugs(node: ts.Node) {
64 switch (node.kind) {
65 case ts.SyntaxKind.CallExpression: {
66 let description;
67 if (isSkipCall(node)) {
68 description = node.getChildAt(2).getChildAt(0).getText();
69 } else if (isSkipOnPlatformsCall(node)) {
70 description = node.getChildAt(2).getChildAt(2).getText();
71 }
72 if (!description) {
73 break;
74 }
75 const match = description.match(/crbug.com\/(\d+)/);
76 if (!match) {
77 break;
78 }
79 bugs.add(match[1]);
80 bugToFile.set(match[1], sourceFile.fileName);
81 break;
82 }
83 }
84
85 ts.forEachChild(node, extractBugs);
86 }
87}
88
89if (argv.sources.includes('devtools')) {
90 const files = [

Callers 1

extract_bugs.tsFile · 0.85

Calls 1

extractBugsFunction · 0.85

Tested by

no test coverage detected