@slalom-salesforce/sf-pr-comments 0.2.4 → 0.2.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +1 -1
- package/lib/commands/github/postcomments.d.ts +13 -6
- package/lib/commands/github/postcomments.js +108 -16
- package/lib/commands/github/postcomments.js.map +1 -1
- package/lib/helper/githubDevOps.d.ts +13 -0
- package/lib/helper/githubDevOps.js +100 -0
- package/lib/helper/githubDevOps.js.map +1 -0
- package/lib/helper/utils.js.map +1 -1
- package/messages/github.postcomments.md +50 -7
- package/package.json +57 -42
- package/oclif.manifest.json +0 -209
package/LICENSE.txt
CHANGED
|
@@ -1,13 +1,20 @@
|
|
|
1
1
|
import { SfCommand } from '@salesforce/sf-plugins-core';
|
|
2
|
-
export type
|
|
3
|
-
|
|
2
|
+
export type CommentsResult = {
|
|
3
|
+
existingCommentsCount: number;
|
|
4
|
+
newCommentsPosted: number;
|
|
5
|
+
link: string;
|
|
4
6
|
};
|
|
5
|
-
export default class
|
|
7
|
+
export default class PostComments extends SfCommand<CommentsResult> {
|
|
6
8
|
static readonly summary: string;
|
|
7
|
-
static readonly description: string;
|
|
8
9
|
static readonly examples: string[];
|
|
9
10
|
static readonly flags: {
|
|
10
|
-
|
|
11
|
+
authtoken: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
12
|
+
githubrepoowner: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
13
|
+
githubreposlug: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
14
|
+
githubprid: import("@oclif/core/lib/interfaces").OptionFlag<number, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
15
|
+
foldernamefordiff: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
16
|
+
gitfoldername: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
17
|
+
reviewresultjsonfile: import("@oclif/core/lib/interfaces").OptionFlag<string, import("@oclif/core/lib/interfaces/parser").CustomOptions>;
|
|
11
18
|
};
|
|
12
|
-
run(): Promise<
|
|
19
|
+
run(): Promise<CommentsResult>;
|
|
13
20
|
}
|
|
@@ -8,32 +8,124 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
8
8
|
*/
|
|
9
9
|
const sf_plugins_core_1 = require("@salesforce/sf-plugins-core");
|
|
10
10
|
const core_1 = require("@salesforce/core");
|
|
11
|
+
const githubDevOps_1 = require("../../helper/githubDevOps");
|
|
12
|
+
const utils_1 = require("../../helper/utils");
|
|
11
13
|
core_1.Messages.importMessagesDirectory(__dirname);
|
|
12
14
|
const messages = core_1.Messages.load('@slalom-salesforce/sf-pr-comments', 'github.postcomments', [
|
|
13
15
|
'summary',
|
|
14
|
-
'description',
|
|
15
16
|
'examples',
|
|
16
|
-
'flags.
|
|
17
|
+
'flags.username.summary',
|
|
18
|
+
'flags.authtoken.summary',
|
|
19
|
+
'flags.errorAuthFailed.summary',
|
|
20
|
+
'flags.errorPermissionIssue.summary',
|
|
21
|
+
'flags.reviewresultjsonfile.summary',
|
|
22
|
+
'flags.githubreposlug.summary',
|
|
23
|
+
'flags.gitfoldername.summary',
|
|
24
|
+
'flags.githubRepositoryOwner.summary',
|
|
25
|
+
'flags.githubprid.summary',
|
|
26
|
+
'flags.foldernamefordiff.summary',
|
|
27
|
+
'flags.CodeReviewInputError.summary',
|
|
28
|
+
'flags.CodeReviewFileError.summary',
|
|
17
29
|
]);
|
|
18
|
-
class
|
|
30
|
+
class PostComments extends sf_plugins_core_1.SfCommand {
|
|
19
31
|
async run() {
|
|
20
|
-
const { flags } = await this.parse(
|
|
21
|
-
const
|
|
22
|
-
|
|
32
|
+
const { flags } = await this.parse(PostComments);
|
|
33
|
+
const log = await core_1.Logger.child(this.ctor.name);
|
|
34
|
+
// get current logger level for better console logs
|
|
35
|
+
const logLevel = log.getLevel();
|
|
36
|
+
// Github DevOps related functionality is abstracted to githubDevOps class
|
|
37
|
+
const github = new githubDevOps_1.default(flags.authtoken, flags.githubrepoowner);
|
|
38
|
+
const prUrl = await github.getPrUrl(flags.githubreposlug, flags.githubprid);
|
|
39
|
+
// maintains count of comments that already have been posted to the PR under consideration
|
|
40
|
+
let countExistingComments = 0;
|
|
41
|
+
// maintains count of net new comments that is posted through current execution
|
|
42
|
+
let countNewCommentsPosted = 0;
|
|
43
|
+
// reads static code analyzer output thats in JSON
|
|
44
|
+
const scannerResults = (0, utils_1.getCodeReviewFromFile)(flags.reviewresultjsonfile);
|
|
45
|
+
// transforms Scanner results into a cannonical model - CommentsByFile
|
|
46
|
+
const CodeReviewCommentsByFiles = (0, utils_1.parseScannerOutput)(scannerResults, flags.foldernamefordiff);
|
|
47
|
+
(0, utils_1.printMessage)(`CodeReviewCommentsByFiles -->
|
|
48
|
+
${JSON.stringify(CodeReviewCommentsByFiles, undefined, 4)}`, utils_1.MessageType.Debug, logLevel);
|
|
49
|
+
// gets lines that have been updated in the current PR
|
|
50
|
+
// this helps to filter comments to post only comments on lines that have been updated
|
|
51
|
+
// since scanner reviews the entire file for issues
|
|
52
|
+
const diffFilesLinesadded = await github.getPrDiff(flags.githubreposlug, flags.githubprid, flags.gitfoldername);
|
|
53
|
+
// fetch existing comments from PR into the cannonical model - CommentsByFile
|
|
54
|
+
const existingCommentsByFiles = await github.fetchPrComments(flags.githubreposlug, flags.githubprid);
|
|
55
|
+
(0, utils_1.printMessage)(`existingCommentsByFiles -->
|
|
56
|
+
${JSON.stringify(existingCommentsByFiles, undefined, 4)}`, utils_1.MessageType.Debug, logLevel);
|
|
57
|
+
// gets count of existing comments
|
|
58
|
+
if (existingCommentsByFiles && existingCommentsByFiles.length > 0) {
|
|
59
|
+
countExistingComments = existingCommentsByFiles.length;
|
|
60
|
+
}
|
|
61
|
+
// compares code scanner results vs repository comments and returns array of just the net new files with file comments
|
|
62
|
+
const newCommentsByFilesToPost = (0, utils_1.filterToNewCommentsToPost)(CodeReviewCommentsByFiles, existingCommentsByFiles);
|
|
63
|
+
if (newCommentsByFilesToPost && newCommentsByFilesToPost.length > 0) {
|
|
64
|
+
// returns filtered list of comments that are only applicable to the diff (lines that changed)
|
|
65
|
+
const newCommentsByFilesToPostFilteredToDiff = (0, utils_1.filterCommentsToDiff)(diffFilesLinesadded, newCommentsByFilesToPost);
|
|
66
|
+
if (newCommentsByFilesToPostFilteredToDiff && newCommentsByFilesToPostFilteredToDiff.length > 0) {
|
|
67
|
+
// creating thread
|
|
68
|
+
void github.postPrComment(flags.githubreposlug, flags.githubprid, newCommentsByFilesToPostFilteredToDiff);
|
|
69
|
+
// aggregate the count of comments across all files
|
|
70
|
+
countNewCommentsPosted = newCommentsByFilesToPostFilteredToDiff
|
|
71
|
+
.map((eachFile) => eachFile.comments.length)
|
|
72
|
+
.reduce((previousValue, currentValue) => previousValue + currentValue, 0);
|
|
73
|
+
(0, utils_1.printMessage)(`Posted ${countNewCommentsPosted} new comments to pr`, utils_1.MessageType.Success, logLevel);
|
|
74
|
+
(0, utils_1.printMessage)(`Posted ${countExistingComments} new comments to pr `, utils_1.MessageType.Success, logLevel);
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
(0, utils_1.printMessage)('No new code comments found to post', utils_1.MessageType.Warn, logLevel);
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
(0, utils_1.printMessage)('No new code comments found to post', utils_1.MessageType.Warn, logLevel);
|
|
82
|
+
}
|
|
83
|
+
// Return an object to be displayed with --json
|
|
23
84
|
return {
|
|
24
|
-
|
|
85
|
+
existingCommentsCount: countExistingComments,
|
|
86
|
+
newCommentsPosted: countNewCommentsPosted,
|
|
87
|
+
link: prUrl,
|
|
25
88
|
};
|
|
26
89
|
}
|
|
27
90
|
}
|
|
28
|
-
exports.default =
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
summary: messages.getMessage('flags.
|
|
35
|
-
|
|
36
|
-
|
|
91
|
+
exports.default = PostComments;
|
|
92
|
+
PostComments.summary = messages.getMessage('summary');
|
|
93
|
+
PostComments.examples = messages.getMessages('examples');
|
|
94
|
+
PostComments.flags = {
|
|
95
|
+
authtoken: sf_plugins_core_1.Flags.string({
|
|
96
|
+
char: 't',
|
|
97
|
+
summary: messages.getMessage('flags.authtoken.summary'),
|
|
98
|
+
required: true,
|
|
99
|
+
}),
|
|
100
|
+
githubrepoowner: sf_plugins_core_1.Flags.string({
|
|
101
|
+
char: 'w',
|
|
102
|
+
summary: messages.getMessage('flags.githubRepositoryOwner.summary'),
|
|
103
|
+
required: true,
|
|
104
|
+
}),
|
|
105
|
+
githubreposlug: sf_plugins_core_1.Flags.string({
|
|
106
|
+
char: 'r',
|
|
107
|
+
summary: messages.getMessage('flags.githubreposlug.summary'),
|
|
108
|
+
required: true,
|
|
109
|
+
}),
|
|
110
|
+
githubprid: sf_plugins_core_1.Flags.integer({
|
|
111
|
+
char: 'i',
|
|
112
|
+
summary: messages.getMessage('flags.githubprid.summary'),
|
|
113
|
+
required: true,
|
|
114
|
+
}),
|
|
115
|
+
foldernamefordiff: sf_plugins_core_1.Flags.directory({
|
|
116
|
+
char: 'd',
|
|
117
|
+
summary: messages.getMessage('flags.foldernamefordiff.summary'),
|
|
118
|
+
required: true,
|
|
119
|
+
}),
|
|
120
|
+
gitfoldername: sf_plugins_core_1.Flags.directory({
|
|
121
|
+
char: 'g',
|
|
122
|
+
summary: messages.getMessage('flags.gitfoldername.summary'),
|
|
123
|
+
required: true,
|
|
124
|
+
}),
|
|
125
|
+
reviewresultjsonfile: sf_plugins_core_1.Flags.file({
|
|
126
|
+
char: 'F',
|
|
127
|
+
summary: messages.getMessage('flags.reviewresultjsonfile.summary'),
|
|
128
|
+
required: true,
|
|
37
129
|
}),
|
|
38
130
|
};
|
|
39
131
|
//# sourceMappingURL=postcomments.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"postcomments.js","sourceRoot":"","sources":["../../../src/commands/github/postcomments.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,iEAA+D;AAC/D,
|
|
1
|
+
{"version":3,"file":"postcomments.js","sourceRoot":"","sources":["../../../src/commands/github/postcomments.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,iEAA+D;AAC/D,2CAAiE;AACjE,4DAAqD;AAIrD,8CAO4B;AAE5B,eAAQ,CAAC,uBAAuB,CAAC,SAAS,CAAC,CAAC;AAC5C,MAAM,QAAQ,GAAG,eAAQ,CAAC,IAAI,CAAC,mCAAmC,EAAE,qBAAqB,EAAE;IACzF,SAAS;IACT,UAAU;IACV,wBAAwB;IACxB,yBAAyB;IACzB,+BAA+B;IAC/B,oCAAoC;IACpC,oCAAoC;IACpC,8BAA8B;IAC9B,6BAA6B;IAC7B,qCAAqC;IACrC,0BAA0B;IAC1B,iCAAiC;IACjC,oCAAoC;IACpC,mCAAmC;CAEpC,CAAC,CAAC;AAUH,MAAqB,YAAa,SAAQ,2BAAyB;IA0C1D,KAAK,CAAC,GAAG;QACd,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;QAEjD,MAAM,GAAG,GAAG,MAAM,aAAM,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QAC/C,mDAAmD;QACnD,MAAM,QAAQ,GAAgB,GAAG,CAAC,QAAQ,EAAE,CAAC;QAE7C,0EAA0E;QAC1E,MAAM,MAAM,GAAG,IAAI,sBAAY,CAAC,KAAK,CAAC,SAAS,EAAE,KAAK,CAAC,eAAe,CAAC,CAAC;QAExE,MAAM,KAAK,GAAW,MAAM,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,cAAc,EAAE,KAAK,CAAC,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aces/PrDiff';
|
|
3
|
+
export default class githubDevOps {
|
|
4
|
+
private repoOwner;
|
|
5
|
+
private authorizationToken;
|
|
6
|
+
private octokit;
|
|
7
|
+
constructor(authorizationToken: string, repoOwner: string);
|
|
8
|
+
getPrUrl(repoName: string, prId: number): Promise<string>;
|
|
9
|
+
fetchPrComments(repoName: string, prId: number): Promise<CommentsByFile[]>;
|
|
10
|
+
postPrComment(repoName: string, prId: number, commentsPerFiles: CommentsByFile[]): Promise<void>;
|
|
11
|
+
sendRequestPostPRComments(repoName: string, prId: number, commentsPerFile: CommentsByFile, lastCommitId: string): Promise<void>;
|
|
12
|
+
getPrDiff(repoName: string, prId: number, gitFolderPath?: string): Promise<PrDiff[]>;
|
|
13
|
+
}
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
/*
|
|
4
|
+
* Copyright (c) 2023, salesforce.com, inc.
|
|
5
|
+
* All rights reserved.
|
|
6
|
+
* Licensed under the BSD 3-Clause license.
|
|
7
|
+
* For full license text, see LICENSE.txt file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
8
|
+
*/
|
|
9
|
+
const rest_1 = require("@octokit/rest");
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
|
|
11
|
+
const parseGitPrDiff = require('git-pr-diff-parser');
|
|
12
|
+
class githubDevOps {
|
|
13
|
+
constructor(authorizationToken, repoOwner) {
|
|
14
|
+
this.authorizationToken = authorizationToken;
|
|
15
|
+
this.repoOwner = repoOwner;
|
|
16
|
+
this.octokit = new rest_1.Octokit({
|
|
17
|
+
auth: this.authorizationToken,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
async getPrUrl(repoName, prId) {
|
|
21
|
+
const prDetails = await this.octokit.rest.pulls.get({
|
|
22
|
+
owner: this.repoOwner,
|
|
23
|
+
repo: repoName,
|
|
24
|
+
['pull_number']: prId,
|
|
25
|
+
});
|
|
26
|
+
return prDetails.data.html_url;
|
|
27
|
+
}
|
|
28
|
+
async fetchPrComments(repoName, prId) {
|
|
29
|
+
const commentsByFileArray = [];
|
|
30
|
+
const pullRequestComments = await this.octokit.rest.pulls.listReviewComments({
|
|
31
|
+
owner: this.repoOwner,
|
|
32
|
+
repo: repoName,
|
|
33
|
+
['pull_number']: prId,
|
|
34
|
+
});
|
|
35
|
+
pullRequestComments.data.forEach((thread) => {
|
|
36
|
+
if (!thread.path || !thread.body || thread.line === null) {
|
|
37
|
+
return;
|
|
38
|
+
}
|
|
39
|
+
const commentContent = {
|
|
40
|
+
lineNumber: thread.line,
|
|
41
|
+
content: thread.body,
|
|
42
|
+
commitId: thread.commit_id ?? undefined,
|
|
43
|
+
};
|
|
44
|
+
const indexOfExistingFile = commentsByFileArray.findIndex((element) => element.fileName === thread.path);
|
|
45
|
+
if (indexOfExistingFile === -1) {
|
|
46
|
+
commentsByFileArray.push({
|
|
47
|
+
fileName: thread.path,
|
|
48
|
+
comments: [commentContent],
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
else {
|
|
52
|
+
commentsByFileArray[indexOfExistingFile].comments.push(commentContent);
|
|
53
|
+
}
|
|
54
|
+
});
|
|
55
|
+
return commentsByFileArray;
|
|
56
|
+
}
|
|
57
|
+
async postPrComment(repoName, prId, commentsPerFiles) {
|
|
58
|
+
const pullRequest = await this.octokit.rest.pulls.get({
|
|
59
|
+
owner: this.repoOwner,
|
|
60
|
+
repo: repoName,
|
|
61
|
+
['pull_number']: prId,
|
|
62
|
+
});
|
|
63
|
+
const lastCommitId = pullRequest.data.head.sha;
|
|
64
|
+
await Promise.all(commentsPerFiles
|
|
65
|
+
.filter((commentsPerFile) => commentsPerFile.comments.length > 0)
|
|
66
|
+
.map((commentsPerFile) => this.sendRequestPostPRComments(repoName, prId, commentsPerFile, lastCommitId)));
|
|
67
|
+
}
|
|
68
|
+
async sendRequestPostPRComments(repoName, prId, commentsPerFile, lastCommitId) {
|
|
69
|
+
await Promise.all(commentsPerFile.comments.map(async (comment) => {
|
|
70
|
+
const newReviewComment = {
|
|
71
|
+
owner: this.repoOwner,
|
|
72
|
+
repo: repoName,
|
|
73
|
+
['pull_number']: prId,
|
|
74
|
+
body: comment.content.replace(/\\n/g, '\n'),
|
|
75
|
+
['commit_id']: lastCommitId,
|
|
76
|
+
path: commentsPerFile.fileName,
|
|
77
|
+
line: comment.lineNumber,
|
|
78
|
+
};
|
|
79
|
+
await this.octokit.rest.pulls.createReviewComment(newReviewComment);
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
async getPrDiff(repoName, prId, gitFolderPath = './') {
|
|
83
|
+
const diffFilesLinesadded = [];
|
|
84
|
+
const prInfo = await this.octokit.rest.pulls.get({
|
|
85
|
+
owner: this.repoOwner,
|
|
86
|
+
repo: repoName,
|
|
87
|
+
['pull_number']: prId,
|
|
88
|
+
});
|
|
89
|
+
const destinationBranchName = `origin/${prInfo.data.base.ref}`;
|
|
90
|
+
const sourceBranchName = `origin/${prInfo.data.head.ref}`;
|
|
91
|
+
const parsedDiff = await parseGitPrDiff(gitFolderPath, destinationBranchName, sourceBranchName);
|
|
92
|
+
parsedDiff.forEach((eachFile) => {
|
|
93
|
+
const addedLine = eachFile.lines.filter((line) => line.type === 'add').map((line) => line.ln);
|
|
94
|
+
diffFilesLinesadded.push({ fileName: eachFile.to, linesAdded: addedLine });
|
|
95
|
+
});
|
|
96
|
+
return diffFilesLinesadded;
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
exports.default = githubDevOps;
|
|
100
|
+
//# sourceMappingURL=githubDevOps.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubDevOps.js","sourceRoot":"","sources":["../../src/helper/githubDevOps.ts"],"names":[],"mappings":";;AAAA;;;;;GAKG;AACH,wCAAwC;AAexC,uGAAuG;AACvG,MAAM,cAAc,GAAG,OAAO,CAAC,oBAAoB,CAIrB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sGAAsG;IACtG,MAAM,MAAM,GAAG,KAAK,CAAC,IAAI,CAAC,CAAC;IAC3B,8IAA8I;IAC9I,OAAO,MAAM;QACX,sEAAsE;SACrE,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,SAAS,GAAG,CAAC,IAAI,IAAI,CAAC,SAAS,GAAG,CAAC,CAAC;SAC1D,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE;QACZ,mEAAmE;QACnE,MAAM,OAAO,GAAG,IAAI,CAAC;QACrB,sEAAsE;QACtE,OAAO,CAAC,IAAI,GAAG,WAAW,CAAC,OAAO,CAAC,CAAC;QACpC,+DAA+D;QAC/D,OAAO,OAAO,CAAC;IACjB,CAAC,CAAC,CAAC;AACP,CAAC;AAED,SAAS,WAAW,CAAC,IAAI;IACvB,sEAAsE;IACtE,IAAI,IAAI,CAAC,IAAI,KAAK,WAAW,EAAE;QAC7B,OAAO,KAAK,CAAC;QACb,sEAAsE;KACvE;SAAM,IAAI,IAAI,CAAC,EAAE,KAAK,WAAW,EAAE;QAClC,OAAO,KAAK,CAAC;QACb,sEAAsE;KACvE;SAAM,IAAI,IAAI,CAAC,IAAI,KAAK,IAAI,CAAC,EAAE,EAAE;QAChC,OAAO,QAAQ,CAAC;KACjB;IACD,OAAO,OAAO,CAAC;AACjB,CAAC"}
|
|
@@ -1,15 +1,58 @@
|
|
|
1
1
|
# summary
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
This helps post code review comments from a JSON file to Github pull request.
|
|
4
4
|
|
|
5
|
-
#
|
|
5
|
+
# examples
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+
sfdx github:postcomments --username 'ci_user' --authtoken 'mygithubpersonaltoken' --githubworkspace 'slalom' --githubreposlug 'sfdx_poc' --githubprid 1 --foldernamefordiff './srcDiff' --reviewresultjsonfile './codereviewvoilations.json'
|
|
8
|
+
|
|
9
|
+
sfdx github:postcomments -N 'ci_user' -t 'mygithubpersonaltoken' -w 'slalom' -r 'sfdx_poc' -i 1 -d './srcDiff' -F './codereviewvoilations.json'
|
|
10
|
+
|
|
11
|
+
# flags.username.summary
|
|
8
12
|
|
|
9
|
-
|
|
13
|
+
Github username used to authenicate to repo"
|
|
10
14
|
|
|
11
|
-
|
|
15
|
+
# flags.authtoken.summary
|
|
12
16
|
|
|
13
|
-
|
|
17
|
+
Github personal access token used to authenicate to repo, ensure this token has write / post permission of repo",
|
|
18
|
+
|
|
19
|
+
# flags.errorAuthFailed.summary
|
|
20
|
+
|
|
21
|
+
Github authentication failed
|
|
22
|
+
|
|
23
|
+
# flags.errorPermissionIssue.summary
|
|
24
|
+
|
|
25
|
+
Check access permission of the token for write access on PR comments
|
|
26
|
+
|
|
27
|
+
|
|
28
|
+
# flags.reviewresultjsonfile.summary
|
|
29
|
+
|
|
30
|
+
Path to file where code review results are stored in JSON format",
|
|
31
|
+
|
|
32
|
+
# flags.githubreposlug.summary
|
|
33
|
+
|
|
34
|
+
Name of Github repo slug where the PR is being raised"
|
|
35
|
+
|
|
36
|
+
# flags.githubRepositoryOwner.summary
|
|
37
|
+
|
|
38
|
+
Name of account owner of the Github repository. (The name is not case sensitive).",
|
|
39
|
+
|
|
40
|
+
# flags.githubprid.summary
|
|
41
|
+
|
|
42
|
+
Pull request id to post the comments to "
|
|
43
|
+
|
|
44
|
+
# flags.foldernamefordiff.summary
|
|
45
|
+
|
|
46
|
+
Name of the folder where diff files will be stored"
|
|
47
|
+
|
|
48
|
+
# flags.gitfoldername.summary
|
|
49
|
+
|
|
50
|
+
Path to base project folder where git is initialized"
|
|
51
|
+
|
|
52
|
+
# flags.CodeReviewInputError.summary
|
|
53
|
+
|
|
54
|
+
Output of code review is invalid"
|
|
55
|
+
|
|
56
|
+
# flags.CodeReviewFileError.summary
|
|
14
57
|
|
|
15
|
-
|
|
58
|
+
Code review output file cannot be found or read"
|
package/package.json
CHANGED
|
@@ -1,17 +1,65 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@slalom-salesforce/sf-pr-comments",
|
|
3
|
+
"version": "0.2.6",
|
|
3
4
|
"description": "post review comments generated from salesforce scanner to repos like github bitbucket azure repo",
|
|
4
|
-
"
|
|
5
|
+
"keywords": [
|
|
6
|
+
"force",
|
|
7
|
+
"salesforce",
|
|
8
|
+
"sfdx",
|
|
9
|
+
"salesforcedx",
|
|
10
|
+
"sfdx-plugin",
|
|
11
|
+
"sf-plugin",
|
|
12
|
+
"sf"
|
|
13
|
+
],
|
|
14
|
+
"homepage": "https://github.com/fayas-mansoor-slalom/sf-pr-comments",
|
|
15
|
+
"bugs": {
|
|
16
|
+
"url": "https://github.com/fayas-mansoor-slalom/sf-pr-comments/issues"
|
|
17
|
+
},
|
|
18
|
+
"repository": {
|
|
19
|
+
"type": "git",
|
|
20
|
+
"url": "git+https://github.com/salesforcecli/sf-pr-comments.git"
|
|
21
|
+
},
|
|
22
|
+
"license": "BSD-3-Clause",
|
|
5
23
|
"author": "Fayas Mansoor @fayas-mansoor-slalom",
|
|
6
|
-
"
|
|
24
|
+
"type": "commonjs",
|
|
25
|
+
"main": "lib/index.js",
|
|
26
|
+
"types": "./lib/index.d.ts",
|
|
27
|
+
"directories": {
|
|
28
|
+
"lib": "lib",
|
|
29
|
+
"test": "test"
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"/lib",
|
|
33
|
+
"/messages",
|
|
34
|
+
"/oclif.manifest.json",
|
|
35
|
+
"/schemas"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "wireit",
|
|
39
|
+
"clean": "sf-clean",
|
|
40
|
+
"clean-all": "sf-clean all",
|
|
41
|
+
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
|
|
42
|
+
"compile": "wireit",
|
|
43
|
+
"docs": "sf-docs",
|
|
44
|
+
"format": "wireit",
|
|
45
|
+
"lint": "wireit",
|
|
46
|
+
"postpack": "shx rm -f oclif.manifest.json",
|
|
47
|
+
"prepack": "sf-prepack",
|
|
48
|
+
"prepare": "sf-install",
|
|
49
|
+
"test": "wireit",
|
|
50
|
+
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
|
|
51
|
+
"test:only": "wireit",
|
|
52
|
+
"version": "oclif readme"
|
|
53
|
+
},
|
|
7
54
|
"dependencies": {
|
|
8
55
|
"@oclif/core": "^2.0.7",
|
|
9
|
-
"@salesforce/core": "^3.
|
|
56
|
+
"@salesforce/core": "^3.36.2",
|
|
10
57
|
"@salesforce/kit": "^1.8.5",
|
|
11
58
|
"@salesforce/sf-plugins-core": "^2.2.7",
|
|
12
59
|
"azure-devops-node-api": "^14.1.0",
|
|
13
60
|
"diff-parse": "^0.0.13",
|
|
14
61
|
"git-pr-diff-parser": "^0.2.1",
|
|
62
|
+
"octokit": "^5.0.5",
|
|
15
63
|
"tslib": "^2"
|
|
16
64
|
},
|
|
17
65
|
"devDependencies": {
|
|
@@ -51,24 +99,12 @@
|
|
|
51
99
|
"engines": {
|
|
52
100
|
"node": ">=14.0.0"
|
|
53
101
|
},
|
|
54
|
-
"
|
|
55
|
-
"
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
"
|
|
59
|
-
|
|
60
|
-
"homepage": "https://github.com/fayas-mansoor-slalom/sf-pr-comments",
|
|
61
|
-
"keywords": [
|
|
62
|
-
"force",
|
|
63
|
-
"salesforce",
|
|
64
|
-
"sfdx",
|
|
65
|
-
"salesforcedx",
|
|
66
|
-
"sfdx-plugin",
|
|
67
|
-
"sf-plugin",
|
|
68
|
-
"sf"
|
|
69
|
-
],
|
|
70
|
-
"license": "BSD-3-Clause",
|
|
71
|
-
"main": "lib/index.js",
|
|
102
|
+
"resolutions": {
|
|
103
|
+
"jsforce": "2.0.0-beta.23"
|
|
104
|
+
},
|
|
105
|
+
"publishConfig": {
|
|
106
|
+
"access": "public"
|
|
107
|
+
},
|
|
72
108
|
"oclif": {
|
|
73
109
|
"commands": "./lib/commands",
|
|
74
110
|
"bin": "sf",
|
|
@@ -90,27 +126,6 @@
|
|
|
90
126
|
}
|
|
91
127
|
}
|
|
92
128
|
},
|
|
93
|
-
"repository": "salesforcecli/sf-pr-comments",
|
|
94
|
-
"scripts": {
|
|
95
|
-
"build": "wireit",
|
|
96
|
-
"clean": "sf-clean",
|
|
97
|
-
"clean-all": "sf-clean all",
|
|
98
|
-
"clean:lib": "shx rm -rf lib && shx rm -rf coverage && shx rm -rf .nyc_output && shx rm -f oclif.manifest.json",
|
|
99
|
-
"compile": "wireit",
|
|
100
|
-
"docs": "sf-docs",
|
|
101
|
-
"format": "wireit",
|
|
102
|
-
"lint": "wireit",
|
|
103
|
-
"postpack": "shx rm -f oclif.manifest.json",
|
|
104
|
-
"prepack": "sf-prepack",
|
|
105
|
-
"prepare": "sf-install",
|
|
106
|
-
"test": "wireit",
|
|
107
|
-
"test:nuts": "nyc mocha \"**/*.nut.ts\" --slow 4500 --timeout 600000 --parallel",
|
|
108
|
-
"test:only": "wireit",
|
|
109
|
-
"version": "oclif readme"
|
|
110
|
-
},
|
|
111
|
-
"publishConfig": {
|
|
112
|
-
"access": "public"
|
|
113
|
-
},
|
|
114
129
|
"wireit": {
|
|
115
130
|
"build": {
|
|
116
131
|
"dependencies": [
|
package/oclif.manifest.json
DELETED
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"version": "0.2.4",
|
|
3
|
-
"commands": {
|
|
4
|
-
"azure:postcomments": {
|
|
5
|
-
"id": "azure:postcomments",
|
|
6
|
-
"summary": "This helps post code review comments from a JSON file to azure repo pull request.",
|
|
7
|
-
"strict": true,
|
|
8
|
-
"pluginName": "@slalom-salesforce/sf-pr-comments",
|
|
9
|
-
"pluginAlias": "@slalom-salesforce/sf-pr-comments",
|
|
10
|
-
"pluginType": "core",
|
|
11
|
-
"aliases": [],
|
|
12
|
-
"examples": [
|
|
13
|
-
"sfdx azure:postcomments --authtoken asdasczxccxc --azureorgname 'organization-name' --azureprojectname 'ProjectName' --azurereponame 'RepoName' --foldernamefordiff '/path/to/diff/folder/' --gitfoldername '/path/to/git/folder' --reviewresultjsonfile '/path/to/code/review/comment/output/in/json/from/sfdx/scanner/staticCodeAnalyzerResults.json' --azureprid 1"
|
|
14
|
-
],
|
|
15
|
-
"flags": {
|
|
16
|
-
"json": {
|
|
17
|
-
"name": "json",
|
|
18
|
-
"type": "boolean",
|
|
19
|
-
"description": "Format output as json.",
|
|
20
|
-
"helpGroup": "GLOBAL",
|
|
21
|
-
"allowNo": false
|
|
22
|
-
},
|
|
23
|
-
"authtoken": {
|
|
24
|
-
"name": "authtoken",
|
|
25
|
-
"type": "option",
|
|
26
|
-
"char": "t",
|
|
27
|
-
"summary": "Azure Devops personal access token used to authenicate to repo, ensure this token has write / post permission of repo",
|
|
28
|
-
"required": true,
|
|
29
|
-
"multiple": false
|
|
30
|
-
},
|
|
31
|
-
"azureorguri": {
|
|
32
|
-
"name": "azureorguri",
|
|
33
|
-
"type": "option",
|
|
34
|
-
"char": "o",
|
|
35
|
-
"summary": "Name of Azure Organization where the project resides",
|
|
36
|
-
"required": true,
|
|
37
|
-
"multiple": false
|
|
38
|
-
},
|
|
39
|
-
"azureprojectname": {
|
|
40
|
-
"name": "azureprojectname",
|
|
41
|
-
"type": "option",
|
|
42
|
-
"char": "p",
|
|
43
|
-
"summary": "Name of Azure Project where the repo resides",
|
|
44
|
-
"required": true,
|
|
45
|
-
"multiple": false
|
|
46
|
-
},
|
|
47
|
-
"azurereponame": {
|
|
48
|
-
"name": "azurereponame",
|
|
49
|
-
"type": "option",
|
|
50
|
-
"char": "r",
|
|
51
|
-
"summary": "Name of Azure Repo where the PR is being raised",
|
|
52
|
-
"required": true,
|
|
53
|
-
"multiple": false
|
|
54
|
-
},
|
|
55
|
-
"azureprid": {
|
|
56
|
-
"name": "azureprid",
|
|
57
|
-
"type": "option",
|
|
58
|
-
"char": "i",
|
|
59
|
-
"summary": "Pull request id to post the comments to",
|
|
60
|
-
"required": true,
|
|
61
|
-
"multiple": false
|
|
62
|
-
},
|
|
63
|
-
"foldernamefordiff": {
|
|
64
|
-
"name": "foldernamefordiff",
|
|
65
|
-
"type": "option",
|
|
66
|
-
"char": "d",
|
|
67
|
-
"summary": "Name of the folder where diff files will be stored",
|
|
68
|
-
"required": true,
|
|
69
|
-
"multiple": false
|
|
70
|
-
},
|
|
71
|
-
"reviewresultjsonfile": {
|
|
72
|
-
"name": "reviewresultjsonfile",
|
|
73
|
-
"type": "option",
|
|
74
|
-
"char": "F",
|
|
75
|
-
"summary": "Path to file where code review results are stored in JSON format",
|
|
76
|
-
"required": true,
|
|
77
|
-
"multiple": false
|
|
78
|
-
},
|
|
79
|
-
"gitfoldername": {
|
|
80
|
-
"name": "gitfoldername",
|
|
81
|
-
"type": "option",
|
|
82
|
-
"char": "g",
|
|
83
|
-
"summary": "Path to base project folder where git is initialized",
|
|
84
|
-
"required": true,
|
|
85
|
-
"multiple": false
|
|
86
|
-
}
|
|
87
|
-
},
|
|
88
|
-
"args": {}
|
|
89
|
-
},
|
|
90
|
-
"bitbucket:postcomments": {
|
|
91
|
-
"id": "bitbucket:postcomments",
|
|
92
|
-
"summary": "This helps post code review comments from a JSON file to bitbucket pull request.",
|
|
93
|
-
"strict": true,
|
|
94
|
-
"pluginName": "@slalom-salesforce/sf-pr-comments",
|
|
95
|
-
"pluginAlias": "@slalom-salesforce/sf-pr-comments",
|
|
96
|
-
"pluginType": "core",
|
|
97
|
-
"aliases": [],
|
|
98
|
-
"examples": [
|
|
99
|
-
"sfdx bitbucket:postcomments --username 'ci_user' --authtoken 'mybitbucketpersonaltoken' --bitbucketworkspace 'slalom' --bitbucketreposlug 'sfdx_poc' --bitbucketprid 1 --foldernamefordiff './srcDiff' --reviewresultjsonfile './codereviewvoilations.json' --gitfoldername './'"
|
|
100
|
-
],
|
|
101
|
-
"flags": {
|
|
102
|
-
"json": {
|
|
103
|
-
"name": "json",
|
|
104
|
-
"type": "boolean",
|
|
105
|
-
"description": "Format output as json.",
|
|
106
|
-
"helpGroup": "GLOBAL",
|
|
107
|
-
"allowNo": false
|
|
108
|
-
},
|
|
109
|
-
"username": {
|
|
110
|
-
"name": "username",
|
|
111
|
-
"type": "option",
|
|
112
|
-
"char": "N",
|
|
113
|
-
"summary": "Bitbucket username used to authenicate to repo",
|
|
114
|
-
"required": true,
|
|
115
|
-
"multiple": false
|
|
116
|
-
},
|
|
117
|
-
"authtoken": {
|
|
118
|
-
"name": "authtoken",
|
|
119
|
-
"type": "option",
|
|
120
|
-
"char": "t",
|
|
121
|
-
"summary": "Bitbucket personal access token used to authenicate to repo, ensure this token has write / post permission of repo",
|
|
122
|
-
"required": true,
|
|
123
|
-
"multiple": false
|
|
124
|
-
},
|
|
125
|
-
"bitbucketworkspace": {
|
|
126
|
-
"name": "bitbucketworkspace",
|
|
127
|
-
"type": "option",
|
|
128
|
-
"char": "w",
|
|
129
|
-
"summary": "Name of Bitbucket workspace where the repo resides",
|
|
130
|
-
"required": true,
|
|
131
|
-
"multiple": false
|
|
132
|
-
},
|
|
133
|
-
"bitbucketreposlug": {
|
|
134
|
-
"name": "bitbucketreposlug",
|
|
135
|
-
"type": "option",
|
|
136
|
-
"char": "r",
|
|
137
|
-
"summary": "Name of Bitbucket repo slug where the PR is being raised",
|
|
138
|
-
"required": true,
|
|
139
|
-
"multiple": false
|
|
140
|
-
},
|
|
141
|
-
"bitbucketprid": {
|
|
142
|
-
"name": "bitbucketprid",
|
|
143
|
-
"type": "option",
|
|
144
|
-
"char": "i",
|
|
145
|
-
"summary": "Pull request id to post the comments to",
|
|
146
|
-
"required": true,
|
|
147
|
-
"multiple": false
|
|
148
|
-
},
|
|
149
|
-
"foldernamefordiff": {
|
|
150
|
-
"name": "foldernamefordiff",
|
|
151
|
-
"type": "option",
|
|
152
|
-
"char": "d",
|
|
153
|
-
"summary": "Path of the folder where diff files will be stored",
|
|
154
|
-
"required": true,
|
|
155
|
-
"multiple": false
|
|
156
|
-
},
|
|
157
|
-
"gitfoldername": {
|
|
158
|
-
"name": "gitfoldername",
|
|
159
|
-
"type": "option",
|
|
160
|
-
"char": "g",
|
|
161
|
-
"summary": "Path to base project folder where git is initialized",
|
|
162
|
-
"required": true,
|
|
163
|
-
"multiple": false
|
|
164
|
-
},
|
|
165
|
-
"reviewresultjsonfile": {
|
|
166
|
-
"name": "reviewresultjsonfile",
|
|
167
|
-
"type": "option",
|
|
168
|
-
"char": "F",
|
|
169
|
-
"summary": "Path to file where code review results are stored in JSON format",
|
|
170
|
-
"required": true,
|
|
171
|
-
"multiple": false
|
|
172
|
-
}
|
|
173
|
-
},
|
|
174
|
-
"args": {},
|
|
175
|
-
"PAGELENGTH": 50
|
|
176
|
-
},
|
|
177
|
-
"github:postcomments": {
|
|
178
|
-
"id": "github:postcomments",
|
|
179
|
-
"summary": "Summary of a command.",
|
|
180
|
-
"description": "Description of a command.",
|
|
181
|
-
"strict": true,
|
|
182
|
-
"pluginName": "@slalom-salesforce/sf-pr-comments",
|
|
183
|
-
"pluginAlias": "@slalom-salesforce/sf-pr-comments",
|
|
184
|
-
"pluginType": "core",
|
|
185
|
-
"aliases": [],
|
|
186
|
-
"examples": [
|
|
187
|
-
"<%= config.bin %> <%= command.id %>"
|
|
188
|
-
],
|
|
189
|
-
"flags": {
|
|
190
|
-
"json": {
|
|
191
|
-
"name": "json",
|
|
192
|
-
"type": "boolean",
|
|
193
|
-
"description": "Format output as json.",
|
|
194
|
-
"helpGroup": "GLOBAL",
|
|
195
|
-
"allowNo": false
|
|
196
|
-
},
|
|
197
|
-
"name": {
|
|
198
|
-
"name": "name",
|
|
199
|
-
"type": "option",
|
|
200
|
-
"char": "n",
|
|
201
|
-
"summary": "Description of a flag.",
|
|
202
|
-
"required": false,
|
|
203
|
-
"multiple": false
|
|
204
|
-
}
|
|
205
|
-
},
|
|
206
|
-
"args": {}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
}
|