Skip to content

Use reuse pre commit hook from devcontainer#33

Draft
lurtz wants to merge 3 commits intoeclipse-score:mainfrom
elektrobit-contrib:use-reuse-pre-commit-hook-from-devcontainer
Draft

Use reuse pre commit hook from devcontainer#33
lurtz wants to merge 3 commits intoeclipse-score:mainfrom
elektrobit-contrib:use-reuse-pre-commit-hook-from-devcontainer

Conversation

@lurtz
Copy link
Contributor

@lurtz lurtz commented Feb 17, 2026

This shows how running the reuse pre-commit hook defined in the devcontainer could look like. We might search for a better place for the pre-commit hook definitions or just keep them at the devcontainer. We have to limit the amount of repositories we use.

Makes use of the changes in eclipse-score/devcontainer#91

@github-actions
Copy link

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
2026/02/17 10:35:05 Downloading https://releases.bazel.build/8.3.0/release/bazel-8.3.0-linux-x86_64...
Extracting Bazel installation...
Starting local Bazel server (8.3.0) and connecting to it...
INFO: Invocation ID: f326edca-52e6-4acd-9651-360d06293c06
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
WARNING: For repository 'googletest', the root module requires module version googletest@1.17.0, but got googletest@1.17.0.bcr.2 in the resolved dependency graph. Please update the version in your MODULE.bazel or set --check_direct_dependencies=off
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 5 packages loaded
Loading: 5 packages loaded
    currently loading: 
Loading: 5 packages loaded
    currently loading: 
Loading: 5 packages loaded
    currently loading: 
Loading: 5 packages loaded
    currently loading: 
Analyzing: target //:license-check (6 packages loaded, 0 targets configured)
Analyzing: target //:license-check (6 packages loaded, 0 targets configured)

Analyzing: target //:license-check (27 packages loaded, 9 targets configured)

Analyzing: target //:license-check (91 packages loaded, 9 targets configured)

Analyzing: target //:license-check (97 packages loaded, 9 targets configured)

Analyzing: target //:license-check (112 packages loaded, 35 targets configured)

Analyzing: target //:license-check (169 packages loaded, 2623 targets configured)

Analyzing: target //:license-check (171 packages loaded, 3309 targets configured)

Analyzing: target //:license-check (172 packages loaded, 7607 targets configured)

Analyzing: target //:license-check (175 packages loaded, 7624 targets configured)

Analyzing: target //:license-check (175 packages loaded, 7624 targets configured)

Analyzing: target //:license-check (175 packages loaded, 7624 targets configured)

Analyzing: target //:license-check (181 packages loaded, 9769 targets configured)

Analyzing: target //:license-check (181 packages loaded, 9769 targets configured)

Analyzing: target //:license-check (182 packages loaded, 9889 targets configured)

Analyzing: target //:license-check (182 packages loaded, 9889 targets configured)

Analyzing: target //:license-check (182 packages loaded, 9889 targets configured)

Analyzing: target //:license-check (182 packages loaded, 9889 targets configured)

INFO: Analyzed target //:license-check (183 packages loaded, 11824 targets configured).
[7 / 13] Creating runfiles tree bazel-out/k8-opt-exec-ST-d57f47055a04/bin/external/score_tooling+/dash/tool/formatters/dash_format_converter.runfiles [for tool]; 0s local ... (2 actions, 1 running)
INFO: From Generating Dash formatted dependency file ...:
INFO: Successfully converted 2 packages from Cargo.lock to bazel-out/k8-fastbuild/bin/formatted.txt
[11 / 13] [Prepa] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
[13 / 13] no actions running
INFO: Elapsed time: 224.579s, Critical Path: 2.52s
INFO: 13 processes: 9 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 13 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions
Copy link

The created documentation from the pull request is available at: docu-html

@NEOatNHNG
Copy link
Contributor

This is conflicting with the copyright checker from tooling. Having two tools for the same job feels wrong. Then you should also remove that one. Also it is an anti-pattern to always update the year of the copyright each year. Can we disable that kind of behavior?

Copy link
Contributor Author

@lurtz lurtz left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is the header style of reuse ok? I suspect the bazel based header checks will fail now

Comment on lines +1 to +13
// *******************************************************************************
// Copyright (c) 2026 Contributors to the Eclipse Foundation
//
// See the NOTICE file(s) distributed with this work for additional
// information regarding copyright ownership.
//
// This program and the accompanying materials are made available under the
// terms of the Apache License Version 2.0 which is available at
// https://www.apache.org/licenses/LICENSE-2.0
//
// SPDX-FileCopyrightText: 2025, 2026 Contributors to the Eclipse Foundation
// SPDX-License-Identifier: Apache-2.0
// *******************************************************************************
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this header change ok?

Comment on lines 1 to 15
@@ -8,8 +9,10 @@
* terms of the Apache License Version 2.0 which is available at
* https://www.apache.org/licenses/LICENSE-2.0
*
* SPDX-FileCopyrightText: 2025, 2026 Contributors to the Eclipse Foundation
* SPDX-License-Identifier: Apache-2.0
********************************************************************************/
* *******************************************************************************
*/
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to force reuse to C comments?

Comment on lines +25 to +28
- repo: https://github.com/elektrobit-contrib/eclipse-score_devcontainer
rev: c2a743cb05d841eb2236daba55c3458c0a217197
hooks:
- id: reuse-annotate
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the change which triggered all

@lurtz
Copy link
Contributor Author

lurtz commented Feb 17, 2026

This is conflicting with the copyright checker from tooling. Having two tools for the same job feels wrong. Then you should also remove that one. Also it is an anti-pattern to always update the year of the copyright each year. Can we disable that kind of behavior?

It is an experiment, because Eclipse asked S-CORE if we could make use of reuse. If it works well, the bazel based logic will be removed as far as I know.

The copyright year is at the moment hardcoded in the template. The easiest solution would be for me to completely omit the year and let the SPDX tag set the year.

@lurtz
Copy link
Contributor Author

lurtz commented Feb 17, 2026

As far as I can tell there is no way to make the reuse template generic over the year.

Simplest solution would be to not use the template and only use the SPDX tags or have no year in the template. If both are not feasible we have to patch reuse.

@lurtz
Copy link
Contributor Author

lurtz commented Feb 17, 2026

As far as I can tell, reuse annotate is not suitable for automation (pre-commit) hooks. E.g. read this issue comment. There you can see that its design intention was to be simple and manually fixing its changes is expected.

Therefore I would only run reuse lint in pre-commit hooks. If we want to check the whole header I propose a mixture of reuse and opengrep.

Alternatively repos using bazel stick to the bazel solution.

@@ -1,5 +1,5 @@
# *******************************************************************************
# Copyright (c) 2025 Contributors to the Eclipse Foundation
# Copyright (c) 2026 Contributors to the Eclipse Foundation
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we should not change the year in existing comments

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is unavoidable if we stick to reuse annotate. I did not find a way to make it not do that.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants