mathieucarbou / license-maven-plugin

Manage license headers in your source files
https://mathieu.carbou.me/license-maven-plugin/
Apache License 2.0
244 stars 86 forks source link

Blank line after/before license #78

Open rnc opened 9 years ago

rnc commented 9 years ago

It would be nice to have an option to add a blank line before the license block or / and after the license block.

mmoayyed commented 9 years ago

Yes, and please make this optional.

For example, I would want something like this on a JSP file:

<%--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you 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 the following location:

      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.

--%><%= "xyz" %>

Rather than:

<%--

    Licensed to Apereo under one or more contributor license
    agreements. See the NOTICE file distributed with this work
    for additional information regarding copyright ownership.
    Apereo licenses this file to you 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 the following location:

      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.

--%>
<%= "xyz" %>
mirabilos commented 8 years ago

Additionally, it would be nice to say: one blank line, but none above if the licence block is the first thing in the file, and never more than one blank line (i.e. don’t add one if one exists, or even collapse them all into one empty line).

stale[bot] commented 3 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 3 years ago

@bot see https://github.com/mathieucarbou/license-maven-plugin/issues/78#issuecomment-240091273

mathieucarbou commented 2 years ago

@rnc @mmoayyed @mirabilos : Stable Bot automatically mark and closes stale issues. If nobody resurrects or open a PR for that issue, it will just be closed. I understand the feature (nice to have IMO), but as an OSS projects and not having any bandwidth for such nice to have thing, people in need also are welcomed to contribute. Thanks :-)

mmoayyed commented 2 years ago

@mathieucarbou I perfectly understand. From my perspective, you're welcome to close this issue. We are no longer using this particular feature or plugin, and have moved on for about 6 years.

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 2 years ago

stale[bot] dixit:

Is this still relevant? If so, what is blocking it? Is there anything

Probably, but I’m not using the plugin anywhere right now (working on C projects), so I don’t know for sure.

bye, //mirabilos -- Infrastrukturexperte • tarent solutions GmbH Am Dickobskreuz 10, D-53121 Bonn • http://www.tarent.de/ Telephon +49 228 54881-393 • Fax: +49 228 54881-235 HRB AG Bonn 5168 • USt-ID (VAT): DE122264941 Geschäftsführer: Dr. Stefan Barth, Kai Ebenrett, Boris Esser, Alexander Steeg

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 2 years ago

stale[bot] dixit:

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

🤡

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 2 years ago

Yay for bots…

stale[bot] commented 2 years ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 2 years ago

bot, ey…

stale[bot] commented 1 year ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 1 year ago

stale[bot] dixit:

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

yes, as always

stale[bot] commented 1 year ago

Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

mirabilos commented 1 year ago

stale[bot] dixit:

Is this still relevant? If so, what is blocking it? Is there anything

[…] sigh…

see also: @.***/109712205752112196

bye, //mirabilos -- Yes, I hate users and I want them to suffer. -- Marco d'Itri on gmane.linux.debian.devel.general

trallnag commented 1 year ago

@mirabilos, I admire your persistence 😆

mirabilos commented 1 year ago

Tim Schwenke dixit:

@mirabilos, I admire your persistence 😆

I hate the “stalebot” concept on principle (there recently was a good article about that on Fediverse, too).

bye, //mirabilos -- "Using Lynx is like wearing a really good pair of shades: cuts out the glare and harmful UV (ultra-vanity), and you feel so-o-o COOL." -- Henry Nelson, March 1999

dbwiddis commented 1 year ago

I hate the “stalebot” concept on principle (there recently was a good article about that on Fediverse, too).

Two sides to that.

First, I have this thread bookmarked as an example of what not to do with a stale bot. :-) If a repo is not really actively maintained, the bot is noise.

Second, on the opposite end, if a repo is actively maintained, there are often bug report/issues where the maintainer asks a question and it just sits there... forever. And having a bot close these old, useless issues is sometimes helpful.

Third, this is open source. Maintainers aren't paid for their work, and often end up with competing priorities on their time. This is part of the design of open source. If an issue is important to you, feel free to contribute a fix for it!

mathieucarbou commented 1 year ago

The project is actively maintained but new features are not actively added for the reasons mentioned above.

And I am baffled to see how many people would find something useful, but none is courageous enough to send a complete PR.

As such, the bot serves the right purpose here: if a feature is asked by 2-3 people but no one implement it, then it is not an important feature, or these people can work around it. Otherwise, if this is really a no-brainer feature, it would have been implemented because it would have bothered more people.

In the case of this issue, I think only a few people find this interesting, and amongst them, none dares contribute. That's why it is really low priority.

