MCPcopy Create free account
hub / github.com/AnukarOP/claude-code-leaked / isGeneratedFile

Function isGeneratedFile

source code/utils/generatedFiles.ts:87–128  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

85 * @returns true if the file should be excluded from attribution
86 */
87export function isGeneratedFile(filePath: string): boolean {
88 // Normalize path separators for consistent pattern matching (patterns use posix-style /)
89 const normalizedPath =
90 posix.sep + filePath.split(sep).join(posix.sep).replace(/^\/+/, '')
91 const fileName = basename(filePath).toLowerCase()
92 const ext = extname(filePath).toLowerCase()
93
94 // Check exact filename matches
95 if (EXCLUDED_FILENAMES.has(fileName)) {
96 return true
97 }
98
99 // Check extension matches
100 if (EXCLUDED_EXTENSIONS.has(ext)) {
101 return true
102 }
103
104 // Check for compound extensions like .min.js
105 const parts = fileName.split('.')
106 if (parts.length > 2) {
107 const compoundExt = '.' + parts.slice(-2).join('.')
108 if (EXCLUDED_EXTENSIONS.has(compoundExt)) {
109 return true
110 }
111 }
112
113 // Check directory patterns
114 for (const dir of EXCLUDED_DIRECTORIES) {
115 if (normalizedPath.includes(dir)) {
116 return true
117 }
118 }
119
120 // Check filename patterns
121 for (const pattern of EXCLUDED_FILENAME_PATTERNS) {
122 if (pattern.test(fileName)) {
123 return true
124 }
125 }
126
127 return false
128}
129
130/**
131 * Filter a list of files to exclude generated files.

Callers 2

filterGeneratedFilesFunction · 0.85

Calls 1

hasMethod · 0.45

Tested by

no test coverage detected