hmarr / codeowners

🔒 Command line tool and Go library for CODEOWNERS files
MIT License
167 stars 19 forks source link

Support for sections (Gitlab flavor) #13

Open neiser opened 1 year ago

neiser commented 1 year ago

The Gitlab documentation allows to introduce sections into the CODEOWNERS such as

[README Owners]
README.md @user1 @user2
internal/README.md @user2

That enables Gitlab to show the code ownership within the UI a little bit nicer. Currently, running this tool (version 1.1.1) on such a file leads to the following error:

$ codeowners
line 1: unexpected character '[' at position 1

Would you be willing to allow support for this? Would you accept a PR for that (I haven't looked into the code yet though)

hmarr commented 1 year ago

I'd be open to this, but as long as it's only enabled by passing in a flag (or by detecting the CODEOWNERS file in the .gitlab directory, perhaps). As this package is designed primarily to work with GitHub CODEOWNERS files, I'd rather it defaults to erroring loudly when it encounters invalid syntax.

oonoo commented 1 year ago

Just mentioning: came here for the same reason as the author of this issue. I would be also interested in a gitlab compatible solution (supporting/ignoring these sections).