Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(statistics): split the stats between issues and PRs #364

Merged
merged 29 commits into from
Apr 27, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
c21e2f2
Merge pull request #1 from actions/main
C0ZEN Nov 22, 2020
c913fa4
Merge pull request #2 from actions/main
C0ZEN Jan 16, 2021
9cf9bf2
Merge pull request #3 from actions/main
C0ZEN Jan 16, 2021
f11f623
Merge pull request #4 from actions/main
C0ZEN Jan 16, 2021
0f1457a
Merge pull request #5 from actions/main
C0ZEN Jan 17, 2021
fef6333
Merge pull request #6 from actions/main
C0ZEN Jan 18, 2021
e1ba62c
Merge pull request #7 from actions/main
C0ZEN Jan 23, 2021
abab4a6
Merge pull request #8 from actions/main
C0ZEN Feb 9, 2021
920683c
Merge pull request #9 from actions/main
C0ZEN Feb 13, 2021
a98474b
Merge pull request #10 from actions/main
C0ZEN Feb 18, 2021
915ed27
Merge pull request #11 from actions/main
C0ZEN Mar 1, 2021
4b097b3
Merge pull request #12 from actions/main
C0ZEN Mar 1, 2021
5575ade
docs(only-labels): enhance the docs and fix duplicate (#341)
C0ZEN Mar 4, 2021
b806328
build(deps-dev): bump @typescript-eslint/eslint-plugin (#342)
dependabot[bot] Mar 4, 2021
c6b2c30
build(deps): bump @octokit/rest from 18.3.0 to 18.3.2 (#350)
dependabot[bot] Mar 4, 2021
5a8ec1e
Merge pull request #14 from actions/main
C0ZEN Mar 4, 2021
6c29691
test: add more coverage for the stale label behaviour (#352) (#15)
C0ZEN Mar 5, 2021
d485d43
test: add more coverage for the stale label behaviour (#352) (#17)
C0ZEN Mar 9, 2021
efde10c
test(refactor): use toHaveLength
C0ZEN Mar 7, 2021
f0f5502
feat(statistics): split the processed issues and prs
C0ZEN Mar 7, 2021
5b0af23
feat(statistics): split the new stale issues and prs
C0ZEN Mar 7, 2021
96d047c
feat(statistics): split the no longer stale issues and prs
C0ZEN Mar 7, 2021
71853e9
chore(deps): undo upgrade of dependencies
C0ZEN Mar 7, 2021
56d2542
feat(statistics): split closed issues and prs
C0ZEN Mar 9, 2021
929bcd9
feat(statistics): use the word "items" when something concern both is…
C0ZEN Mar 9, 2021
197df6f
feat(statistics): split more stats by issues and prs
C0ZEN Mar 9, 2021
560eb01
feat(statistics): split more stats by issues and prs (final)
C0ZEN Mar 9, 2021
3aeeab6
Merge branch 'main' into feature/statistics
C0ZEN Mar 9, 2021
01a1bd4
chore(index): update it
C0ZEN Mar 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
feat(statistics): use the word "items" when something concern both is…
…sues and prs
  • Loading branch information
C0ZEN committed Mar 9, 2021
commit 929bcd92f273647f24534111fa2b97027bac119e
51 changes: 25 additions & 26 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -418,7 +418,7 @@ class IssuesProcessor {
// find any comments since date on the given issue
try {
this._operations.consumeOperation();
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedIssuesCommentsCount();
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCommentsCount();
const comments = yield this.client.issues.listComments({
owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
Expand Down Expand Up @@ -463,7 +463,7 @@ class IssuesProcessor {
direction: this.options.ascending ? 'asc' : 'desc',
page
});
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedIssuesCount(issueResult.data.length);
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsCount(issueResult.data.length);
return issueResult.data.map((issue) => new issue_1.Issue(this.options, issue));
}
catch (error) {
Expand All @@ -480,7 +480,7 @@ class IssuesProcessor {
const issueLogger = new issue_logger_1.IssueLogger(issue);
issueLogger.info(`Checking for label on $$type`);
this._operations.consumeOperation();
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedIssuesEventsCount();
(_a = this._statistics) === null || _a === void 0 ? void 0 : _a.incrementFetchedItemsEventsCount();
const options = this.client.issues.listEvents.endpoint.merge({
owner: github_1.context.repo.owner,
repo: github_1.context.repo.repo,
Expand Down Expand Up @@ -1125,9 +1125,9 @@ class Statistics {
this._deletedBranchesCount = 0;
this._addedLabelsCount = 0;
this._addedCommentsCount = 0;
this._fetchedIssuesCount = 0;
this._fetchedIssuesEventsCount = 0;
this._fetchedIssuesCommentsCount = 0;
this._fetchedItemsCount = 0;
this._fetchedItemsEventsCount = 0;
this._fetchedItemsCommentsCount = 0;
this._fetchedPullRequestsCount = 0;
}
incrementProcessedItemsCount(issue, increment = 1) {
Expand Down Expand Up @@ -1178,16 +1178,16 @@ class Statistics {
this._addedCommentsCount += increment;
return this;
}
incrementFetchedIssuesCount(increment = 1) {
this._fetchedIssuesCount += increment;
incrementFetchedItemsCount(increment = 1) {
this._fetchedItemsCount += increment;
return this;
}
incrementFetchedIssuesEventsCount(increment = 1) {
this._fetchedIssuesEventsCount += increment;
incrementFetchedItemsEventsCount(increment = 1) {
this._fetchedItemsEventsCount += increment;
return this;
}
incrementFetchedIssuesCommentsCount(increment = 1) {
this._fetchedIssuesCommentsCount += increment;
incrementFetchedItemsCommentsCount(increment = 1) {
this._fetchedItemsCommentsCount += increment;
return this;
}
incrementFetchedPullRequestsCount(increment = 1) {
Expand All @@ -1205,12 +1205,11 @@ class Statistics {
this._logDeletedBranchesCount();
this._logAddedLabelsCount();
this._logAddedCommentsCount();
this._logFetchedIssuesCount();
this._logFetchedIssuesEventsCount();
this._logFetchedIssuesCommentsCount();
this._logFetchedItemsCount();
this._logFetchedItemsEventsCount();
this._logFetchedItemsCommentsCount();
this._logFetchedPullRequestsCount();
this._logOperationsCount();
this._logger.info('---');
return this;
}
_incrementProcessedIssuesCount(increment = 1) {
Expand Down Expand Up @@ -1308,14 +1307,14 @@ class Statistics {
_logAddedCommentsCount() {
this._logCount('Added comments', this._addedCommentsCount);
}
_logFetchedIssuesCount() {
this._logCount('Fetched issues', this._fetchedIssuesCount);
_logFetchedItemsCount() {
this._logCount('Fetched items', this._fetchedItemsCount);
}
_logFetchedIssuesEventsCount() {
this._logCount('Fetched issues events', this._fetchedIssuesEventsCount);
_logFetchedItemsEventsCount() {
this._logCount('Fetched items events', this._fetchedItemsEventsCount);
}
_logFetchedIssuesCommentsCount() {
this._logCount('Fetched issues comments', this._fetchedIssuesCommentsCount);
_logFetchedItemsCommentsCount() {
this._logCount('Fetched items comments', this._fetchedItemsCommentsCount);
}
_logFetchedPullRequestsCount() {
this._logCount('Fetched pull requests', this._fetchedPullRequestsCount);
Expand Down Expand Up @@ -1370,7 +1369,7 @@ class Statistics {
const longestValue = this._getLongestGroupValue(onlyValuesSet);
for (const [index, value] of onlyValuesSet.entries()) {
const prefix = index === onlyValuesSet.length - 1 ? '└──' : '├──';
this._logCount(`${prefix} ${value.name.padEnd(longestValue, ' ')}`, value.count);
this._logCount(`${chalk_1.default.white(prefix)} ${value.name.padEnd(longestValue, ' ')}`, value.count);
}
}
_getLongestGroupValue(values) {
Expand Down Expand Up @@ -10361,7 +10360,7 @@ module.exports = require("zlib");;
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
Expand All @@ -10375,7 +10374,7 @@ module.exports = require("zlib");;
/******/ return module;
/******/ };
/******/ })();
/******/
/******/
/******/ /* webpack/runtime/compat */
/******/
/******/ __nccwpck_require__.ab = __dirname + "/";/************************************************************************/
Expand All @@ -10384,4 +10383,4 @@ module.exports = require("zlib");;
/******/ // Load entry module and return exports
/******/ return __nccwpck_require__(3109);
/******/ })()
;
;
6 changes: 3 additions & 3 deletions src/classes/issues-processor.ts
Original file line number Diff line number Diff line change
Expand Up @@ -320,7 +320,7 @@ export class IssuesProcessor {
// find any comments since date on the given issue
try {
this._operations.consumeOperation();
this._statistics?.incrementFetchedIssuesCommentsCount();
this._statistics?.incrementFetchedItemsCommentsCount();
const comments = await this.client.issues.listComments({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down Expand Up @@ -366,7 +366,7 @@ export class IssuesProcessor {
page
}
);
this._statistics?.incrementFetchedIssuesCount(issueResult.data.length);
this._statistics?.incrementFetchedItemsCount(issueResult.data.length);

return issueResult.data.map(
(issue: Readonly<IIssue>): Issue => new Issue(this.options, issue)
Expand All @@ -388,7 +388,7 @@ export class IssuesProcessor {
issueLogger.info(`Checking for label on $$type`);

this._operations.consumeOperation();
this._statistics?.incrementFetchedIssuesEventsCount();
this._statistics?.incrementFetchedItemsEventsCount();
const options = this.client.issues.listEvents.endpoint.merge({
owner: context.repo.owner,
repo: context.repo.repo,
Expand Down
38 changes: 19 additions & 19 deletions src/classes/statistics.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ export class Statistics {
private _deletedBranchesCount = 0;
private _addedLabelsCount = 0;
private _addedCommentsCount = 0;
private _fetchedIssuesCount = 0;
private _fetchedIssuesEventsCount = 0;
private _fetchedIssuesCommentsCount = 0;
private _fetchedItemsCount = 0;
private _fetchedItemsEventsCount = 0;
private _fetchedItemsCommentsCount = 0;
private _fetchedPullRequestsCount = 0;

incrementProcessedItemsCount(
Expand Down Expand Up @@ -110,24 +110,24 @@ export class Statistics {
return this;
}

incrementFetchedIssuesCount(increment: Readonly<number> = 1): Statistics {
this._fetchedIssuesCount += increment;
incrementFetchedItemsCount(increment: Readonly<number> = 1): Statistics {
this._fetchedItemsCount += increment;

return this;
}

incrementFetchedIssuesEventsCount(
incrementFetchedItemsEventsCount(
increment: Readonly<number> = 1
): Statistics {
this._fetchedIssuesEventsCount += increment;
this._fetchedItemsEventsCount += increment;

return this;
}

incrementFetchedIssuesCommentsCount(
incrementFetchedItemsCommentsCount(
increment: Readonly<number> = 1
): Statistics {
this._fetchedIssuesCommentsCount += increment;
this._fetchedItemsCommentsCount += increment;

return this;
}
Expand All @@ -151,9 +151,9 @@ export class Statistics {
this._logDeletedBranchesCount();
this._logAddedLabelsCount();
this._logAddedCommentsCount();
this._logFetchedIssuesCount();
this._logFetchedIssuesEventsCount();
this._logFetchedIssuesCommentsCount();
this._logFetchedItemsCount();
this._logFetchedItemsEventsCount();
this._logFetchedItemsCommentsCount();
this._logFetchedPullRequestsCount();
this._logOperationsCount();

Expand Down Expand Up @@ -296,16 +296,16 @@ export class Statistics {
this._logCount('Added comments', this._addedCommentsCount);
}

private _logFetchedIssuesCount(): void {
this._logCount('Fetched issues', this._fetchedIssuesCount);
private _logFetchedItemsCount(): void {
this._logCount('Fetched items', this._fetchedItemsCount);
}

private _logFetchedIssuesEventsCount(): void {
this._logCount('Fetched issues events', this._fetchedIssuesEventsCount);
private _logFetchedItemsEventsCount(): void {
this._logCount('Fetched items events', this._fetchedItemsEventsCount);
}

private _logFetchedIssuesCommentsCount(): void {
this._logCount('Fetched issues comments', this._fetchedIssuesCommentsCount);
private _logFetchedItemsCommentsCount(): void {
this._logCount('Fetched items comments', this._fetchedItemsCommentsCount);
}

private _logFetchedPullRequestsCount(): void {
Expand Down Expand Up @@ -376,7 +376,7 @@ export class Statistics {
const prefix = index === onlyValuesSet.length - 1 ? '└──' : '├──';

this._logCount(
`${prefix} ${value.name.padEnd(longestValue, ' ')}`,
`${chalk.white(prefix)} ${value.name.padEnd(longestValue, ' ')}`,
value.count
);
}
Expand Down