Open anderseknert opened 1 year ago
https://pkg.go.dev/github.com/sabhiram/go-gitignore#example-CompileIgnoreLines looks like a solid little module for this.
While I'm sure it's nowhere near feature complete, @kristiansvalland wrote a simple implementation in Rego way back that we've been using for the ignore
patterns users can set in .regal/config.yaml
😃
https://github.com/StyraInc/regal/blob/main/bundle/regal/config/exclusion.rego#L25
It would likely cover our needs, and if not, we should extend it to do that. We'd still need to read the file in Go an provide it as input, of course. And some things I'm not sure about, like if we should handle nested .gitignore files.
I think defaulting to respecting gitignore files anywhere would be a good call. Like, in mono repos, I'd imagine them to be common, and I personally like to use them on a nested way, too...
Yeah, me too. Although if we support that, we should also support nested Regal configurations, which we also don't do 😅
Some configuration options to the
ignore
attribute that would be nice additions:We currently hard code
.git
and.idea
as we never will want to parse whatever is in there, but exposing these options in config, and using the.gitignore
file, would be a better approach.Thanks @srenatus for the idea.