Skip to content

Prevent clang-format from wrapping SPDX headers #303

Description

@bdice

The copyright notice written by rapidsai/pre-commit-hooks is 105 characters, which exceeds the ColumnLimit: 100 used by many RAPIDS C/C++ repositories. Repositories whose .clang-format has:

CommentPragmas: '^ IWYU pragma:'

can enter a loop while running pre-commit hooks:

  1. verify-copyright --fix --spdx writes the canonical one-line SPDX notice.
  2. On the next run, clang-format wraps that line and reflows SPDX-License-Identifier into the continuation.
  3. verify-copyright restores only the copyright line, leaving reserved. before the license identifier.
  4. Each subsequent run inserts another reserved. and never passes.

This has surfaced independently in several repositories:

Both RAFT's anchored pattern and cuDF's unanchored pattern protect canonical headers. We will standardize on the more conservative form:

CommentPragmas: '(IWYU pragma:|SPDX-)'

Affected repositories

The cuOpt rollout also restores 51 headers that were already corrupted on main.

The cuCIM configurations use ColumnLimit: 120, an empty CommentPragmas, and no clang-format pre-commit hook, so the 105-character canonical header does not trigger this failure there.

Acceptance criteria

  • Update every affected active public repository in the rollout scope still using the old pragma.
  • Confirm the canonical over-column SPDX block header is unchanged by two consecutive clang-format runs.
  • Confirm existing IWYU pragma: behavior remains protected.
  • Check for and repair any already-corrupted reserved. ... SPDX-License-Identifier lines; the copyright hook may not detect them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions