groovy

update license text in file headers

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Minor Minor
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: 1.7.2, 1.8-beta-1
  • Component/s: None
  • Labels:
    None
  • Environment:
    all
  • Number of attachments :
    0

Description

During a review of Groovy package [1] into Fedora Package collection, a
reviewer complained that the distribution does not contain full text of
the license and some files do not have comments which would determine
the licensing conditions.

[1] https://bugzilla.redhat.com/show_bug.cgi?id=534168#c8

To avoid confusion it's usually a good practice to include a file with
license text and add a header that would say where to find the license
text. I'm wondering if it would be possible for you to do that for the
next release?

Thank you in advance,
Lubo

Activity

Hide
blackdrag blackdrag added a comment -

we have a LICENSE.txt file containing

/*
 * 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.
 *
 */

But I think this is supposed to be used only as header in files, not for the LICENSE.txt

Show
blackdrag blackdrag added a comment - we have a LICENSE.txt file containing
/*
 * 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.
 *
 */
But I think this is supposed to be used only as header in files, not for the LICENSE.txt
Hide
Paul King added a comment -

Removed "include full text of license in distribution" from title as re-reading the apache instructions seems to allow the reference as we have it and the redhat packaging guidelines seem to concur as per my reading of link given bugzilla (in issue description).

To comply with the other requirement, it would seem easiest to turn on header checking within checkstyle.

Show
Paul King added a comment - Removed "include full text of license in distribution" from title as re-reading the apache instructions seems to allow the reference as we have it and the redhat packaging guidelines seem to concur as per my reading of link given bugzilla (in issue description). To comply with the other requirement, it would seem easiest to turn on header checking within checkstyle.
Hide
Paul King added a comment -

Header check added to checkstyle and all violating files have been amended. Not fully done for test files at present but I am assuming that isn't crucial for this issue.

Show
Paul King added a comment - Header check added to checkstyle and all violating files have been amended. Not fully done for test files at present but I am assuming that isn't crucial for this issue.
Hide
Paul King added a comment -

Just realised that the check was only done for Java source files. Will look into Groovy ones too.

Show
Paul King added a comment - Just realised that the check was only done for Java source files. Will look into Groovy ones too.
Hide
Paul King added a comment - - edited

For the moment, using the following Groovy script to detect missing headers (uses the checkstyle header file):

import static groovy.io.FileType.*
import static groovy.io.FileVisitResult.*
def headerLines = new File(/$basedir\config\checkstyle\codeHeader.txt/).readLines()
def sourcebase = new File(/$basedir\src\main/)
sourcebase.traverse(
    type       : FILES,
    nameFilter : ~/.*\.groovy/,
    preDir     : { if (it.name == '.svn') return SKIP_SUBTREE }
) { f ->
    def lines = f.readLines()
    if (lines.size() < headerLines.size()) println "$f.name rejected: insufficient size"
    for (int i in 0..<headerLines.size()) {
        if (!(lines[i] ==~ headerLines[i])) {
            println "Mismatch at line ${i+1} of $f.canonicalPath\n  expect:${headerLines[i]}\n  actual:${lines[i]}"
            return
        }
    }
}
Show
Paul King added a comment - - edited For the moment, using the following Groovy script to detect missing headers (uses the checkstyle header file):
import static groovy.io.FileType.*
import static groovy.io.FileVisitResult.*
def headerLines = new File(/$basedir\config\checkstyle\codeHeader.txt/).readLines()
def sourcebase = new File(/$basedir\src\main/)
sourcebase.traverse(
    type       : FILES,
    nameFilter : ~/.*\.groovy/,
    preDir     : { if (it.name == '.svn') return SKIP_SUBTREE }
) { f ->
    def lines = f.readLines()
    if (lines.size() < headerLines.size()) println "$f.name rejected: insufficient size"
    for (int i in 0..<headerLines.size()) {
        if (!(lines[i] ==~ headerLines[i])) {
            println "Mismatch at line ${i+1} of $f.canonicalPath\n  expect:${headerLines[i]}\n  actual:${lines[i]}"
            return
        }
    }
}
Hide
Paul King added a comment -

Groovy files committed too now. I was unsure whether package-info files should be excluded from requiring a header.

Show
Paul King added a comment - Groovy files committed too now. I was unsure whether package-info files should be excluded from requiring a header.

People

Vote (0)
Watch (0)

Dates

  • Created:
    Updated:
    Resolved: