yoheimuta/protolint

Exclude directories via pattern

Kresshy opened this issue · 4 comments

Is it possible to exclude directories from the linter via a pattern? Something like a glob: **/build which would match every build directory from the root to other sub directories.

lint:
  rules:
    all_default: true

  directories:
    exclude:
      - **/build

@Kresshy Sorry for the late response. At the moment, this feature is not supported.
I acknowledge that this feature could be worthwhile.

+1 for this feature, would be very useful to exclude linting on proto files imported from external repositories that we don't have/want control over.

@yoheimuta Thanks for this nice utility. I am interested in contributing this feature.

Do you prefer pattern matching via glob as suggested in this issue, or regex? In my opinion globs are nicer to work with, but the standard library implementation in filepath doesn't support the ** pattern which many users will expect to be supported. There are third-party libraries such as https://github.com/bmatcuk/doublestar that could be used instead.

For backwards-compatibility reasons I think we'd have to introduce a new field (exclude_pattern ?) for both directories and files.

@stevenschaerer Thanks for the suggestion!
I can see the appeal of globs for some users, so adding support for them seems like a great idea.

I also like the idea of introducing a new field.