ast-grep: [bug] Unable to make ast-grep scan work with ignored rules in VCS

Please read the FAQ for the bug you encountered.

  • I have read the existing FAQ

⏯ Playground Link

N/A

πŸ’» Code

// Your code here

πŸ™ Actual behavior

I have a use case where I want to generate some rules outside of VCS (the point being that we want to enforce some import restrictions, with certain file paths excluded according to our own guidelines).

I don’t want to check in tons of generated files in git, but if I exclude the rules in git, they’re no longer picked up by ast-grep scan.

πŸ™‚ Expected behavior

ast-grep scan should not take .gitignore contents into account when discovering rules (only when deciding on which files to run those rules against).

Additional information about the issue

No response

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

@HerringtonDarkholme I tried --no-ignore=vcs but this still doesn’t pick up the rules. It seems this only applies to discovery for the files the rules are running against and not the rules that are being discovered by ast-grep scan.