chore(copyright): add sync-header-years script and tests#639
chore(copyright): add sync-header-years script and tests#639SteinGabriel wants to merge 1 commit into
Conversation
|
|
Warning Review limit reached
More reviews will be available in 55 minutes and 53 seconds. Learn how PR review limits work. Your organization has run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After more reviews become available, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available. Please see our Fair Usage Limits Policy for further information. ℹ️ Review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: ⛔ Files ignored due to path filters (1)
📒 Files selected for processing (5)
📝 WalkthroughWalkthroughThis PR establishes copyright header enforcement infrastructure across the repository and updates a public API method name. It introduces an ESLint rule and CLI tool to validate and synchronize Ping copyright headers with current years, integrated into the pre-commit workflow. Additionally, the davinci client API rename updates ChangesCopyright Header Enforcement
API Method Rename
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
chore(copyright): wire sync script into lefthook and add package scripts feat(eslint): add inline ping-copyright rule to eslint.config.mjs
30dc079 to
27deab1
Compare
|
View your CI Pipeline Execution ↗ for commit 27deab1
☁️ Nx Cloud last updated this comment at |
@forgerock/davinci-client
@forgerock/device-client
@forgerock/journey-client
@forgerock/oidc-client
@forgerock/protect
@forgerock/sdk-types
@forgerock/sdk-utilities
@forgerock/iframe-manager
@forgerock/sdk-logger
@forgerock/sdk-oidc
@forgerock/sdk-request-middleware
@forgerock/storage
commit: |
Codecov Report✅ All modified and coverable lines are covered by tests. ❌ Your project status has failed because the head coverage (18.21%) is below the target coverage (40.00%). You can increase the head coverage or adjust the target coverage. Additional details and impacted files@@ Coverage Diff @@
## main #639 +/- ##
==========================================
+ Coverage 18.07% 18.21% +0.13%
==========================================
Files 155 155
Lines 24398 24440 +42
Branches 1203 1212 +9
==========================================
+ Hits 4410 4451 +41
- Misses 19988 19989 +1 🚀 New features to boost your workflow:
|
|
Deployed 1dae5e5 to https://ForgeRock.github.io/ping-javascript-sdk/pr-639/1dae5e56cd51cf44c052be827f2cfe83199b76a5 branch gh-pages in ForgeRock/ping-javascript-sdk |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@tools/copyright/sync-header-years.mjs`:
- Around line 171-178: The hasPingCopyrightHeader function currently scans every
line for MAYBE_PING_COPYRIGHT_LINE_REGEX within any comment line, which lets
matches inside the file pass check mode; change it to only inspect the file's
leading header block (the initial contiguous comment/blank lines) — iterate
lines from the top, stop scanning when you hit the first line that does not
match HEADER_COMMENT_LINE_REGEX or a blank line policy that ends the header, and
only test those header lines with MAYBE_PING_COPYRIGHT_LINE_REGEX; update
hasPingCopyrightHeader to return false if no match is found in that leading
header block.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: ad8dd158-9829-45ce-b608-4863322b7f53
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
eslint.config.mjslefthook.ymlpackage.jsonpackages/davinci-client/api-report/davinci-client.api.mdpackages/davinci-client/api-report/davinci-client.types.api.mdtools/copyright/sync-header-years.mjstools/copyright/sync-header-years.test.mjs
📦 Bundle Size Analysis📦 Bundle Size Analysis🚨 Significant Changes🔻 @forgerock/device-client - 0.0 KB (-10.0 KB, -100.0%) ➖ No Changes➖ @forgerock/storage - 1.5 KB 14 packages analyzed • Baseline from latest Legend🆕 New package ℹ️ How bundle sizes are calculated
🔄 Updated automatically on each push to this PR |
JIRA Ticket
N/A
Description
Adds automated Ping Identity copyright year management to the ping-javascript-sdk repo. A
pre-commit script rewrites stale headers in staged files and re-stages them; an ESLint rule
surfaces missing headers in-editor during lint runs.
Changes
tools/copyright/sync-header-years.mjs— new script; rewrites stale Ping-owned copyright headers instaged files (single-year → range, stale range end → current year); fails commit if a Ping
header has no valid year; runs in
--fixor--checkmodesync-header-years.test.mjs— 23 unit tests covering range updates, single-yearexpansion, idempotency, variant matching (
©,©,(c)), and exclusion ofnon-Ping/test/tooling files
eslint.config.mjslocal-rules/ping-copyrightrule (warn severity) that checks the first blockcomment of every
.ts/.tsx/.js/.jsx/.mjs/.cjssource file for aCopyright … Ping Identityheadereslint-plugin-headerincompatible with ESLint 9 flat config;eslint-plugin-headerslacks regex variable support needed for year-range patternslefthook.ymlcopyright-syncpre-commit command (node tools/copyright/sync-header-years.mjs --fix,stage_fixed: true) betweennx-syncandnx-checkpackage.jsoncopyright:syncandcopyright:checkscripts for manual runsTests
tools/copyright/sync-header-years.test.mjs— all passpatterns
How to test
1. Manual pre-commit trigger
Stage any file with a stale Ping copyright year and run
git commit. Thecopyright-synchook should rewrite and re-stage the header automatically.
2. Scripts
pnpm copyright:check # reports stale headers
pnpm copyright:sync # rewrites stale headers in place
3. ESLint
pnpm lint
Files missing a Ping Identity copyright header emit a
local-rules/ping-copyrightwarning.Summary by CodeRabbit
New Features
API Changes
Tests