Skip to content

Commit e9dad56

Browse files
authored
Merge branch 'main' into AXON-106-Support-Jira-Checklist-plugin-tasks-and-decisions
2 parents 189531b + b14d7af commit e9dad56

File tree

88 files changed

+692
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

88 files changed

+692
-86
lines changed

package.json

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646
],
4747
"main": "./build/extension/extension",
4848
"rovoDev": {
49-
"version": "0.12.14"
49+
"version": "0.12.16"
5050
},
5151
"scripts": {
5252
"vscode:uninstall": "node ./build/extension/uninstall.js",
@@ -517,6 +517,11 @@
517517
"command": "atlascode.debug.quickLogout",
518518
"title": "[DEBUG] Atlassian: Quick logout",
519519
"enablement": "atlascode:debugMode"
520+
},
521+
{
522+
"command": "atlascode.addRecommendedExtension",
523+
"title": "Add as Recommended Extension",
524+
"category": "Atlassian"
520525
}
521526
],
522527
"viewsContainers": {

src/analytics.test.ts

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ describe('analytics', () => {
264264
expect(event.trackEvent.attributes.additionalParams).toEqual(additionalParams);
265265
});
266266

267-
it('should sanitize stack traces in errorEvent', async () => {
267+
it('should sanitize stack traces in errorEvent (/Users)', async () => {
268268
const errorMessage = 'Test error message';
269269
const error = new Error('Test error');
270270
error.stack = 'Error: Test error\n at TestFunction (/Users/realuser/test.js:10:15)';
@@ -276,6 +276,30 @@ describe('analytics', () => {
276276
expect(event.trackEvent.attributes.stack).not.toContain('/Users/realuser/');
277277
});
278278

279+
it('should sanitize stack traces in errorEvent (/home)', async () => {
280+
const errorMessage = 'Test error message';
281+
const error = new Error('Test error');
282+
error.stack = 'Error: Test error\n at TestFunction (/home/realuser/test.js:10:15)';
283+
284+
const event = await analytics.errorEvent(undefined, errorMessage, error);
285+
286+
// Check if the username was sanitized
287+
expect(event.trackEvent.attributes.stack).toContain('/home/<user>/');
288+
expect(event.trackEvent.attributes.stack).not.toContain('/home/realuser/');
289+
});
290+
291+
it('should sanitize stack traces in errorEvent (c:\\Users)', async () => {
292+
const errorMessage = 'Test error message';
293+
const error = new Error('Test error');
294+
error.stack = 'Error: Test error\n at TestFunction (c:\\Users\\realuser\\test.js:10:15)';
295+
296+
const event = await analytics.errorEvent(undefined, errorMessage, error);
297+
298+
// Check if the username was sanitized
299+
expect(event.trackEvent.attributes.stack).toContain('c:\\Users\\<user>\\');
300+
expect(event.trackEvent.attributes.stack).not.toContain('c:\\Users\\realuser\\');
301+
});
302+
279303
it('should create uiErrorEvent with UI error information', async () => {
280304
const errorInfo: UIErrorInfo = {
281305
view: 'test-view',

src/analytics.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ function sanitazeErrorMessage(message?: string): string | undefined {
145145
function sanitizeStackTrace(stack?: string): string | undefined {
146146
if (stack) {
147147
stack = stack.replace(/\/Users\/[^/]+\//gi, '/Users/<user>/'); // *nix Users folder
148+
stack = stack.replace(/\/home\/[^/]+\//gi, '/home/<user>/'); // *nix home folder
148149
stack = stack.replace(/\\Users\\[^\\]+\\/gi, '\\Users\\<user>\\'); // windows Users folder
149150
}
150151
return stack || undefined;
@@ -521,6 +522,12 @@ export async function pmfClosed(): Promise<TrackEvent> {
521522
return trackEvent('closed', 'atlascodePmf');
522523
}
523524

525+
export async function addRecommendedExtensionTriggeredEvent(source: string): Promise<TrackEvent> {
526+
return trackEvent('triggered', 'addRecommendedExtension', {
527+
attributes: { source: source },
528+
});
529+
}
530+
524531
export type DeepLinkEventErrorType = 'Success' | 'NotFound' | 'Exception';
525532

526533
export async function deepLinkEvent(

src/commands.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ import {
1010
} from './analytics';
1111
import { BasicAuthInfo, DetailedSiteInfo, ProductBitbucket, ProductJira } from './atlclients/authInfo';
1212
import { showBitbucketDebugInfo } from './bitbucket/bbDebug';
13+
import { addAtlascodeAsRecommendedExtension } from './commands/addRecommendedExtension';
1314
import { rerunPipeline } from './commands/bitbucket/rerunPipeline';
1415
import { runPipeline } from './commands/bitbucket/runPipeline';
1516
import { assignIssue } from './commands/jira/assignIssue';
@@ -237,6 +238,7 @@ export function registerCommands(vscodeContext: ExtensionContext) {
237238
});
238239
}
239240
}),
241+
commands.registerCommand(Commands.AddRecommendedExtension, addAtlascodeAsRecommendedExtension),
240242
);
241243
} else {
242244
vscodeContext.subscriptions.push(
@@ -449,6 +451,7 @@ export function registerCommands(vscodeContext: ExtensionContext) {
449451
});
450452
}
451453
}),
454+
commands.registerCommand(Commands.AddRecommendedExtension, addAtlascodeAsRecommendedExtension),
452455
);
453456
}
454457
}

0 commit comments

Comments
 (0)