diff --git a/microbit/v1/source/main.cpp b/microbit/v1/source/main.cpp index 3989abb73..cecff4c73 100755 --- a/microbit/v1/source/main.cpp +++ b/microbit/v1/source/main.cpp @@ -1,3 +1,8 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ #include "MicroBit.h" #include "MicroBitUARTService.h" #include "MicroBitAccelerometerService.h" diff --git a/microbit/v2/source/codebook.h b/microbit/v2/source/codebook.h index 3e911e5b3..4cad3e28d 100644 --- a/microbit/v2/source/codebook.h +++ b/microbit/v2/source/codebook.h @@ -1,3 +1,9 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ + #include "MicroBit.h" #ifndef CODEBOOK_H_INCLUDED #define CODEBOOK_H_INCLUDED diff --git a/microbit/v2/source/helpers.cpp b/microbit/v2/source/helpers.cpp index 30d201302..4e18ada6e 100644 --- a/microbit/v2/source/helpers.cpp +++ b/microbit/v2/source/helpers.cpp @@ -1,3 +1,9 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ + #include "MicroBit.h" #include "codebook.h" #include "utilities.h" diff --git a/microbit/v2/source/main.cpp b/microbit/v2/source/main.cpp index 98ed45ad7..4bc8913b0 100644 --- a/microbit/v2/source/main.cpp +++ b/microbit/v2/source/main.cpp @@ -1,3 +1,8 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ #include "MicroBit.h" #include "MicroBitUARTService.h" #include "MicroBitAccelerometerService.h" diff --git a/microbit/v2/source/smileys.h b/microbit/v2/source/smileys.h index 35dc201ba..e89454387 100644 --- a/microbit/v2/source/smileys.h +++ b/microbit/v2/source/smileys.h @@ -1,3 +1,8 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ #include "utilities.h" #ifndef SMILEYS_H_INCLUDED #define SMILEYS_H_INCLUDED diff --git a/microbit/v2/source/sound.cpp b/microbit/v2/source/sound.cpp index 1ceddd785..94068579b 100644 --- a/microbit/v2/source/sound.cpp +++ b/microbit/v2/source/sound.cpp @@ -1,3 +1,8 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ #include "MicroBit.h" #include "utilities.h" #include "sounds.h" diff --git a/microbit/v2/source/sounds.h b/microbit/v2/source/sounds.h index c4b09b373..7e6f14bf3 100644 --- a/microbit/v2/source/sounds.h +++ b/microbit/v2/source/sounds.h @@ -1,3 +1,8 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ #include "utilities.h" #ifndef SOUNDS_H_INCLUDED #define SOUNDS_H_INCLUDED diff --git a/microbit/v2/source/utilities.h b/microbit/v2/source/utilities.h index 8fb026e0c..5bc6b4488 100644 --- a/microbit/v2/source/utilities.h +++ b/microbit/v2/source/utilities.h @@ -1,3 +1,8 @@ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ #ifndef UTILITIES_H_INCLUDED #define UTILITIES_H_INCLUDED diff --git a/src/__tests__/license-identifiers.test.ts b/src/__tests__/license-identifiers.test.ts index c892da9a4..35c809358 100644 --- a/src/__tests__/license-identifiers.test.ts +++ b/src/__tests__/license-identifiers.test.ts @@ -1,6 +1,11 @@ /** * @jest-environment jsdom */ +/** + * (c) 2023, Center for Computational Thinking and Design at Aarhus University and contributors + * + * SPDX-License-Identifier: MIT + */ import fs from 'fs'; import 'jest-expect-message'; @@ -8,6 +13,7 @@ import * as path from 'path'; // Place files you wish to ignore by name in here const ignoredFiles: string[] = []; +const directoriesToScan = ['./src/', './microbit/v2/source/', './microbit/v1/source/'] const licenseIdentifierStringContributors = 'Center for Computational Thinking and Design at Aarhus University and contributors'; @@ -61,7 +67,7 @@ const filesMissingIdentifier = (files: string[], expects: string[]): string[] => for (const expect of expects) { if (!readFile('./' + files[i], expect)) { if (!filesWithMissingIdentifier.includes(files[i])) { - filesWithMissingIdentifier.push(files[i]); + filesWithMissingIdentifier.push(files[i]); } } } @@ -73,7 +79,13 @@ describe('License identifier tests', () => { test( 'All files should contain license identifier', () => { - const flatten = flattenDirectory('./src/'); + + const flatten = directoriesToScan.reduce( + (acc: any, current) => { + return acc.concat(flattenDirectory(current)) + }, [] + ); + const faultyFiles = filesMissingIdentifier(flatten, [ licenseIdentifierStringContributors, licenseIdentifierStringSPDX, @@ -81,9 +93,9 @@ describe('License identifier tests', () => { expect( faultyFiles.length, 'Some files do not contain identifier! ' + - faultyFiles - .map(val => `\n \u001b[35m${val} \u001b[0mis missing license identifier`) - .join(), + faultyFiles + .map(val => `\n \u001b[35m${val} \u001b[0mis missing license identifier`) + .join(), ).toEqual(0); }, 60000 * 10,