Skip to content

Commit a53eeef

Browse files
committed
chore: remove unnecessary logging in push actions and routes
1 parent e845f1a commit a53eeef

File tree

6 files changed

+6
-37
lines changed

6 files changed

+6
-37
lines changed

src/proxy/processors/push-action/checkAuthorEmails.ts

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -35,15 +35,10 @@ const exec = async (req: any, action: Action): Promise<Action> => {
3535
const uniqueAuthorEmails = [
3636
...new Set(action.commitData?.map((commitData: CommitData) => commitData.authorEmail)),
3737
];
38-
console.log({ uniqueAuthorEmails });
3938

4039
const illegalEmails = uniqueAuthorEmails.filter((email) => !isEmailAllowed(email));
41-
console.log({ illegalEmails });
4240

43-
const usingIllegalEmails = illegalEmails.length > 0;
44-
console.log({ usingIllegalEmails });
45-
46-
if (usingIllegalEmails) {
41+
if (illegalEmails.length > 0) {
4742
console.log(`The following commit author e-mails are illegal: ${illegalEmails}`);
4843

4944
step.error = true;

src/proxy/processors/push-action/checkCommitMessages.ts

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@ const isMessageAllowed = (commitMessage: string): boolean => {
55
try {
66
const commitConfig = getCommitConfig();
77

8-
console.log(`isMessageAllowed(${commitMessage})`);
9-
108
// Commit message is empty, i.e. '', null or undefined
119
if (!commitMessage) {
1210
console.log('No commit message included...');
@@ -19,26 +17,21 @@ const isMessageAllowed = (commitMessage: string): boolean => {
1917
return false;
2018
}
2119

22-
// Configured blocked literals
20+
// Configured blocked literals and patterns
2321
const blockedLiterals: string[] = commitConfig.message?.block?.literals ?? [];
24-
25-
// Configured blocked patterns
2622
const blockedPatterns: string[] = commitConfig.message?.block?.patterns ?? [];
2723

28-
// Find all instances of blocked literals in commit message...
24+
// Find all instances of blocked literals and patterns in commit message
2925
const positiveLiterals = blockedLiterals.map((literal: string) =>
3026
commitMessage.toLowerCase().includes(literal.toLowerCase()),
3127
);
3228

33-
// Find all instances of blocked patterns in commit message...
3429
const positivePatterns = blockedPatterns.map((pattern: string) =>
3530
commitMessage.match(new RegExp(pattern, 'gi')),
3631
);
3732

38-
// Flatten any positive literal results into a 1D array...
33+
// Flatten any positive literal and pattern results into a 1D array
3934
const literalMatches = positiveLiterals.flat().filter((result) => !!result);
40-
41-
// Flatten any positive pattern results into a 1D array...
4235
const patternMatches = positivePatterns.flat().filter((result) => !!result);
4336

4437
// Commit message matches configured block pattern(s)
@@ -59,15 +52,10 @@ const exec = async (req: any, action: Action): Promise<Action> => {
5952
const step = new Step('checkCommitMessages');
6053

6154
const uniqueCommitMessages = [...new Set(action.commitData?.map((commit) => commit.message))];
62-
console.log({ uniqueCommitMessages });
6355

6456
const illegalMessages = uniqueCommitMessages.filter((message) => !isMessageAllowed(message));
65-
console.log({ illegalMessages });
66-
67-
const usingIllegalMessages = illegalMessages.length > 0;
68-
console.log({ usingIllegalMessages });
6957

70-
if (usingIllegalMessages) {
58+
if (illegalMessages.length > 0) {
7159
console.log(`The following commit messages are illegal: ${illegalMessages}`);
7260

7361
step.error = true;

src/proxy/processors/push-action/parsePush.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,6 @@ const getCommitData = (contents: CommitContent[]): CommitData[] => {
222222
.chain(contents)
223223
.filter({ type: GIT_OBJECT_TYPE_COMMIT })
224224
.map((x: CommitContent) => {
225-
console.log({ x });
226-
227225
const allLines = x.content.split('\n');
228226
let headerEndIndex = -1;
229227

@@ -246,7 +244,6 @@ const getCommitData = (contents: CommitContent[]): CommitData[] => {
246244
.slice(headerEndIndex + 1)
247245
.join('\n')
248246
.trim();
249-
console.log({ headerLines, message });
250247

251248
const { tree, parents, author, committer } = getParsedData(headerLines);
252249
// No parent headers -> zero hash

src/service/routes/push.ts

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,6 @@ router.post('/:id/reject', async (req: Request, res: Response) => {
6969
}
7070

7171
const isAllowed = await db.canUserApproveRejectPush(id, username);
72-
console.log({ isAllowed });
7372

7473
if (isAllowed) {
7574
const result = await db.reject(id, null);
@@ -84,25 +83,19 @@ router.post('/:id/reject', async (req: Request, res: Response) => {
8483

8584
router.post('/:id/authorise', async (req: Request, res: Response) => {
8685
const questions = req.body.params?.attestation;
87-
console.log({ questions });
8886

8987
// TODO: compare attestation to configuration and ensure all questions are answered
9088
// - we shouldn't go on the definition in the request!
9189
const attestationComplete = questions?.every(
9290
(question: { checked: boolean }) => !!question.checked,
9391
);
94-
console.log({ attestationComplete });
9592

9693
if (req.user && attestationComplete) {
9794
const id = req.params.id;
98-
console.log({ id });
9995

10096
const { username } = req.user as { username: string };
10197

102-
// Get the push request
10398
const push = await db.getPush(id);
104-
console.log({ push });
105-
10699
if (!push) {
107100
res.status(404).send({
108101
message: 'Push request not found',
@@ -114,7 +107,6 @@ router.post('/:id/authorise', async (req: Request, res: Response) => {
114107
const committerEmail = push.userEmail;
115108

116109
const list = await db.getUsers({ email: committerEmail });
117-
console.log({ list });
118110

119111
if (list.length === 0) {
120112
res.status(401).send({
@@ -196,7 +188,6 @@ router.post('/:id/cancel', async (req: Request, res: Response) => {
196188
async function getValidPushOrRespond(id: string, res: Response) {
197189
console.log('getValidPushOrRespond', { id });
198190
const push = await db.getPush(id);
199-
console.log({ push });
200191

201192
if (!push) {
202193
res.status(404).send({ message: `Push request not found` });

src/ui/views/PushDetails/PushDetails.tsx

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,10 @@ const Dashboard: React.FC = () => {
4242

4343
const setUserAllowedToApprove = (userAllowedToApprove: boolean) => {
4444
isUserAllowedToApprove = userAllowedToApprove;
45-
console.log('isUserAllowedToApprove:' + isUserAllowedToApprove);
4645
};
4746

4847
const setUserAllowedToReject = (userAllowedToReject: boolean) => {
4948
isUserAllowedToReject = userAllowedToReject;
50-
console.log({ isUserAllowedToReject });
5149
};
5250

5351
useEffect(() => {

website/docs/configuration/reference.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1931,4 +1931,4 @@ Specific value: `"jwt"`
19311931
</details>
19321932

19331933
----------------------------------------------------------------------------------------------------------------------------
1934-
Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2025-11-18 at 13:43:30 +0900
1934+
Generated using [json-schema-for-humans](https://github.com/coveooss/json-schema-for-humans) on 2025-11-18 at 19:51:24 +0900

0 commit comments

Comments
 (0)