MCPcopy Create free account
hub / github.com/anus-dev/ANUS / loadIgnoreRules

Function loadIgnoreRules

packages/core/src/utils/filesearch/ignore.ts:22–51  ·  view source on GitHub ↗
(options: LoadIgnoreRulesOptions)

Source from the content-addressed store, hash-verified

20}
21
22export function loadIgnoreRules(options: LoadIgnoreRulesOptions): Ignore {
23 const ignorer = new Ignore();
24 if (options.useGitignore) {
25 const gitignorePath = path.join(options.projectRoot, '.gitignore');
26 if (fs.existsSync(gitignorePath)) {
27 ignorer.add(fs.readFileSync(gitignorePath, 'utf8'));
28 }
29 }
30
31 if (options.useAnusignore) {
32 // Check for .anusignore
33 const anusignorePath = path.join(options.projectRoot, '.anusignore');
34
35 if (fs.existsSync(anusignorePath)) {
36 ignorer.add(fs.readFileSync(anusignorePath, 'utf8'));
37 }
38 }
39
40 const ignoreDirs = ['.git', ...options.ignoreDirs];
41 ignorer.add(
42 ignoreDirs.map((dir) => {
43 if (dir.endsWith('/')) {
44 return dir;
45 }
46 return `${dir}/`;
47 }),
48 );
49
50 return ignorer;
51}
52
53export class Ignore {
54 private readonly allPatterns: string[] = [];

Callers 6

crawler.test.tsFile · 0.85
getIgnoreFunction · 0.85
getCrawlResultsFunction · 0.85
ignore.test.tsFile · 0.85
initializeMethod · 0.85
initializeMethod · 0.85

Calls 1

addMethod · 0.95

Tested by 2

getIgnoreFunction · 0.68
getCrawlResultsFunction · 0.68