MCPcopy Create free account
hub / github.com/colbymchenry/codegraph / excludeBuildOutputUnderSrc

Function excludeBuildOutputUnderSrc

src/extraction/index.ts:415–429  ·  view source on GitHub ↗

* `ig` with buildOutputFolderUnderSrc applied on top of its patterns, * for every caller of the defaults alike. `projectRules` are the project's own * root ignore rules: a file they re-include by name, or whose folder they * re-include from the `build` folder down (`!src/build/`, the docu

(ig: Ignore, projectRules: Ignore | null)

Source from the content-addressed store, hash-verified

413 * opt-in), keeps every type, as it did before this rule.
414 */
415function excludeBuildOutputUnderSrc(ig: Ignore, projectRules: Ignore | null): Ignore {
416 const ignoredByPatterns = ig.ignores.bind(ig);
417 ig.ignores = (rel: string): boolean => {
418 if (ignoredByPatterns(rel)) return true;
419 const folder = buildOutputFolderUnderSrc(rel);
420 if (folder === null) return false;
421 if (!projectRules) return true;
422 // The file, then each folder above it up to the `build` folder.
423 for (let end = rel.length; end >= folder.length; end = rel.lastIndexOf('/', end - 2) + 1) {
424 if (projectRules.test(rel.slice(0, end)).unignored) return false;
425 }
426 return true;
427 };
428 return ig;
429}
430
431/** True if `buf` decodes as strict UTF-8 (no invalid byte sequences). */
432function isValidUtf8(buf: Buffer): boolean {

Callers 2

buildDefaultIgnoreFunction · 0.85
defaultsOnlyIgnoreFunction · 0.85

Calls 2

bindMethod · 0.80

Tested by

no test coverage detected