Feature Request (insert_license): Use multiline comment for python files
matroscoe opened this issue · 2 comments
For python files if I have a larger license text it would be nice if I could encapsulate it inside a multi-line comment so that it looks like
"""
<license-text>
"""
instead of
# <license text>
# <license text continued...>
Hi @matroscoe
Should, this feature could be added.
Would you like to submit a PR?
I think that a new --comment-style
argument flag would have to be added,
so that one could set --comment-style=docstring
.
You can get very close using '--comment-style="""||"""'
in your pre-commit configuration, i.e. three double quotes for comment start, nothing for comment continuation, and three double quotes for comment end. It would give you:
"""
<license text>
<license text continued...>
"""
Note the unwanted single leading space, a side effect of the current default comment marker of "#" being treated implicitly as "# " when appending the license. See also #79.
It may be that you can automatically get rid of those leading spaces by running something like ruff format
afterwards, giving a usable work-around?