Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
CI_Source CI_Source
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Labels
    • Labels
  • Merge requests 5
    • Merge requests 5
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Operations
    • Operations
    • Metrics
    • Environments
  • Analytics
    • Analytics
    • CI/CD
    • Repository
    • Value Stream
  • Members
    • Members
  • Activity
  • Graph
  • Jobs
  • Commits
Collapse sidebar
  • Support
  • CI_SourceCI_Source
  • Merge requests
  • !20

Merged
Created Feb 06, 2022 by Ben Avison@bavisonDeveloper

Add `copyright` job for ensuring source files have licence headers

  • Overview 0
  • Commits 1
  • Pipelines 2
  • Changes 1

This job scans all the source files in a project, attempting to ensure they each have a header identifying the licence terms under which the file may be distributed. The job prints a list of the files that fail its check to the job log, and exits with failure status if the list is non-empty.

There is no standard format for licence headers, however one thing they do have in common is that they all feature a copyright notice. Upon scanning all the source files hosted by ROOL, very few files failed this test, and those that did either genuinely lacked licence terms, or had unusual ones where the author had waived copyright and placed the code into the public domain.

A few files used hard spaces around the word "Copyright" so the test uses grep -w which considers hard spaces to constitute a word boundary.

Although not (yet?) in use by any of our sources, the ISO SPDX standard advocates using SPDX-FileCopyrightText in source files in place of a copyright declaration. Therefore, this patch pre-emptively permits this as an alternative.

To cater for waived-copyright cases, a .gitlab-ci.yml file can define COPYRIGHT_WHITELIST to specify files for which this test should be skipped. This follows the same file naming pattern as WHITESPACE_WHITELIST.

Assignee
Assign to
Reviewer
Request review from
None
Milestone
None
Assign milestone
Time tracking
Source branch: copyright-headers