Skip to content

Commit b1ca077

Browse files
author
DavidQ
committed
Exclude node_modules from duplicate method PowerShell scanner output - PR_26140_031-dupe-scanner-node-modules-exclusion
1 parent ef677f3 commit b1ca077

3 files changed

Lines changed: 53 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# PR_26140_031 Dupe Scanner Node Modules Exclusion Report
2+
3+
## Scope
4+
5+
- Added the requested duplicate scanner entry point at `tools/shared/powerShell/find_dupes_called.ps1`.
6+
- Kept duplicate detection patterns and output formatting unchanged.
7+
- Added the requested recursive scan filter:
8+
- `$_.FullName -notmatch '\\node_modules\\'`
9+
10+
## Validation
11+
12+
- PASS `.\tools\shared\powerShell\find_dupes_called.ps1 | Set-Content -Path tmp\dupes_called.txt -Encoding utf8`
13+
- PASS `Select-String -Path tmp\dupes_called.txt -Pattern "node_modules" -SimpleMatch`
14+
- No matches returned.
15+
- PASS repo-owned duplicate results still appear in `tmp/dupes_called.txt`, including `src`, `games`, and `tools/shared` paths.
16+
17+
## Notes
18+
19+
- The existing tracked scanner under `scripts/PS/find-duplicate-methods/dupes_called.ps1` already had the same node_modules exclusion in the latest committed delta.
20+
- The pre-existing root `dupes_called.txt` working tree change was not modified for this PR and is intentionally excluded from the PR delta/review artifacts.
21+
- Playwright impacted: No. This PR only adds a PowerShell scanner entry point and validates its text output.
22+
- Full samples smoke test skipped; this PR does not affect runtime samples.

dupes_called.txt

117 KB
Binary file not shown.
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# 1. Get all .js files recursively
2+
# 2. Look for function patterns
3+
# 3. Group them by the text found
4+
# 4. Filter for groups with more than 1 occurrence
5+
6+
# .\find_dupes_called.ps1 > found_dupes_called.txt
7+
# .\find_dupes_called.ps1 | Out-File -FilePath "found_dupes_called.txt" -Encoding utf8
8+
9+
# Goes up 3 levels to reach HTML-JavaScript-Gaming from tools\shared\powerShell\
10+
# Get the root path (3 levels up)
11+
$rootPath = Resolve-Path "$PSScriptRoot\..\..\..\"
12+
13+
Get-ChildItem -Path $rootPath -Recurse -Filter *.js -File |
14+
Where-Object {
15+
$_.FullName -notmatch '\\node_modules\\'
16+
} |
17+
Select-String `
18+
-Pattern "function\s+[a-zA-Z0-9_]*\(", "[a-zA-Z0-9_]*\s*=\s*function", "[a-zA-Z0-9_]*:\s*function" |
19+
Group-Object Line |
20+
Where-Object { $_.Count -gt 1 } |
21+
ForEach-Object {
22+
"($($_.Count)) Duplicate line: $($_.Name.Trim())"
23+
24+
$_.Group | ForEach-Object {
25+
# Replace the absolute root path with a single backslash
26+
$relativePath = $_.Path -replace [regex]::Escape($rootPath), ""
27+
" -> Line $($_.LineNumber): \$relativePath"
28+
}
29+
30+
""
31+
}

0 commit comments

Comments
 (0)