Skip to content

Commit 2c50043

Browse files
authored
Add support for showing code flows (#1187)
1 parent 3fc3b25 commit 2c50043

7 files changed

Lines changed: 597 additions & 84 deletions

File tree

extensions/ql-vscode/package-lock.json

Lines changed: 37 additions & 15 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

extensions/ql-vscode/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1065,7 +1065,7 @@
10651065
"dependencies": {
10661066
"@octokit/rest": "^18.5.6",
10671067
"@primer/octicons-react": "^16.3.0",
1068-
"@primer/react": "^34.3.0",
1068+
"@primer/react": "^35.0.0-rc.c106d292",
10691069
"child-process-promise": "^2.2.1",
10701070
"classnames": "~2.2.6",
10711071
"d3": "^6.3.1",

extensions/ql-vscode/src/remote-queries/sample-data.ts

Lines changed: 197 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ export const sampleRemoteQueryResult: RemoteQueryResult = {
102102
const createAnalysisResults = (n: number) => Array(n).fill(
103103
{
104104
message: 'This shell command depends on an uncontrolled [absolute path](1).',
105+
shortDescription: 'Shell command built from environment values',
105106
severity: 'Error',
106107
filePath: 'npm-packages/meteor-installer/config.js',
107108
codeSnippet: {
@@ -113,7 +114,202 @@ const createAnalysisResults = (n: number) => Array(n).fill(
113114
startLine: 255,
114115
startColumn: 28,
115116
endColumn: 62
116-
}
117+
},
118+
codeFlows: [
119+
{
120+
threadFlows: [
121+
{
122+
filePath: 'npm-packages/meteor-installer/config.js',
123+
highlightedRegion: {
124+
startLine: 35,
125+
startColumn: 20,
126+
endColumn: 61
127+
},
128+
codeSnippet: {
129+
startLine: 33,
130+
endLine: 37,
131+
text: '\nconst meteorLocalFolder = \'.meteor\';\nconst meteorPath = path.resolve(rootPath, meteorLocalFolder);\n\nmodule.exports = {\n'
132+
}
133+
},
134+
{
135+
filePath: 'npm-packages/meteor-installer/config.js',
136+
highlightedRegion: {
137+
startLine: 35,
138+
startColumn: 7,
139+
endColumn: 61
140+
},
141+
codeSnippet: {
142+
startLine: 33,
143+
endLine: 37,
144+
text: '\nconst meteorLocalFolder = \'.meteor\';\nconst meteorPath = path.resolve(rootPath, meteorLocalFolder);\n\nmodule.exports = {\n'
145+
}
146+
},
147+
{
148+
filePath: 'npm-packages/meteor-installer/config.js',
149+
highlightedRegion: {
150+
startLine: 40,
151+
startColumn: 3,
152+
endColumn: 13
153+
},
154+
codeSnippet: {
155+
startLine: 38,
156+
endLine: 42,
157+
text: ' METEOR_LATEST_VERSION,\n extractPath: rootPath,\n meteorPath,\n release: process.env.INSTALL_METEOR_VERSION || METEOR_LATEST_VERSION,\n rootPath,\n'
158+
}
159+
},
160+
{
161+
filePath: 'npm-packages/meteor-installer/install.js',
162+
highlightedRegion: {
163+
startLine: 12,
164+
startColumn: 3,
165+
endColumn: 13
166+
},
167+
codeSnippet: {
168+
startLine: 10,
169+
endLine: 14,
170+
text: 'const os = require(\'os\');\nconst {\n meteorPath,\n release,\n startedPath,\n'
171+
}
172+
},
173+
{
174+
filePath: 'npm-packages/meteor-installer/install.js',
175+
highlightedRegion: {
176+
startLine: 11,
177+
startColumn: 7,
178+
endLine: 22,
179+
endColumn: 27
180+
},
181+
codeSnippet: {
182+
startLine: 9,
183+
endLine: 24,
184+
text: 'const tmp = require(\'tmp\');\nconst os = require(\'os\');\nconst {\n meteorPath,\n release,\n startedPath,\n extractPath,\n isWindows,\n rootPath,\n sudoUser,\n isSudo,\n isMac,\n METEOR_LATEST_VERSION,\n} = require(\'./config.js\');\nconst { uninstall } = require(\'./uninstall\');\nconst {\n'
185+
}
186+
},
187+
{
188+
filePath: 'npm-packages/meteor-installer/install.js',
189+
highlightedRegion: {
190+
startLine: 255,
191+
startColumn: 42,
192+
endColumn: 52
193+
},
194+
codeSnippet: {
195+
startLine: 253,
196+
endLine: 257,
197+
text: ' if (isWindows()) {\n //set for the current session and beyond\n child_process.execSync(`setx path "${meteorPath}/;%path%`);\n return;\n }\n'
198+
}
199+
},
200+
{
201+
filePath: 'npm-packages/meteor-installer/install.js',
202+
highlightedRegion: {
203+
startLine: 255,
204+
startColumn: 28,
205+
endColumn: 62
206+
},
207+
codeSnippet: {
208+
startLine: 253,
209+
endLine: 257,
210+
text: ' if (isWindows()) {\n //set for the current session and beyond\n child_process.execSync(`setx path "${meteorPath}/;%path%`);\n return;\n }\n'
211+
}
212+
}
213+
]
214+
},
215+
{
216+
threadFlows: [
217+
{
218+
filePath: 'npm-packages/meteor-installer/config2.js',
219+
highlightedRegion: {
220+
startLine: 35,
221+
startColumn: 20,
222+
endColumn: 61
223+
},
224+
codeSnippet: {
225+
startLine: 33,
226+
endLine: 37,
227+
text: '\nconst meteorLocalFolder = \'.meteor\';\nconst meteorPath = path.resolve(rootPath, meteorLocalFolder);\n\nmodule.exports = {\n'
228+
}
229+
},
230+
{
231+
filePath: 'npm-packages/meteor-installer/config2.js',
232+
highlightedRegion: {
233+
startLine: 35,
234+
startColumn: 7,
235+
endColumn: 61
236+
},
237+
codeSnippet: {
238+
startLine: 33,
239+
endLine: 37,
240+
text: '\nconst meteorLocalFolder = \'.meteor\';\nconst meteorPath = path.resolve(rootPath, meteorLocalFolder);\n\nmodule.exports = {\n'
241+
}
242+
},
243+
{
244+
filePath: 'npm-packages/meteor-installer/config2.js',
245+
highlightedRegion: {
246+
startLine: 40,
247+
startColumn: 3,
248+
endColumn: 13
249+
},
250+
codeSnippet: {
251+
startLine: 38,
252+
endLine: 42,
253+
text: ' METEOR_LATEST_VERSION,\n extractPath: rootPath,\n meteorPath,\n release: process.env.INSTALL_METEOR_VERSION || METEOR_LATEST_VERSION,\n rootPath,\n'
254+
}
255+
},
256+
{
257+
filePath: 'npm-packages/meteor-installer/install2.js',
258+
highlightedRegion: {
259+
startLine: 12,
260+
startColumn: 3,
261+
endColumn: 13
262+
},
263+
codeSnippet: {
264+
startLine: 10,
265+
endLine: 14,
266+
text: 'const os = require(\'os\');\nconst {\n meteorPath,\n release,\n startedPath,\n'
267+
}
268+
},
269+
{
270+
filePath: 'npm-packages/meteor-installer/install2.js',
271+
highlightedRegion: {
272+
startLine: 11,
273+
startColumn: 7,
274+
endLine: 22,
275+
endColumn: 27
276+
},
277+
codeSnippet: {
278+
startLine: 9,
279+
endLine: 24,
280+
text: 'const tmp = require(\'tmp\');\nconst os = require(\'os\');\nconst {\n meteorPath,\n release,\n startedPath,\n extractPath,\n isWindows,\n rootPath,\n sudoUser,\n isSudo,\n isMac,\n METEOR_LATEST_VERSION,\n} = require(\'./config.js\');\nconst { uninstall } = require(\'./uninstall\');\nconst {\n'
281+
}
282+
},
283+
{
284+
filePath: 'npm-packages/meteor-installer/install2.js',
285+
highlightedRegion: {
286+
startLine: 255,
287+
startColumn: 42,
288+
endColumn: 52
289+
},
290+
codeSnippet: {
291+
startLine: 253,
292+
endLine: 257,
293+
text: ' if (isWindows()) {\n //set for the current session and beyond\n child_process.execSync(`setx path "${meteorPath}/;%path%`);\n return;\n }\n'
294+
}
295+
},
296+
{
297+
filePath: 'npm-packages/meteor-installer/install2.js',
298+
highlightedRegion: {
299+
startLine: 255,
300+
startColumn: 28,
301+
endColumn: 62
302+
},
303+
codeSnippet: {
304+
startLine: 253,
305+
endLine: 257,
306+
text: ' if (isWindows()) {\n //set for the current session and beyond\n child_process.execSync(`setx path "${meteorPath}/;%path%`);\n return;\n }\n'
307+
}
308+
}
309+
]
310+
}
311+
]
312+
117313
}
118314
);
119315

0 commit comments

Comments
 (0)