Skip to content

Commit 41721b4

Browse files
ci: enable cr_checker copyright check via pre-commit hook
1 parent 9b9a1be commit 41721b4

4 files changed

Lines changed: 81 additions & 0 deletions

File tree

.github/workflows/copyright.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
name: Copyright check
14+
on:
15+
pull_request:
16+
types: [opened, reopened, synchronize]
17+
merge_group:
18+
types: [checks_requested]
19+
jobs:
20+
copyright-check:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- name: Checkout repository
24+
uses: actions/checkout@v4
25+
- name: Set up Python 3
26+
uses: actions/setup-python@v5
27+
with:
28+
python-version: '3.12'
29+
# Runs the `copyright` hook from .pre-commit-config.yaml (cr_checker from
30+
# eclipse-score/tooling). The hook reports any file missing a copyright
31+
# header and fails the job, gating PRs without touching Bazel.
32+
- name: Run cr_checker via pre-commit
33+
uses: pre-commit/action@v3.0.1
34+
with:
35+
extra_args: copyright --all-files

.pre-commit-config.yaml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
# Runs cr_checker (copyright header check) directly from the eclipse-score/tooling
14+
# repo as a pre-commit hook, instead of via the Bazel `//:copyright` target.
15+
#
16+
# Rationale (see https://github.com/eclipse-score/reference_integration/issues/166):
17+
# the Bazel target pulls in the docs() -> needs_json -> @score_process graph, which
18+
# fails to resolve because score_process/score_platform are dev_dependencies in the
19+
# score modules and are therefore invisible when reference_integration aggregates
20+
# them. The pre-commit hook runs the checker as a standalone script over the repo's
21+
# files, so it is unaffected by Bazel module resolution.
22+
repos:
23+
- repo: https://github.com/eclipse-score/tooling
24+
rev: 31ff8eee214e4e97ef8f5cb46e443273515b63ec
25+
hooks:
26+
- id: copyright

.vscode/rustfmt.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
11
#!/usr/bin/env bash
2+
# *******************************************************************************
3+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
4+
#
5+
# See the NOTICE file(s) distributed with this work for additional
6+
# information regarding copyright ownership.
7+
#
8+
# This program and the accompanying materials are made available under the
9+
# terms of the Apache License Version 2.0 which is available at
10+
# https://www.apache.org/licenses/LICENSE-2.0
11+
#
12+
# SPDX-License-Identifier: Apache-2.0
13+
# *******************************************************************************
214

315
bazel run @score_tooling//format_checker:rustfmt_with_policies

BUILD

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,14 @@ setup_starpls(
4242
)
4343

4444
# Copyright check
45+
#
46+
# NOTE: CI enforces copyright headers via the pre-commit `copyright` hook
47+
# (see //.pre-commit-config.yaml and .github/workflows/copyright.yml), not this
48+
# Bazel target. `bazel run //:copyright.check` currently fails to analyze because
49+
# its "docs" src pulls in the docs() -> needs_json graph, which references
50+
# @score_process/@score_platform; those are dev_dependencies in the score modules
51+
# and so are not visible when reference_integration aggregates them.
52+
# Tracked in https://github.com/eclipse-score/reference_integration/issues/166.
4553
copyright_checker(
4654
name = "copyright",
4755
srcs = [

0 commit comments

Comments
 (0)