swiftlang / swiftlang/github-workflows

Allow leading `swift-tools-version` in `Package.swift` for Licensing check

Open
#202 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Swift
Stars
115
Forks
57
Avg merge
1d 8h
Merged PRs (30d)
3

Description

By convention the first line of a Package.swift manifest is a comment containing the tools version:

"The version is specified on the first line of the manifest with the comment // swift-tools-version: and the version for the Swift compiler."

-Swift Package Manager Documentation

Following this convention causes the license header check of the soundness workflow to fail, even if the tools version is followed by a valid license header.

The approach I have seen taken to work around this, is to add the Package.swift file to the .licenseignore file to allow this test to pass.

Since Package.swift files are almost always present in swiftlang repositories, having license checking automatically work with the documented comment on the first line would allow these files to be more easily checked (or checked at all, instead of ignored).

This should also be allowed in version-specific manifest files such as Package@swift-5.10.swift.

Ideally the check would be able to accept both:

  • First line is swift-tools-version comment
  • License begins on second line

AND

  • First line is swift-tools-version comment
  • Second line is an empty newline
  • License begins on third line

Allowing the tools version to be separated from the license by an empty newline makes it clear the tools version is separate from the license and makes both more easily readable.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the soundness workflow's license-header check and reviewing how it handles .licenseignore and Package.swift files. Verify the check against Package.swift and Package@swift-5.10.swift examples with the swift-tools-version comment, both with and without an empty line before the license; done means all requested forms pass without ignoring the manifests.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
ci-cd
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.