You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Feature Request (insert_license): Use multiline comment for python files #87
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?
Activity
Lucas-C commentedon Jan 26, 2024
Hi @matroscoe
Sure, this feature could be added.
Would you like to submit a PR?
I think that a new
--comment-styleargument flag would have to be added,so that one could set
--comment-style=docstring.peterjc commentedon Sep 2, 2024
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: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 formatafterwards, giving a usable work-around?