mirabilos commented 1 year ago

Daniel Widdis dixit:

Second, on the opposite end, if a repo is actively maintained, there are often bug report/issues where the maintainer asks a question and it just sits there... forever. And having a bot close these old, useless issues is sometimes helpful.

Perhaps, but I’d rather a maintainer do that, not a bot, as they can see when a moreinfo thing lacks responses.

Third, this is open source. Maintainers aren't paid for their work

Of course this argument comes. Do you know how much Open Source I maintain? sigh… and almost all of it in whatever spare time I can manage.

bye, //mirabilos --

you introduced a merge commit │ % g rebase -i HEAD^^ sorry, no idea and rebasing just fscked │ Segmentation should have cloned into a clean repo │ fault (core dumped) if I rebase that now, it's really ugh │ wuahhhhhh
mirabilos commented 1 year ago

Mathieu Carbou dixit:

And I am baffled to see how many people would find something useful, but none is courageous enough to send a complete PR.

Can you imagine people being experienced programmers but in completely different areas and not having the headspace to begin to learn developing a Maven plugin in Java (especially when they’re not experienced in the latter)?

Give me an i386 bootloader problem in assembly rather… and most of the things I do nowadays are in Korn Shell or C.

bye, //mirabilos -- „Cool, /usr/share/doc/mksh/examples/uhr.gz ist ja ein Grund, mksh auf jedem System zu installieren.“ -- XTaran auf der OpenRheinRuhr, ganz begeistert (EN: “[…]uhr.gz is a reason to install mksh on every system.”)

mathieucarbou commented 1 year ago

Can you imagine people being experienced programmers but in completely different areas and not having the headspace to begin to learn developing a Maven plugin in Java (especially when they’re not experienced in the latter)?

Totally :-) But my point still remains true ;-)

This is an OSS project. Either use it the way it works, or contribute to make it better, or do not use it at all. But don't expect maintainers or contributors to work on your needs.

uyw4687 commented 1 year ago

We are no longer using this particular feature or plugin, and have moved on for about 6 years.

@mmoayyed Hello, which one do you use instead?

mmoayyed commented 1 year ago

Not using maven anymore.

uyw4687 commented 1 year ago

@mmoayyed Thanks. I was wondering how to resolve this issue while using license-gradle-plugin whose core logic is this plugin.

Do you use gradle? If so, it would be great to know which one you're using to avoid this issue :)

iansergeant commented 10 months ago

I think that I have worked around this, at least for my needs with Java. I have added a header definitions line:

<headerDefinitions>C:/<mydirectory>/headerDefs.xml</headerDefinitions>

I then overrode the SLASHSTAR_STYLE as follows in the header definitions file:

<additionalHeaders>
  <slashstar_style>
    <firstLine>/*</firstLine>
    <beforeEachLine>  </beforeEachLine>
    <endLine>*/EOL </endLine>
    <afterEachLine> </afterEachLine>
    <!--skipLine></skipLine-->
    <firstLineDetectionPattern>(\s|\t)*/\*.*$</firstLineDetectionPattern>
    <lastLineDetectionPattern>.*\*/(\s|\t)*$</lastLineDetectionPattern>
    <allowBlankLines>true</allowBlankLines>
    <multiLine>true</multiLine>
    <padLines>false</padLines>
  </slashstar_style>
</additionalHeaders>

The key point here is the addition of EOL to <endLine> to skip a line at the end of the header. I suspect that if you really want to have a blank line at the top, the same workaround would apply to <firstLine>.

mirabilos commented 10 months ago

@iansergeant I have applied that…

tglase@tglase:~/Projekte/mvnparent $ cat src/main/ancillary/myc-javapkg.xml                                     
<?xml version="1.0" encoding="UTF-8"?>
<additionalHeaders>
        <JavaPackage_style>
                <firstLine><![CDATA[EOL/*-]]></firstLine>
                <beforeEachLine><![CDATA[ * ]]></beforeEachLine>
                <endLine><![CDATA[ */EOL]]></endLine>
                <skipLine><![CDATA[^package [a-z]+(\.[a-z][a-z0-9]*)*;$]]></skipLine>
                <firstLineDetectionPattern><![CDATA[(EOL)*(\s|\t)*/\*.*$]]></firstLineDetectionPattern>
                <lastLineDetectionPattern><![CDATA[.*\*/(\s|\t)*(EOL)*]]></lastLineDetectionPattern>
                <allowBlankLines>false</allowBlankLines>
                <isMultiline>true</isMultiline>
                <padLines>false</padLines>
        </JavaPackage_style>
</additionalHeaders>

… but it sometimes leads to an extra blank line when updating the licence headers.