Fix license header file enumeration

This commit is contained in:
Evan Hahn 2021-10-01 16:52:36 -05:00 committed by GitHub
parent c99066de9b
commit b239502813
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 51 additions and 13 deletions

View file

@ -1,4 +1,4 @@
// Copyright 2020 Signal Messenger, LLC
// Copyright 2020-2021 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
// This file is meant to be run frequently, so it doesn't check the license year. See the
@ -8,6 +8,7 @@ import { assert } from 'chai';
import {
forEachRelevantFile,
getExtension,
readFirstLines,
} from '../util/lint/license_comments';
@ -17,7 +18,15 @@ describe('license comments', () => {
this.timeout(10000);
await forEachRelevantFile(async file => {
const [firstLine, secondLine] = await readFirstLines(file, 2);
let firstLine: string;
let secondLine: string;
if (getExtension(file) === '.sh') {
const firstThreeLines = await readFirstLines(file, 3);
[, firstLine, secondLine] = firstThreeLines;
} else {
[firstLine, secondLine] = await readFirstLines(file, 2);
}
const { groups = {} } =
firstLine.match(