mbarkhau / bumpver

BumpVer: Automatic Versioning
https://github.com/mbarkhau/bumpver
MIT License
199 stars 36 forks source link

Recursive file_pattern #173

Open bdepardo opened 2 years ago

bdepardo commented 2 years ago

Hi,

Would it be possible to specify recursive file patterns to search for all *.py files in a project. I tried with

"**/*.py" = [
  "# Copyright (c) 2017-YYYY"
]

But it does not find python files. I saw in bumpver code that you are using glob, but that the recursive parameter is unset (and thus False).

Thanks

mbarkhau commented 2 years ago

The one thing I see here is a usability issue. The current approach is to fail, if a file does not contain the configured version pattern. I think if you match 100 files, then perhaps the pattern is only applicable to a subset of the files. I usually don't put copyright headers on my test files for example. Other than that concern, I think it can be implemented in principle.

bdepardo commented 2 years ago

I agree that not all files might need to include the copyright. With globs it will not be possible to specify a pattern that could exclude some directories, we would need more advanced regexp for that. Though having a recursive glob pattern would be an improvement I think. For example our project currently has ~200 different directories (django-based project), so in our case having to write and maintain the pattern for all these directories would be much more complicated that just adding the copyright in our test files.