Skip to content

Commit 4ad52af

Browse files
committed
Output found singleton
1 parent a4b8634 commit 4ad52af

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

org/allPRs.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,11 @@ export const singletons = async () => {
9292
for (const file of changedFiles) {
9393
let diff = await danger.git.diffForFile(file);
9494
let addedLines = diff?.added.split(/\n/);
95-
if (addedLines?.find(value => /^\+(?!\s*\/\/)\s*(?:public|private|internal)?\s*static\s*(?:let|var)\s*shared(?:\s*:.+)?\s*=.*$/.test(value))) {
96-
fail("New singleton definitions are not allowed.");
95+
const foundSingleton = addedLines?.find(value => /^\+(?!\s*\/\/)\s*(?:public|private|internal)?\s*static\s*(?:let|var)\s*shared(?:\s*:.+)?\s*=.*$/.test(value));
96+
if (foundSingleton) {
97+
// trim leading + and whitespace
98+
const cleanLine = foundSingleton.replace(/^\+\s*/, '').trim();
99+
fail(`New singleton definitions are not allowed. Found: \`${cleanLine}\``);
97100
return;
98101
}
99102
}

0 commit comments

Comments
 (0)