-
Notifications
You must be signed in to change notification settings - Fork 188
Add a separator after the license header if the template has no bottom #186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
tmpl.go
Outdated
} else if lines > 3 { | ||
fmt.Fprintln(&out, mid + strings.Repeat("=", 80 - len(mid))) | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The separator is added only when the license block has more than 3 lines.
789b82e
to
9d0b267
Compare
Thanks for your interest in addlicense. The tool already adds a blank line between the end of the license header comment and the first line of the file's existing content. Is there a reason this blank line is insufficient visual separation? Adding this separator line automatically may be rather disruptive: while many projects use such a line, lots of others don't. In particular, projects which have already been using |
Hi @flwyd, thanks for the valuable comments.
For the header that has multiple paragraphs (e.g., Apache License), the paragraphs are separated with a black line, which is the same separator as the following user code. That is hard to distinguish the start of the true user code. # Copyright XXX. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# User code: This file is used to ...
# User code: This file is used to ...
# User code: This file is used to ... This PR only adds a visual separation line to the header if it has more than three lines. Another use case is that the file has multiple license headers to respect the copyright of the original authors (e.g., more than one Apache License with different affiliations). # Copyright XXX. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# This file is adopted from: https://github.com/YYY/ZZZ.git
# ==============================================================================
# Copyright YYY. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# ==============================================================================
# User code: This file is used to ...
# User code: This file is used to ...
# User code: This file is used to ... |
470de8b
to
fe79e8d
Compare
fe79e8d
to
0f07dd6
Compare
Add a nice separator after the license header if the template has no bottom.
This separates the license and the code comments with
=
s.