fix linting

This commit is contained in:
mviswanathsai 2024-03-05 19:03:44 +05:30
parent e0c4e25b76
commit 8fb3b504a0
No known key found for this signature in database
GPG Key ID: 87DE7BD64227C60A
6 changed files with 1800 additions and 1798 deletions

View File

@ -52,7 +52,8 @@ export class IssuesProcessor {
issueLogger.info(
LoggerService.cyan(consumedOperationsCount),
`operation${consumedOperationsCount > 1 ? 's' : ''
`operation${
consumedOperationsCount > 1 ? 's' : ''
} consumed for this $$type`
);
}
@ -256,7 +257,6 @@ export class IssuesProcessor {
? this._getDaysBeforePrStale()
: this._getDaysBeforeIssueStale();
if (issue.state === 'closed') {
issueLogger.info(`Skipping this $$type because it is closed`);
IssuesProcessor._endIssueProcessing(issue);
@ -368,7 +368,6 @@ export class IssuesProcessor {
}
}
// Check if the issue is stale, if not, check if it is rotten and then log the findings.
if (issue.isStale) {
issueLogger.info(`This $$type includes a stale label`);
@ -376,8 +375,7 @@ export class IssuesProcessor {
issueLogger.info(`This $$type does not include a stale label`);
if (issue.isRotten) {
issueLogger.info(`This $$type includes a rotten label`);
}
else {
} else {
issueLogger.info(`This $$type does not include a rotten label`);
}
}
@ -495,8 +493,7 @@ export class IssuesProcessor {
closeMessage,
closeLabel
);
}
else {
} else {
const shouldIgnoreUpdates: boolean = new IgnoreUpdates(
this.options,
issue
@ -587,7 +584,7 @@ export class IssuesProcessor {
labelsToAddWhenUnrotten,
labelsToRemoveWhenUnrotten,
labelsToRemoveWhenRotten,
skipRottenMessage,
skipRottenMessage
);
}
@ -724,7 +721,7 @@ export class IssuesProcessor {
) {
const issueLogger: IssueLogger = new IssueLogger(issue);
var issueHasClosed: boolean = false
let issueHasClosed: boolean = false;
// We can get the label creation date from the getLableCreationDate function
const markedStaleOn: string =
@ -826,17 +823,15 @@ export class IssuesProcessor {
`Stale $$type cannot be rotten or closed because days before rotten: ${daysBeforeRotten}, and days before close: ${daysBeforeClose}`
);
return;
}
else {
} else {
issueLogger.info(
`Closing issue without rottening it because days before $$type rotten: ${LoggerService.cyan(daysBeforeRotten)}`
`Closing issue without rottening it because days before $$type rotten: ${LoggerService.cyan(
daysBeforeRotten
)}`
);
let issueHasUpdateInCloseWindow: boolean
issueHasUpdateInCloseWindow = IssuesProcessor._updatedSince(
issue.updated_at,
daysBeforeClose
);
const issueHasUpdateInCloseWindow: boolean =
IssuesProcessor._updatedSince(issue.updated_at, daysBeforeClose);
issueLogger.info(
`$$type has been updated in the last ${daysBeforeClose} days: ${LoggerService.cyan(
issueHasUpdateInCloseWindow
@ -887,8 +882,7 @@ export class IssuesProcessor {
issue
).shouldIgnoreUpdates();
let shouldBeRotten: boolean;
shouldBeRotten = !IssuesProcessor._updatedSince(
const shouldBeRotten: boolean = !IssuesProcessor._updatedSince(
issue.updated_at,
daysBeforeRotten
);
@ -914,7 +908,12 @@ export class IssuesProcessor {
this._getDaysBeforeRottenUsedOptionName(issue)
)} (${LoggerService.cyan(daysBeforeRotten)})`
);
await this._markRotten(issue, rottenMessage, rottenLabel, skipMessage);
await this._markRotten(
issue,
rottenMessage,
rottenLabel,
skipMessage
);
issue.isRotten = true; // This issue is now considered rotten
issue.markedRottenThisRun = true;
issueLogger.info(`This $$type is now rotten`);
@ -952,10 +951,9 @@ export class IssuesProcessor {
labelsToRemoveWhenUnrotten,
labelsToRemoveWhenRotten,
closeMessage,
closeLabel,
)
closeLabel
);
}
}
private async _processRottenIssue(
issue: Issue,
@ -1054,7 +1052,9 @@ export class IssuesProcessor {
);
await this._addLabelsWhenUnrotten(issue, labelsToAddWhenUnrotten);
issueLogger.info(`Skipping the process since the $$type is now un-rotten`);
issueLogger.info(
`Skipping the process since the $$type is now un-rotten`
);
return; // Nothing to do because it is no longer rotten
}
@ -1237,7 +1237,6 @@ export class IssuesProcessor {
}
}
// Close an issue based on staleness
private async _closeIssue(
issue: Issue,
@ -1357,7 +1356,8 @@ export class IssuesProcessor {
issueLogger.warning(
`Deleting the branch "${LoggerService.cyan(
branch
)}" has skipped because it belongs to other repo ${pullRequest.head.repo.full_name
)}" has skipped because it belongs to other repo ${
pullRequest.head.repo.full_name
}`
);
}
@ -1372,7 +1372,8 @@ export class IssuesProcessor {
const issueLogger: IssueLogger = new IssueLogger(issue);
issueLogger.info(
`${isSubStep ? LoggerService.white('├── ') : ''
`${
isSubStep ? LoggerService.white('├── ') : ''
}Removing the label "${LoggerService.cyan(label)}" from this $$type...`
);
this.removedLabelIssues.push(issue);
@ -1391,12 +1392,14 @@ export class IssuesProcessor {
}
issueLogger.info(
`${isSubStep ? LoggerService.white('└── ') : ''
`${
isSubStep ? LoggerService.white('└── ') : ''
}The label "${LoggerService.cyan(label)}" was removed`
);
} catch (error) {
issueLogger.error(
`${isSubStep ? LoggerService.white('└── ') : ''
`${
isSubStep ? LoggerService.white('└── ') : ''
}Error when removing the label: "${LoggerService.cyan(error.message)}"`
);
}
@ -1437,7 +1440,6 @@ export class IssuesProcessor {
: this.options.daysBeforePrClose;
}
private _getOnlyLabels(issue: Issue): string {
if (issue.isPullRequest) {
if (this.options.onlyPrLabels !== '') {
@ -1523,7 +1525,6 @@ export class IssuesProcessor {
}
}
private async _addLabelsWhenUnstale(
issue: Issue,
labelsToAdd: Readonly<string>[]

View File

@ -80,7 +80,6 @@ export class Statistics {
return this._incrementUndoRottenIssuesCount(increment);
}
setOperationsCount(operationsCount: Readonly<number>): Statistics {
this.operationsCount = operationsCount;

View File

@ -55,8 +55,8 @@ export enum Option {
LabelsToRemoveWhenUnstale = 'labels-to-remove-when-unstale',
LabelsToAddWhenUnstale = 'labels-to-add-when-unstale',
LabelsToRemoveWhenRotten = 'labels-to-remove-when-rotten',
LabelsToRemoveWhenUnrotten = 'labels-to-remove-when-unstale',
LabelsToAddWhenUnrotten = 'labels-to-add-when-unstale',
LabelsToRemoveWhenUnrotten = 'labels-to-remove-when-unrotten',
LabelsToAddWhenUnrotten = 'labels-to-add-when-unrotten',
IgnoreUpdates = 'ignore-updates',
IgnoreIssueUpdates = 'ignore-issue-updates',
IgnorePrUpdates = 'ignore-pr-updates',

View File

@ -72,7 +72,9 @@ function _getAndValidateArgs(): IIssuesProcessorOptions {
),
daysBeforeIssueStale: parseFloat(core.getInput('days-before-issue-stale')),
daysBeforePrStale: parseFloat(core.getInput('days-before-pr-stale')),
daysBeforeIssueRotten: parseFloat(core.getInput('days-before-issue-rotten')),
daysBeforeIssueRotten: parseFloat(
core.getInput('days-before-issue-rotten')
),
daysBeforePrRotten: parseFloat(core.getInput('days-before-pr-rotten')),
daysBeforeClose: parseInt(
core.getInput('days-before-close', {required: true})