Skip to content

Commit 1e3f0d7

Browse files
authored
feat: Add Pre-Commit Copyright Date Check & Fix Automation (#583)
* feat: add copyright date check & fix automation * feat: validate space around dates; update tests; * fix: update test input dates * fix: add exclude paths to pre-commit date update; update test input dates; * feat: enforce copyright headers via eslint-plugin-header
1 parent ecb7562 commit 1e3f0d7

14 files changed

Lines changed: 448 additions & 8 deletions

File tree

.eslintrc.json

Lines changed: 33 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,39 @@
11
{
22
"root": true,
3-
"plugins": ["@typescript-eslint", "@nx"],
3+
"plugins": ["@typescript-eslint", "@nx", "header"],
44
"overrides": [
5+
{
6+
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
7+
"excludedFiles": [
8+
"**/*.spec.ts",
9+
"**/*.spec.tsx",
10+
"**/*.test.ts",
11+
"**/*.test.tsx",
12+
"**/*.spec.js",
13+
"**/*.spec.jsx",
14+
"**/*.test.js",
15+
"**/*.test.jsx",
16+
"**/*.test.mjs",
17+
"**/*.spec.mjs",
18+
"**/vite*.config.ts",
19+
"**/vitest.setup.ts",
20+
"**/playwright.config.ts",
21+
"**/_polyfills/**",
22+
"tools/**"
23+
],
24+
"rules": {
25+
"header/header": [
26+
"warn",
27+
"block",
28+
[
29+
{
30+
"pattern": "[\\s\\S]*Copyright[\\s\\S]*Ping Identity[\\s\\S]*",
31+
"template": "\n * Copyright (c) <current_year> Ping Identity Corporation. All rights reserved.\n * This software may be modified and distributed under the terms\n * of the MIT license. See the LICENSE file for details.\n "
32+
}
33+
]
34+
]
35+
}
36+
},
537
{
638
"files": ["*.ts", "*.tsx", "*.js", "*.jsx"],
739
"rules": {

.husky/pre-commit

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
#!/bin/sh
22
. "$(dirname "$0")/_/husky.sh"
33

4-
npx lint-staged && npx nx affected:lint && npx nx affected:build
4+
node tools/copyright/sync-header-years.mjs && npx lint-staged && npx nx affected:lint && npx nx affected:build

e2e/autoscript-apps/src/index.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,11 @@
1+
/*
2+
* @forgerock/javascript-sdk
3+
*
4+
* index.ts
5+
*
6+
* Copyright (c) 2021 - 2026 Ping Identity Corporation. All rights reserved.
7+
* This software may be modified and distributed under the terms
8+
* of the MIT license. See the LICENSE file for details.
9+
*/
110
import 'core-js/stable';
211
import 'regenerator-runtime';

e2e/autoscript-suites/config.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2021 - 2026 Ping Identity Corporation. All rights reserved.
3+
* This software may be modified and distributed under the terms
4+
* of the MIT license. See the LICENSE file for details.
5+
*/
16
import { workspaceRoot } from '@nx/devkit';
27
import { PlaywrightTestConfig } from '@playwright/test';
38
import { baseConfig } from './playwright.config';
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2021 - 2026 Ping Identity Corporation. All rights reserved.
3+
* This software may be modified and distributed under the terms
4+
* of the MIT license. See the LICENSE file for details.
5+
*/
16
export const environment = {
27
production: true,
38
};

e2e/mock-api/src/environments/environment.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2021 - 2026 Ping Identity Corporation. All rights reserved.
3+
* This software may be modified and distributed under the terms
4+
* of the MIT license. See the LICENSE file for details.
5+
*/
16
export const environment = {
27
AM_URL: 'https://openam-crbrl-01.forgeblocks.com/am/',
38
REALM_PATH: 'alpha',

e2e/token-vault-suites/teardown.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
/*
2+
* Copyright (c) 2021 - 2026 Ping Identity Corporation. All rights reserved.
3+
* This software may be modified and distributed under the terms
4+
* of the MIT license. See the LICENSE file for details.
5+
*/
16
export default () => {
27
console.log('tests finished');
38
};

package.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@
1313
"ci:version": "changeset version && pnpm install --no-frozen-lockfile && pnpm nx format:write --uncommitted",
1414
"changeset": "changeset",
1515
"commit": "git cz",
16+
"copyright:check": "node ./tools/copyright/sync-header-years.mjs --check",
17+
"copyright:sync": "node ./tools/copyright/sync-header-years.mjs",
1618
"docs": "nx affected --target=typedoc",
1719
"e2e": "CI=true nx affected:e2e",
1820
"format:staged": "pretty-quick --staged",
@@ -83,6 +85,7 @@
8385
"esbuild": "^0.19.2",
8486
"eslint": "8.57.0",
8587
"eslint-config-prettier": "9.1.0",
88+
"eslint-plugin-header": "^3.1.1",
8689
"eslint-plugin-import": "2.27.5",
8790
"eslint-plugin-playwright": "^1.5.1",
8891
"eslint-plugin-prettier": "^5.1.3",

packages/javascript-sdk/src/device-client/mock-data/msw-mock-data.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
/*
2+
* @forgerock/javascript-sdk
3+
*
4+
* msw-mock-data.ts
5+
*
6+
* Copyright (c) 2025 - 2026 Ping Identity Corporation. All rights reserved.
7+
* This software may be modified and distributed under the terms
8+
* of the MIT license. See the LICENSE file for details.
9+
*/
110
import { GeneralResponse } from '../services/index.js';
211
import type {
312
OathResponse,

packages/javascript-sdk/src/fr-recovery-codes/script-text.mock.data.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
/* eslint-disable no-useless-escape */
21
/*
32
* @forgerock/javascript-sdk
43
*
54
* script-text.mock.data.ts
65
*
7-
* Copyright (c) 2020 - 2025 Ping Identity Corporation. All rights reserved.
6+
* Copyright (c) 2020 - 2026 Ping Identity Corporation. All rights reserved.
87
* This software may be modified and distributed under the terms
98
* of the MIT license. See the LICENSE file for details.
109
*/
10+
/* eslint-disable no-useless-escape */
1111

1212
import type { CallbackType } from '../auth/enums';
1313

0 commit comments

Comments
 (0)