(content: string | null)
| 15 | } |
| 16 | |
| 17 | function resolveGitignoreContent(content: string | null): string | null { |
| 18 | if (content == null) { |
| 19 | return REPORTS_SECTION; |
| 20 | } |
| 21 | if (gitignoreContainsEntry(content)) { |
| 22 | return null; |
| 23 | } |
| 24 | const separator = content.endsWith('\n\n') |
| 25 | ? '' |
| 26 | : content.endsWith('\n') |
| 27 | ? '\n' |
| 28 | : '\n\n'; |
| 29 | |
| 30 | return `${content}${separator}${REPORTS_SECTION}`; |
| 31 | } |
| 32 | |
| 33 | function gitignoreContainsEntry(content: string): boolean { |
| 34 | return content.split('\n').some(raw => { |
no test coverage detected