From ef566d021e64cca79f1bff3496081f881fa60534 Mon Sep 17 00:00:00 2001 From: Jochen Hoenle <173445474+hoe-jo@users.noreply.github.com> Date: Thu, 23 Jul 2026 17:52:02 +0200 Subject: [PATCH 1/3] [cr checker] refactor - use git based file discovery - change from include to exclude based schema - read file only once (instead of 3 times) - add integration tests --- .pre-commit-config.yaml | 22 +- BUILD | 27 +- MODULE.bazel | 19 + README.md | 8 +- cr_checker/BUILD | 18 + cr_checker/README.md | 86 +- cr_checker/cr_checker.bzl | 110 +- cr_checker/private/BUILD | 43 + cr_checker/requirements.in | 1 + cr_checker/requirements_3_11.txt | 91 ++ cr_checker/requirements_3_12.txt | 91 ++ cr_checker/tests/BUILD | 12 + cr_checker/tests/conftest.py | 80 ++ cr_checker/tests/test_cr_checker.py | 964 ++++++++++++- .../tests/test_cr_checker_integration.py | 580 ++++++++ cr_checker/tool/BUILD | 4 + cr_checker/tool/cr_checker.py | 1210 +++++++++++++---- defs.bzl | 4 - 18 files changed, 2902 insertions(+), 468 deletions(-) create mode 100644 cr_checker/private/BUILD create mode 100644 cr_checker/requirements.in create mode 100644 cr_checker/requirements_3_11.txt create mode 100644 cr_checker/requirements_3_12.txt create mode 100644 cr_checker/tests/conftest.py create mode 100644 cr_checker/tests/test_cr_checker_integration.py diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 31a97d16..ac7eb751 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -23,22 +23,18 @@ repos: - id: check-added-large-files args: [--maxkb=100, --enforce-all] # increase or add git lfs if too strict exclude: org.eclipse.dash.licenses-1.1.0.jar|blanket_index.html - - repo: https://github.com/google/yamlfmt - rev: 21ca5323a9c87ee37a434e0ca908efc0a89daa07 # v0.21.0 - hooks: - - id: yamlfmt - - repo: https://codeberg.org/fsfe/reuse-tool - rev: a1bb792acda6fd0724936b4ebbdbc8eceb9c0459 # v6.2.0 - hooks: - - id: reuse-lint-file - exclude: \.(svg|tpl|txt|conf|lock|json|in|png)$ - repo: local hooks: - id: copyright name: Check and fix copyright headers with cr_checker - entry: cr_checker/tool/pre-commit_wrapper --extensions h hpp c cpp rs rst py sh bzl ini yml yaml trlc rsl puml svg BUILD bazel --fix - # this would be the better language implementation, but struggle with python tooling - # language: python - language: script + entry: bazel run //:copyright-fix -- --modified-only + language: system + pass_filenames: false minimum_pre_commit_version: 3.2.0 types_or: [python, yaml, ini, rst, sh, shell, bash, bazel, c, c++, rust, plantuml, svg] + - id: format + name: Check formatting with bazel format.check + entry: bazel test //:format.check + language: system + pass_filenames: false + minimum_pre_commit_version: 3.2.0 diff --git a/BUILD b/BUILD index 1d84c2c3..2f0f201e 100644 --- a/BUILD +++ b/BUILD @@ -21,29 +21,12 @@ exports_files([ copyright_checker( name = "copyright", + # Whole-repo scope via a git exclude-magic pathspec: every file tracked + # by git is checked except .github/skills (those SKILL.md / README.md + # files are distributed verbatim to downstream repos via //:sync_skills + # and are not subject to this repo's copyright checker). srcs = [ - #"//tools", # Use full label if src is a package - "//:BUILD", - "//:MODULE.bazel", - "cli_helper", - "cr_checker", - "dash", - "third_party/format", - "python_basics", - "starpls", - "tools", - "lobster_bazel", - "bazel", - "manual_analysis", - "plantuml", - "validation", - "third_party/lint", - "skills_sync", - - # Add other directories/files you want to check - # Note: .github/skills is intentionally excluded; those SKILL.md / - # README.md files are distributed verbatim to downstream repos via - # //:sync_skills and are not subject to this repo's copyright checker. + ":(exclude).github/skills/**", ], config = "//cr_checker/resources:config", exclusion = "//cr_checker/resources:exclusion", diff --git a/MODULE.bazel b/MODULE.bazel index bf2b27e5..9cbb87df 100644 --- a/MODULE.bazel +++ b/MODULE.bazel @@ -248,6 +248,25 @@ use_repo(pip, "pip_lobster_bazel") use_repo(pip, "pip_rules_score") +# cr_checker's own Python deps (e.g. rapidfuzz), kept separate from the +# shared pip_tooling hub (pytest/basedpyright/pylint) since cr_checker is a +# standalone, independently reusable component. +[ + pip.parse( + envsubst = ["PIP_INDEX_URL"], + extra_pip_args = ["--index-url=${PIP_INDEX_URL:-https://pypi.org/simple/}"], + hub_name = "pip_cr_checker", + python_version = "3.{}".format(version), + requirements_lock = "//cr_checker:requirements_3_{}.txt".format(version), + ) + for version in [ + "11", + "12", + ] +] + +use_repo(pip, "pip_cr_checker") + ############################################################################### # Multitool Hub (for ruff, pyright, actionlint, etc.) ############################################################################### diff --git a/README.md b/README.md index f48212ce..faa9cba9 100644 --- a/README.md +++ b/README.md @@ -82,7 +82,7 @@ Here are two examples to showcase how to do this. ``` load("@score_python_basics//:defs.bzl", "score_py_pytest") => load("@score_tooling//:defs.bzl", "score_py_pytest") -load("@score_cr_checker//:cr_checker.bzl", "copyright_checker") => load("@score_tooling//:defs.bzl", "copyright_checker") +load("@score_cr_checker//:cr_checker.bzl", "copyright_checker") => load("@score_tooling//cr_checker:cr_checker.bzl", "copyright_checker") ``` All things inside of 'tooling' can now be imported from `@score_tooling//:defs.bzl`. @@ -91,14 +91,14 @@ The available import targets are: - score_virtualenv - score_py_pytest - dash_license_checker -- copyright_checker - cli_helper - setup_starpls - rust_coverage_report -Formatting and linting are no longer re-exported from `defs.bzl`; use +Formatting, linting, and cr_checker are no longer re-exported from `defs.bzl`; use `@score_tooling//third_party/format:macros.bzl`, `@score_tooling//third_party/lint:macros.bzl`, -or the `@score_tooling//third_party/format:rustfmt_with_policies` label directly. +`@score_tooling//cr_checker:cr_checker.bzl`, or the `@score_tooling//third_party/format:rustfmt_with_policies` +label directly. ## Format the tooling repository diff --git a/cr_checker/BUILD b/cr_checker/BUILD index e69de29b..3aec866f 100644 --- a/cr_checker/BUILD +++ b/cr_checker/BUILD @@ -0,0 +1,18 @@ +# ******************************************************************************* +# 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-License-Identifier: Apache-2.0 +# ******************************************************************************* + +exports_files([ + "requirements.in", + "requirements_3_11.txt", + "requirements_3_12.txt", +]) diff --git a/cr_checker/README.md b/cr_checker/README.md index e9d98334..6292d844 100644 --- a/cr_checker/README.md +++ b/cr_checker/README.md @@ -45,18 +45,24 @@ python cr_checker.py -t [options] ### Arguments - **-t**, **--template-file**: (Required) Path to the template file that defines the copyright text for each file extension. +- **-c**, **--config-file**: Path to a config file used to render template placeholders (e.g. author). Optional; an invalid file is a hard error. +- **--exclusion-file**: Path to a file listing paths to exclude from the copyright check. - **-v**, **--verbose**: Enable debug-level logging. - **-l**, **--log-file**: Path to a log file where logs will be saved. If not provided, logs will print to the console. -- **-e**, **--extensions**: List of file extensions to filter, e.g., -e .py .cpp. -- **--use_memory_map**: Use memory-mapped file reading for large files. +- **-e**, **--extensions**: List of file extensions to filter, e.g., -e py cpp. +- **--use_memory_map**: Use memory-mapped file reading for large files (check mode only; `--fix` always reads the whole file). - **--encoding**: File encoding (default is utf-8). -- **--offset**: Additional offset for the header length to account for lines like a shebang. -- **--fix**: Setting script into fix mode where copyright header will be added to the files if it's missing from same. +- **--offset**: Force this many characters (plus any trailing blank lines) at the start of the file to be treated as a recognized preamble, overriding auto-detection. Character-based, not byte-based. Rarely needed: a leading shebang is detected and preserved automatically; use this only for other preamble kinds the tool doesn't (yet) recognize. +- **-f**, **--fix**: Setting script into fix mode where copyright header will be added to the files if it's missing from same. - **--remove-offset**: Number of characters to remove before appending proper copyright header (works only with `--fix` option). -- **inputs**: (Required) Directories or files to parse, or a parameter file prefixed with @ that lists files or directories. +- **--force**: With `--fix`, also rewrite headers whose similarity to the template is below the auto-fix threshold (normally left untouched and only reported, since they may be a genuinely different license text). Never affects a duplicate-header file, which always requires manual review. Ignored without `--fix`. +- **--modified-only**: Only check files that differ from `HEAD` (staged and/or unstaged), e.g. for a fast, incremental pre-commit run. Takes precedence over `inputs`. +- **inputs**: Directories or files to parse, or a parameter file prefixed with @ that lists files or directories. Optional -- when omitted, the whole repository (per `git ls-files`) is checked. > NOTE: Option `--remove-offset` can have severe consequences if the offset is miscalculated. Use with **extreme caution**. +> NOTE: Option `--force` bypasses the safety guard that normally prevents `--fix` from overwriting a header that looks substantially different from the template -- it may not be the same license at all. **Always review the diff afterwards.** + > NOTE: Setting directory as `.` will cause that tool removes your complete workspace! This is connected with how Bazel includes python into build. **DO NOT USE THIS OPTION UNLESS YOU'RE 100% SURE IN WHAT YOU'RE DOING**. ### Examples @@ -72,7 +78,8 @@ python cr_checker.py -t templates.ini -e py cpp --fix --offset 24 --use_memory_m #### A bit more about `--offset` -This mode is special that will enable tool to do advance search & replace copyright headers. For example, assuming that we have following python implementation: +A leading shebang (`#!/usr/bin/env python3`, etc.) is detected and preserved +automatically -- you don't need `--offset` for it. For example, given: ```python #!/usr/bin/env python3 @@ -80,38 +87,62 @@ This mode is special that will enable tool to do advance search & replace copyri import os ``` -and we use following command: +running: ```sh -python cr_checker.py -t templates.ini -e py cpp --fix --use_memory_map @files_to_check.txt +python cr_checker.py -t templates.ini -e py cpp --fix @files_to_check.txt ``` -The result will be following: +produces: ```python +#!/usr/bin/env python3 + ################## # COPYRIGHT HEADER ################## -#!/usr/bin/env python3 import os ``` -This is of course not what we want, and for that we use `--offset=24` where 24 is number of char + 1 (for new line char). -if we apply this arguments now on same file, the outcome is different. +#### A bit more about `--force` -```python -#!/usr/bin/env python3 +`--fix` only rewrites a wrong-format header automatically when it's similar +enough to the rendered template (a formatting drift -- border style, a +missing angle bracket, a stray typo, ...). A header that scores below the +threshold is left untouched and only reported, since it could be a genuinely +different, unrelated license text that must never be silently overwritten. -################## -# COPYRIGHT HEADER -################## +If you've confirmed (e.g. via `--verbose`, which logs the similarity +percentage for every non-compliant file) that the low-scoring headers are +actually just an old/outdated version of the same copyright statement -- +e.g. a header predating a template change, or one written with a different +comment-wrapper convention -- pass `--force` to rewrite them anyway: -import os +```sh +python cr_checker.py -t templates.ini --fix --force @files_to_check.txt +``` + +When invoking through the Bazel `.fix` target, remember to put `--` before +the flag so Bazel forwards it to the tool instead of trying to parse it +itself: + +```sh +bazel run //:copyright.fix -- --force ``` -On another hand, `--offset` has also another role. Assuming that a header text in file is soo big that copyright header is in the middle of the file, with regular command, the tool will not detect copyright headed. With `--offset=` we can tell the tool from where to start considering the search for -copyright header. +`--force` never touches a file with a *duplicate* copyright header -- +that always requires manual review, regardless of similarity. **Always +review the resulting diff afterwards**, since a low similarity score can +also mean the existing text is a genuinely different, unrelated license. + +`--offset=` is only needed to force-treat a preamble kind the tool +doesn't recognize (e.g. content that isn't a shebang) as content that must +stay above the header, or to tell the tool where to start looking for an +existing header when it isn't at the very top of the file. Content between +the (auto-detected or forced) offset and an existing header that isn't part +of either is reported as a *misplaced* header and, with `--fix`, moved to +immediately after the newly written header. ### Template File Format @@ -154,12 +185,12 @@ To integrate copyright verification into your Bazel-based project, you can use t #### Usage ```python -load("@score_cr_checker//cr_checker:def.bzl", "copyright_checker") +load("@score_tooling//cr_checker:cr_checker.bzl", "copyright_checker") copyright_checker( name = "copyright_check", srcs = glob(["src/**/*.cpp", "src/**/*.h"]), - config = "@score_cr_checker//tools/cr_checker/resources:config", - template = "@score_cr_checker//tools/cr_checker/resources:templates", + config = "@score_tooling//cr_checker/resources:config", + template = "@score_tooling//cr_checker/resources:templates", visibility = ["//visibility:public"], ) ``` @@ -180,14 +211,17 @@ copyright_checker( ### Integrate `cr_checker` using Bazel module -The CopyRight check tool is integrated in other bazel repository using Bazel modules mechanism. The current tool is not registered within BCR so private Bazel registry needs to be select. To select custom Bazel registry add following lines into .bazelrc: +`cr_checker` is distributed as part of the unified `score_tooling` Bazel module (it is no longer +a standalone `score_cr_checker` module). The current module is not registered within BCR so a +private Bazel registry needs to be selected. To select the custom Bazel registry, add the +following lines into `.bazelrc`: ```python common --registry=https://raw.githubusercontent.com/eclipse-score/bazel_registry/main/ common --registry=https://bcr.bazel.build ``` -This will allow Bazel to look into project Bazel registry. After that all what is needed is to add following lines in MODULE.bazel: +This will allow Bazel to look into the project Bazel registry. After that all what is needed is to add following lines in MODULE.bazel: ```python ############################################################################### @@ -195,5 +229,5 @@ This will allow Bazel to look into project Bazel registry. After that all what i # CopyRight checker dependencies # ############################################################################### -bazel_dep(name = "score_cr_checker", version = "0.2.2") +bazel_dep(name = "score_tooling", version = "1.0.0") ``` diff --git a/cr_checker/cr_checker.bzl b/cr_checker/cr_checker.bzl index c567554b..e040a18f 100644 --- a/cr_checker/cr_checker.bzl +++ b/cr_checker/cr_checker.bzl @@ -11,39 +11,39 @@ # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* -"""Defines Bazel rules for running copyright checks and fixes.""" +"""Defines Bazel rules for running copyright checks and fixes. +""" load("@aspect_rules_py//py:defs.bzl", "py_binary") def copyright_checker( name, - srcs, visibility, template, config, exclusion = None, + srcs = [], extensions = [], offset = 0, remove_offset = 0, debug = False, use_memory_map = False, - fix = False, target_compatible_with = None): """ - Defines a custom build rule for checking and optionally fixing files for compliance - with specific requirements, such as copyright headers. + Defines ``bazel run`` targets for checking and fixing copyright headers. Args: name (str): The name of the rule, used as an identifier in the build system. - srcs (list): A list of source file paths to check. visibility (list): A list defining the visibility of the rule, specifying which targets can use this rule. - template (str, optional): Path to the template resource used for validation. - Defaults to "//tools/cr_checker/resources:templates". - config (str, optional): Path to the config resource used for project variables. - Defaults to "//tools/cr_checker/resources:config". + template (str): Path to the template resource used for validation. + config (str): Path to the config resource used for project variables. exclusion (str, optional): Path to a text file listing files to be excluded from the copyright check. File format: one path per line, relative to the repository root. + srcs (list, optional): Workspace-relative paths (files, directories, or git + pathspecs) to restrict which files are checked. + Defaults to an empty list, meaning the whole + repository (per ``git ls-files``) is checked. extensions (list, optional): A list of file extensions to filter the source files. Defaults to an empty list, meaning all files are checked. offset (int, optional): The line offset for applying checks or modifications. @@ -54,64 +54,68 @@ def copyright_checker( Defaults to False. use_memory_map (bool, optional): Whether to use memory mapping for large files to improve performance. Defaults to False. - fix (bool, optional): Whether to apply fixes to files instead of just reporting issues. - Defaults to False. + target_compatible_with (list, optional): Standard Bazel target compatibility constraint. Returns: None: This function defines a rule for a build system and does not return a value. """ - t_names = [ - "{}.check".format(name), - "{}.fix".format(name), - ] - - args = [ + common_args = [ "-t $(location {})".format(template), "-c $(location {})".format(config), ] - if len(extensions): - args.append("-e {exts}".format( - exts = " ".join([exts for exts in extensions]), - )) - + if extensions: + common_args.append("-e {}".format(" ".join(extensions))) if exclusion: - args.append("--exclusion-file $(location {})".format(exclusion)) - + common_args.append("--exclusion-file $(location {})".format(exclusion)) if offset: - args.append("--offset {}".format(offset)) - + common_args.append("--offset {}".format(offset)) if debug: - args.append("-v") - + common_args.append("-v") if use_memory_map: - args.append("--use_memory_map") + common_args.append("--use_memory_map") + + # Optional scope restriction, forwarded as-is to `git ls-files` pathspecs. + common_args.extend(srcs) - for src in srcs: - args.append("$(locations {})".format(src)) + # Only the tool resources need to be in runfiles; the files to check are + # discovered directly from the workspace at runtime via `git ls-files`. + data = [template, config] + if exclusion: + data.append(exclusion) - for t_name in t_names: - if t_name == "{}.fix".format(name): - args.insert(0, "--fix") - if remove_offset: - args.append("--remove_offset {}".format(remove_offset)) + py_binary( + name = "{}.check".format(name), + main = "cr_checker.py", + srcs = [ + "@score_tooling//cr_checker/tool:cr_checker_lib", + ], + deps = [ + "@score_tooling//cr_checker/tool:cr_checker_lib", + ], + args = common_args, + data = data, + visibility = visibility, + target_compatible_with = target_compatible_with, + ) - data = srcs[:] - data.append(template) - data.append(config) - if exclusion: - data.append(exclusion) + fix_args = ["--fix"] + common_args + if remove_offset: + fix_args.append("--remove-offset {}".format(remove_offset)) - py_binary( - name = t_name, - main = "cr_checker.py", - srcs = [ - "@score_tooling//cr_checker/tool:cr_checker_lib", - ], - args = args, - data = data, - visibility = visibility, - target_compatible_with = target_compatible_with, - ) + py_binary( + name = "{}.fix".format(name), + main = "cr_checker.py", + srcs = [ + "@score_tooling//cr_checker/tool:cr_checker_lib", + ], + deps = [ + "@score_tooling//cr_checker/tool:cr_checker_lib", + ], + args = fix_args, + data = data, + visibility = visibility, + target_compatible_with = target_compatible_with, + ) native.alias( name = "copyright-check", diff --git a/cr_checker/private/BUILD b/cr_checker/private/BUILD new file mode 100644 index 00000000..fcded5b0 --- /dev/null +++ b/cr_checker/private/BUILD @@ -0,0 +1,43 @@ +# ******************************************************************************* +# 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-License-Identifier: Apache-2.0 +# ******************************************************************************* +load("@bazel_skylib//rules:build_test.bzl", "build_test") +load("@rules_python//python:pip.bzl", "compile_pip_requirements") + +# In order to update the requirements, change the `requirements.in` file and run: +# `bazel run //cr_checker/private:requirements_3_XX.update --@@rules_python+//python/config_settings:python_version=3.XX`. +# This will update the `requirements_3_XX.txt` file. +# To upgrade all dependencies to their latest versions, run: +# `bazel run //cr_checker/private:requirements_3_XX.update --@@rules_python+//python/config_settings:python_version=3.XX -- --upgrade`. +[ + compile_pip_requirements( + name = "requirements_3_{}".format(version), + src = "//cr_checker:requirements.in", + python_version = "3.{}".format(version), + requirements_txt = "//cr_checker:requirements_3_{}.txt".format(version), + tags = [ + "manual", + ], + ) + for version in [ + "11", + "12", + ] +] + +build_test( + name = "ensure_all_private_targets_work", + targets = [ + ":requirements_3_11.update", + ":requirements_3_12.update", + ], +) diff --git a/cr_checker/requirements.in b/cr_checker/requirements.in new file mode 100644 index 00000000..ec512b4a --- /dev/null +++ b/cr_checker/requirements.in @@ -0,0 +1 @@ +rapidfuzz diff --git a/cr_checker/requirements_3_11.txt b/cr_checker/requirements_3_11.txt new file mode 100644 index 00000000..92567651 --- /dev/null +++ b/cr_checker/requirements_3_11.txt @@ -0,0 +1,91 @@ +# +# This file is autogenerated by pip-compile with Python 3.11 +# by the following command: +# +# bazel run //cr_checker/private:requirements_3_11.update +# +rapidfuzz==3.14.5 \ + --hash=sha256:0084b687b02b4e569b46d8d6d4ad25659528e6081cd6d067ca453a69035f07e4 \ + --hash=sha256:01550fe5f60fd176aa66b7611289d46dc4aa4b1b904874c7b6d1d54e581c5ec1 \ + --hash=sha256:0298d357e2bc59d572da4db0bc631009b6f8f6c9bc8c11e99a12b833f16b6575 \ + --hash=sha256:068b3e965ca9d9ee4debe40001ae7c3938ba646308afd33cf0c66618147db65c \ + --hash=sha256:071d96b957a33b9296b9284b6350a0fb6d030b154a04efd7c15e56b98b79a517 \ + --hash=sha256:09d6c9ba091854f07817055d795d604179c12a8f308ba4c7d56f3719dfea1646 \ + --hash=sha256:0d3378f471ef440473a396ce2f8e97ee12f89a78b495540e0a5617bbfe895638 \ + --hash=sha256:0ebd1a18e2e47bc0b292a07e6ed9c3642f8aaa672d12253885f599b50807a4f9 \ + --hash=sha256:0f23e37019ec07712d58976b1ab2b889f8649a7f7c2f626a2f34ea9139e79279 \ + --hash=sha256:11bfc2ed8fbe4ab86bd516fadefab126f90e6dcadffa761739fcb304707dfd35 \ + --hash=sha256:13cb79c23ef5516e4c4e3830877be8b19aa75203636be1163d690d37803f6504 \ + --hash=sha256:17a34330cd2a538c1ce5d400b61ba358c5b72c654b928ff87b362e88f8b864c7 \ + --hash=sha256:1a31cc6d7d03e7318a0974c038959c59e19c752b81115f2e9138b3331cd64d45 \ + --hash=sha256:1e910eebca9fd0eba245c0555e764597e8a0cccb673a92da2dc2397050725f48 \ + --hash=sha256:1e989f86113be66574113b9c7bdf4793f3f863d248e47d911b355e05ca6b6b10 \ + --hash=sha256:2e83cd2e25bb4edd97b689d9979d9c3acccdaaf26ceac08212ceece202febcfa \ + --hash=sha256:39ef8658aaf67d51667e7bdaf7096f432333377d8302ac43c70b5df8a4cf89b8 \ + --hash=sha256:3d50e5861872935fece391351cbb5ba21d1bced277cf5e1143d207a0a35f1925 \ + --hash=sha256:3e91dcd2549b8f8d843f98ba03a17e01f3d8b72ce942adbbb6761bc58ffce813 \ + --hash=sha256:419e4397a36e2665ec992d8d64c20ba4b2a42500c76ecadeca78a4f19cb9cc32 \ + --hash=sha256:440d30faaf682ca496170a7f0cc5453ec942e3e079f0fd802c9a7f938dfb50a3 \ + --hash=sha256:46b92a9970dcc34f0096901c792644094cab49554ac3547f35e3aebbdf0a3610 \ + --hash=sha256:478b59bb018a6780d73f33e38d0b3ec5e968a6c1ed42876b993dd456b7aa20e8 \ + --hash=sha256:48bee0b91bebfaec41e1081e351000659ab7570cc4598d617aa04d5bf827f9e6 \ + --hash=sha256:4900143d82071bdda533b00300c40b14b963ff826b3642cc463b6dd0f036585e \ + --hash=sha256:4a60f0057231188e3bd30216f7b4e0f279b11fa4ec818bb6c1d9f014d1562fbc \ + --hash=sha256:56227a61fd3d17b0cd9793132431f3a3d07c8654be96794ba9f89fe0fc8b2d09 \ + --hash=sha256:578e6051f6d5e6200c259b47a103cf06bb875ab5814d17333fc0b5c290b22f4c \ + --hash=sha256:593c00dac4e30231c35bf3b4f1da8ec0998762e9e94425586a5d636fcd57f9d0 \ + --hash=sha256:59b3dba758661a318995655435c6ab20a04ade79fa51e75bc8dc107cac8df280 \ + --hash=sha256:5ab449c9abd0d4e1f8145dce0798a4c822a1a1933d613c764a641bea88b8bdab \ + --hash=sha256:5dfa89d78f22cd773054caff44827b846161a29f2dcf7e78b8f90d086621e502 \ + --hash=sha256:649712823f3abcdc48427147a5384fac15623ba435d0013959b52e6462521397 \ + --hash=sha256:667f40fe9c81ad129b198d236881b00dd9e8314d9cc72d03c3e16bdfe5879051 \ + --hash=sha256:6737b35d5af7479c5bf9710f7b17edd9d2c43128d974d25fb4ea653e42c64609 \ + --hash=sha256:67f3f9d2b444268ab53e47d31bab89954888d23c04c6789f2c727e51fe4b1d13 \ + --hash=sha256:7092a216728f80c960bd6b3807275d1ee318b168986bd5dc523349581d4890b8 \ + --hash=sha256:738c96944d076deeaff70e92b65696ab4f7ecb8081d7791c5403a3257dfaf8ff \ + --hash=sha256:77eac0526899b3c3ad1454bb2b03cdb491d67358ec8ef0c9c48bd61b632b431d \ + --hash=sha256:7d5ca9c7832e6879a707296d1463685f7c243a27846227044504741640caec66 \ + --hash=sha256:7e580cb04ad849ae9b786fa21383c6b994b6e6c1444ad1cb9f22392759d72741 \ + --hash=sha256:8166efddea49fdbc61185559f47593239e4794fd7c9044dd5a789d1a90af852d \ + --hash=sha256:823b1b9d9230809d8edcc18872770764bfe8ef4357995e16744047c8ccf0e489 \ + --hash=sha256:88b7d31ff1cc5e9bc0e4406e6b1fa00b6d37163d50bb58091e9b976ff1129faa \ + --hash=sha256:8c90cdf8516d9057e502aa6003cea71cf5ec27cc44699ca52412b502a04761bb \ + --hash=sha256:8ce1d850b3c0178440efde9e884d98421b5e87ff925f364d6d79e23910d7593f \ + --hash=sha256:8f4a8f5cc84c7ad6bffa0e9947b33eb343ad66e6b53e94fe54378a5508c5ed53 \ + --hash=sha256:93d8da883a35116d6813432177f35e570db5b0a5e30ecb0cbd7cb39c815735df \ + --hash=sha256:95d937e74c1a7a1287dfb03b62a827be08ede10a155cf1af73bbf47f2b73ee6e \ + --hash=sha256:9669753caef7fdc6529f6adcc5883ed98d65976445d9322e7dbdb6b697feee13 \ + --hash=sha256:97131ab2be39043054ee28d99e09efe316e6d53449b7e962dfcf3c2de8b2b246 \ + --hash=sha256:97c6d85283629646fa87acc22c66b30ea9d4de7f6fdf887daa2e30fa041829b5 \ + --hash=sha256:9981d38a703b86f0e315a3cd229fd1906fe1d91c989ed121fb975b3c849f89f5 \ + --hash=sha256:9ad37a0be705b544af6296da8edddc260d10a8ae5462530fc9991f66498bb1f9 \ + --hash=sha256:a2ae6f53f99c9a0eca7a0afc5b4e45fc73bc1dd4ac74c00509031d76df80ed98 \ + --hash=sha256:aac0ad28c686a5e72b81668b906c030ee28050b244544b8af68e12fb32543895 \ + --hash=sha256:af3b859726cd3374287e405e14b9634563c078c5531a4f62375508addebddad1 \ + --hash=sha256:af6a90a4ed2a48fa1a2d17e9d824e6c7c950bea5bad0b707c77fd55751e6bfef \ + --hash=sha256:b002c7994cc9f2bc9d9856f0fbaee6e8072c983873846c92f25cefba5b2a925f \ + --hash=sha256:b486b5218808f6f4dc471b114b1054e63553db69705c97da0271f47bd706aedd \ + --hash=sha256:b9c6bd754d11f6e78ac54e3d86b4b11dc1ba2f13e5fc958899574532897f5a99 \ + --hash=sha256:ba10ac57884ce82112f7ed910b67e7fb6072d8ef2c06e30dc63c0f604a112e0e \ + --hash=sha256:bf5018938208d4597b2e679a4f8cff9fd252f1df53583130ae56281a21801b64 \ + --hash=sha256:c0919d1f89ddf91129906705723118ea09754171e4116f5a5dbc667c7bc9b261 \ + --hash=sha256:c5801a89604c65ab4cc9e91b23bc4076d0ca80efd8c976fb63843d7879a85d7f \ + --hash=sha256:c84af70bcf34e99aee894e46a0f1ac77f17d0ef828179c387407642e2466d28a \ + --hash=sha256:cb2829fedd672dd7107267189dabe2bbe07972801d636014417c6861eb89e358 \ + --hash=sha256:d45e06f60729e07d9b20c205f7e5cff90b6ef2584e852eecf46e045aea69627d \ + --hash=sha256:d7ca16637c0ede8243f84074044bd0b2335a0341421f8227c85756de2d18c819 \ + --hash=sha256:d8375e3da319593389727c3187ccaf3e0e84199accc530866b8e0f2b79af05e9 \ + --hash=sha256:dfa552338f51aec280f17b02d28bace1e162d1a84ccd80e3339a57f98aedb56b \ + --hash=sha256:dfef96543ced67d9513a422755db422ae1dc34dade0a1485e0b43e7342ed3ebf \ + --hash=sha256:e012177c8e8a8a0754ae0d6027d63042aa5ff036d9f40f07cb3466a6082e21b8 \ + --hash=sha256:e251126d48615e1f02b4a178f2cd0cd4f0332b8a019c01a2e10480f7552554b4 \ + --hash=sha256:e52da10236aa6212de71b9e170bace65b64b129c0dea7fc243d6c9ce976f5074 \ + --hash=sha256:eacb434410b8d9ca99a8d42352ef085cf423e3c76c1f0b86be2fcba3bff2952c \ + --hash=sha256:ebd8fd343bf8492a1e60bcb6dc99f90f74f65d98d8241a6b3e1fed225b76ecd6 \ + --hash=sha256:f0b2af76b7e7060c09e1a0dfa9410eb19369cbe6164509bff2ef94094b54d2b6 \ + --hash=sha256:f2073495a7f9b75e57e600747ac09510d67683fd64d3228e009740b7ef88f9fe \ + --hash=sha256:f4c1bca487a17fe4226b4ffb2d30e799d2b274d692cffa76bd0746f56235fca3 \ + --hash=sha256:f9fff308486bbd2c8c24f25e8e152c7594d3fe8db265a2d6a1ce24d58671127f \ + --hash=sha256:fbf1b8bb2695415b347f3727da1addca2acb82c9b97ac86bebf8b1bead1eb12d \ + --hash=sha256:feedf219672eef83ea6be6f3bb093bba396a8560fc75be85ba225f082903df0a + # via -r cr_checker/requirements.in diff --git a/cr_checker/requirements_3_12.txt b/cr_checker/requirements_3_12.txt new file mode 100644 index 00000000..4428f8c1 --- /dev/null +++ b/cr_checker/requirements_3_12.txt @@ -0,0 +1,91 @@ +# +# This file is autogenerated by pip-compile with Python 3.12 +# by the following command: +# +# bazel run //cr_checker/private:requirements_3_12.update +# +rapidfuzz==3.14.5 \ + --hash=sha256:0084b687b02b4e569b46d8d6d4ad25659528e6081cd6d067ca453a69035f07e4 \ + --hash=sha256:01550fe5f60fd176aa66b7611289d46dc4aa4b1b904874c7b6d1d54e581c5ec1 \ + --hash=sha256:0298d357e2bc59d572da4db0bc631009b6f8f6c9bc8c11e99a12b833f16b6575 \ + --hash=sha256:068b3e965ca9d9ee4debe40001ae7c3938ba646308afd33cf0c66618147db65c \ + --hash=sha256:071d96b957a33b9296b9284b6350a0fb6d030b154a04efd7c15e56b98b79a517 \ + --hash=sha256:09d6c9ba091854f07817055d795d604179c12a8f308ba4c7d56f3719dfea1646 \ + --hash=sha256:0d3378f471ef440473a396ce2f8e97ee12f89a78b495540e0a5617bbfe895638 \ + --hash=sha256:0ebd1a18e2e47bc0b292a07e6ed9c3642f8aaa672d12253885f599b50807a4f9 \ + --hash=sha256:0f23e37019ec07712d58976b1ab2b889f8649a7f7c2f626a2f34ea9139e79279 \ + --hash=sha256:11bfc2ed8fbe4ab86bd516fadefab126f90e6dcadffa761739fcb304707dfd35 \ + --hash=sha256:13cb79c23ef5516e4c4e3830877be8b19aa75203636be1163d690d37803f6504 \ + --hash=sha256:17a34330cd2a538c1ce5d400b61ba358c5b72c654b928ff87b362e88f8b864c7 \ + --hash=sha256:1a31cc6d7d03e7318a0974c038959c59e19c752b81115f2e9138b3331cd64d45 \ + --hash=sha256:1e910eebca9fd0eba245c0555e764597e8a0cccb673a92da2dc2397050725f48 \ + --hash=sha256:1e989f86113be66574113b9c7bdf4793f3f863d248e47d911b355e05ca6b6b10 \ + --hash=sha256:2e83cd2e25bb4edd97b689d9979d9c3acccdaaf26ceac08212ceece202febcfa \ + --hash=sha256:39ef8658aaf67d51667e7bdaf7096f432333377d8302ac43c70b5df8a4cf89b8 \ + --hash=sha256:3d50e5861872935fece391351cbb5ba21d1bced277cf5e1143d207a0a35f1925 \ + --hash=sha256:3e91dcd2549b8f8d843f98ba03a17e01f3d8b72ce942adbbb6761bc58ffce813 \ + --hash=sha256:419e4397a36e2665ec992d8d64c20ba4b2a42500c76ecadeca78a4f19cb9cc32 \ + --hash=sha256:440d30faaf682ca496170a7f0cc5453ec942e3e079f0fd802c9a7f938dfb50a3 \ + --hash=sha256:46b92a9970dcc34f0096901c792644094cab49554ac3547f35e3aebbdf0a3610 \ + --hash=sha256:478b59bb018a6780d73f33e38d0b3ec5e968a6c1ed42876b993dd456b7aa20e8 \ + --hash=sha256:48bee0b91bebfaec41e1081e351000659ab7570cc4598d617aa04d5bf827f9e6 \ + --hash=sha256:4900143d82071bdda533b00300c40b14b963ff826b3642cc463b6dd0f036585e \ + --hash=sha256:4a60f0057231188e3bd30216f7b4e0f279b11fa4ec818bb6c1d9f014d1562fbc \ + --hash=sha256:56227a61fd3d17b0cd9793132431f3a3d07c8654be96794ba9f89fe0fc8b2d09 \ + --hash=sha256:578e6051f6d5e6200c259b47a103cf06bb875ab5814d17333fc0b5c290b22f4c \ + --hash=sha256:593c00dac4e30231c35bf3b4f1da8ec0998762e9e94425586a5d636fcd57f9d0 \ + --hash=sha256:59b3dba758661a318995655435c6ab20a04ade79fa51e75bc8dc107cac8df280 \ + --hash=sha256:5ab449c9abd0d4e1f8145dce0798a4c822a1a1933d613c764a641bea88b8bdab \ + --hash=sha256:5dfa89d78f22cd773054caff44827b846161a29f2dcf7e78b8f90d086621e502 \ + --hash=sha256:649712823f3abcdc48427147a5384fac15623ba435d0013959b52e6462521397 \ + --hash=sha256:667f40fe9c81ad129b198d236881b00dd9e8314d9cc72d03c3e16bdfe5879051 \ + --hash=sha256:6737b35d5af7479c5bf9710f7b17edd9d2c43128d974d25fb4ea653e42c64609 \ + --hash=sha256:67f3f9d2b444268ab53e47d31bab89954888d23c04c6789f2c727e51fe4b1d13 \ + --hash=sha256:7092a216728f80c960bd6b3807275d1ee318b168986bd5dc523349581d4890b8 \ + --hash=sha256:738c96944d076deeaff70e92b65696ab4f7ecb8081d7791c5403a3257dfaf8ff \ + --hash=sha256:77eac0526899b3c3ad1454bb2b03cdb491d67358ec8ef0c9c48bd61b632b431d \ + --hash=sha256:7d5ca9c7832e6879a707296d1463685f7c243a27846227044504741640caec66 \ + --hash=sha256:7e580cb04ad849ae9b786fa21383c6b994b6e6c1444ad1cb9f22392759d72741 \ + --hash=sha256:8166efddea49fdbc61185559f47593239e4794fd7c9044dd5a789d1a90af852d \ + --hash=sha256:823b1b9d9230809d8edcc18872770764bfe8ef4357995e16744047c8ccf0e489 \ + --hash=sha256:88b7d31ff1cc5e9bc0e4406e6b1fa00b6d37163d50bb58091e9b976ff1129faa \ + --hash=sha256:8c90cdf8516d9057e502aa6003cea71cf5ec27cc44699ca52412b502a04761bb \ + --hash=sha256:8ce1d850b3c0178440efde9e884d98421b5e87ff925f364d6d79e23910d7593f \ + --hash=sha256:8f4a8f5cc84c7ad6bffa0e9947b33eb343ad66e6b53e94fe54378a5508c5ed53 \ + --hash=sha256:93d8da883a35116d6813432177f35e570db5b0a5e30ecb0cbd7cb39c815735df \ + --hash=sha256:95d937e74c1a7a1287dfb03b62a827be08ede10a155cf1af73bbf47f2b73ee6e \ + --hash=sha256:9669753caef7fdc6529f6adcc5883ed98d65976445d9322e7dbdb6b697feee13 \ + --hash=sha256:97131ab2be39043054ee28d99e09efe316e6d53449b7e962dfcf3c2de8b2b246 \ + --hash=sha256:97c6d85283629646fa87acc22c66b30ea9d4de7f6fdf887daa2e30fa041829b5 \ + --hash=sha256:9981d38a703b86f0e315a3cd229fd1906fe1d91c989ed121fb975b3c849f89f5 \ + --hash=sha256:9ad37a0be705b544af6296da8edddc260d10a8ae5462530fc9991f66498bb1f9 \ + --hash=sha256:a2ae6f53f99c9a0eca7a0afc5b4e45fc73bc1dd4ac74c00509031d76df80ed98 \ + --hash=sha256:aac0ad28c686a5e72b81668b906c030ee28050b244544b8af68e12fb32543895 \ + --hash=sha256:af3b859726cd3374287e405e14b9634563c078c5531a4f62375508addebddad1 \ + --hash=sha256:af6a90a4ed2a48fa1a2d17e9d824e6c7c950bea5bad0b707c77fd55751e6bfef \ + --hash=sha256:b002c7994cc9f2bc9d9856f0fbaee6e8072c983873846c92f25cefba5b2a925f \ + --hash=sha256:b486b5218808f6f4dc471b114b1054e63553db69705c97da0271f47bd706aedd \ + --hash=sha256:b9c6bd754d11f6e78ac54e3d86b4b11dc1ba2f13e5fc958899574532897f5a99 \ + --hash=sha256:ba10ac57884ce82112f7ed910b67e7fb6072d8ef2c06e30dc63c0f604a112e0e \ + --hash=sha256:bf5018938208d4597b2e679a4f8cff9fd252f1df53583130ae56281a21801b64 \ + --hash=sha256:c0919d1f89ddf91129906705723118ea09754171e4116f5a5dbc667c7bc9b261 \ + --hash=sha256:c5801a89604c65ab4cc9e91b23bc4076d0ca80efd8c976fb63843d7879a85d7f \ + --hash=sha256:c84af70bcf34e99aee894e46a0f1ac77f17d0ef828179c387407642e2466d28a \ + --hash=sha256:cb2829fedd672dd7107267189dabe2bbe07972801d636014417c6861eb89e358 \ + --hash=sha256:d45e06f60729e07d9b20c205f7e5cff90b6ef2584e852eecf46e045aea69627d \ + --hash=sha256:d7ca16637c0ede8243f84074044bd0b2335a0341421f8227c85756de2d18c819 \ + --hash=sha256:d8375e3da319593389727c3187ccaf3e0e84199accc530866b8e0f2b79af05e9 \ + --hash=sha256:dfa552338f51aec280f17b02d28bace1e162d1a84ccd80e3339a57f98aedb56b \ + --hash=sha256:dfef96543ced67d9513a422755db422ae1dc34dade0a1485e0b43e7342ed3ebf \ + --hash=sha256:e012177c8e8a8a0754ae0d6027d63042aa5ff036d9f40f07cb3466a6082e21b8 \ + --hash=sha256:e251126d48615e1f02b4a178f2cd0cd4f0332b8a019c01a2e10480f7552554b4 \ + --hash=sha256:e52da10236aa6212de71b9e170bace65b64b129c0dea7fc243d6c9ce976f5074 \ + --hash=sha256:eacb434410b8d9ca99a8d42352ef085cf423e3c76c1f0b86be2fcba3bff2952c \ + --hash=sha256:ebd8fd343bf8492a1e60bcb6dc99f90f74f65d98d8241a6b3e1fed225b76ecd6 \ + --hash=sha256:f0b2af76b7e7060c09e1a0dfa9410eb19369cbe6164509bff2ef94094b54d2b6 \ + --hash=sha256:f2073495a7f9b75e57e600747ac09510d67683fd64d3228e009740b7ef88f9fe \ + --hash=sha256:f4c1bca487a17fe4226b4ffb2d30e799d2b274d692cffa76bd0746f56235fca3 \ + --hash=sha256:f9fff308486bbd2c8c24f25e8e152c7594d3fe8db265a2d6a1ce24d58671127f \ + --hash=sha256:fbf1b8bb2695415b347f3727da1addca2acb82c9b97ac86bebf8b1bead1eb12d \ + --hash=sha256:feedf219672eef83ea6be6f3bb093bba396a8560fc75be85ba225f082903df0a + # via -r cr_checker/requirements.in diff --git a/cr_checker/tests/BUILD b/cr_checker/tests/BUILD index 3bc90fce..ba646c51 100644 --- a/cr_checker/tests/BUILD +++ b/cr_checker/tests/BUILD @@ -16,9 +16,21 @@ load("@score_tooling//python_basics:defs.bzl", "score_py_pytest") score_py_pytest( name = "unit_tests", srcs = [ + "conftest.py", "test_cr_checker.py", ], deps = [ "@score_tooling//cr_checker/tool:cr_checker_lib", ], ) + +score_py_pytest( + name = "integration_tests", + srcs = [ + "conftest.py", + "test_cr_checker_integration.py", + ], + deps = [ + "@score_tooling//cr_checker/tool:cr_checker_lib", + ], +) diff --git a/cr_checker/tests/conftest.py b/cr_checker/tests/conftest.py new file mode 100644 index 00000000..a6021bb0 --- /dev/null +++ b/cr_checker/tests/conftest.py @@ -0,0 +1,80 @@ +# ******************************************************************************* +# Copyright (c) 2024 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-License-Identifier: Apache-2.0 +# ******************************************************************************* + +"""Shared helpers for the cr_checker test suite (unit and integration tests). + +Kept in one place so both `test_cr_checker.py` (unit tests) and +`test_cr_checker_integration.py` (integration tests) reuse the same module +loading, template loading, and fixture-writing logic instead of each +reimplementing it. +""" + +from __future__ import annotations + +import importlib.util +import json +import subprocess +from pathlib import Path + +TESTS_DIR = Path(__file__).resolve().parent +PACKAGE_DIR = TESTS_DIR.parent +TOOL_MODULE_PATH = PACKAGE_DIR / "tool" / "cr_checker.py" + +# The real, production resource files shipped with the tool. Integration +# tests exercise these directly instead of ad-hoc fixtures, so the test suite +# validates the same configuration used by consumers of the tool. +RESOURCES_DIR = PACKAGE_DIR / "resources" +REAL_TEMPLATES_FILE = RESOURCES_DIR / "templates.ini" +REAL_CONFIG_FILE = RESOURCES_DIR / "config.json" +REAL_EXCLUSION_FILE = RESOURCES_DIR / "exclusion.txt" + + +def load_cr_checker_module(): + """Loads the cr_checker tool module directly from source.""" + spec = importlib.util.spec_from_file_location("cr_checker_module", TOOL_MODULE_PATH) + if spec is None or spec.loader is None: + raise RuntimeError(f"Failed to load cr_checker module from {TOOL_MODULE_PATH}") + + module = importlib.util.module_from_spec(spec) + spec.loader.exec_module(module) + return module + + +def load_template(extension: str) -> str: + """Returns the real copyright template configured for `extension`.""" + cr_checker = load_cr_checker_module() + templates = cr_checker.load_templates(REAL_TEMPLATES_FILE) + return templates[extension] + + +def write_config(path: Path, author: str) -> Path: + """Writes a config.json with the given author under `path`. + + Written per-test (rather than reused directly from resources/config.json) + so that the author can be varied, and so tests don't depend on the + default author staying "Contributors to the Eclipse Foundation". + """ + config_path = path / "config.json" + config_path.write_text(json.dumps({"author": author}), encoding="utf-8") + return config_path + + +def init_git_repo(path: Path) -> None: + """Initializes a throwaway git repository at `path`. + + Needed by tests that exercise `collect_inputs`/`list_tracked_files`, + which discover files via `git ls-files`. + """ + subprocess.run(["git", "init", "-q"], cwd=path, check=True) + subprocess.run(["git", "config", "user.email", "test@example.com"], cwd=path, check=True) + subprocess.run(["git", "config", "user.name", "Test"], cwd=path, check=True) diff --git a/cr_checker/tests/test_cr_checker.py b/cr_checker/tests/test_cr_checker.py index 8c76152e..cb47d2fc 100644 --- a/cr_checker/tests/test_cr_checker.py +++ b/cr_checker/tests/test_cr_checker.py @@ -14,53 +14,33 @@ # unit tests for the shebang handling in the cr_checker module from __future__ import annotations -import importlib.util -import json -import pytest +import sys from datetime import datetime from pathlib import Path +import pytest -# load the cr_checker module -def load_cr_checker_module(): - module_path = Path(__file__).resolve().parents[1] / "tool" / "cr_checker.py" - spec = importlib.util.spec_from_file_location("cr_checker_module", module_path) - if spec is None or spec.loader is None: - raise RuntimeError(f"Failed to load cr_checker module from {module_path}") - - module = importlib.util.module_from_spec(spec) - spec.loader.exec_module(module) - return module +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from conftest import load_cr_checker_module, load_template, write_config # noqa: E402 -# load the license template -def load_template(extension: str) -> str: +# test that _match_shebang consumes the shebang line but not trailing newlines +# (those are handled separately by `_match_prefix`'s `_skip_blank_lines` call) +def test_match_shebang_consumes_shebang_line(): cr_checker = load_cr_checker_module() - template_file = Path(__file__).resolve().parents[1] / "resources" / "templates.ini" - templates = cr_checker.load_templates(template_file) - return templates[extension] + consumed = cr_checker._match_shebang("#!/usr/bin/env python3\n\nprint('hi')\n") -# write the config file here so that the year is always up to date with the year -# written in the test file -def write_config(path: Path, author: str) -> Path: - config_path = path / "config.json" - config_path.write_text(json.dumps({"author": author}), encoding="utf-8") - return config_path + assert consumed == len("#!/usr/bin/env python3\n") -# test that offset matches the length of the shebang line including trailing newlines -def test_detect_shebang_offset_counts_trailing_newlines(tmp_path): +# test that _match_shebang ignores Rust's `#![...]` inner-attribute syntax +def test_match_shebang_ignores_rust_inner_attribute(): cr_checker = load_cr_checker_module() - script = tmp_path / "script.py" - script.write_text( - "#!/usr/bin/env python3\n\nprint('hi')\n", - encoding="utf-8", - ) - offset = cr_checker.detect_shebang_offset(script, "utf-8") + consumed = cr_checker._match_shebang("#![cfg_attr(not(test), no_std)]\nfn main() {}\n") - assert offset == len("#!/usr/bin/env python3\n\n".encode("utf-8")) + assert consumed == 0 @pytest.fixture( @@ -79,9 +59,11 @@ def test_detect_shebang_offset_counts_trailing_newlines(tmp_path): "bazel", "rs", "rst", + "md", + "puml", ] ) -def prepare_test_with_header(request: SubRequest, tmp_path: PosixPath) -> tuple: +def prepare_test_with_header(request, tmp_path): extension = request.param test_file = tmp_path / ("file." + extension) header_template = load_template(extension) @@ -110,9 +92,11 @@ def prepare_test_with_header(request: SubRequest, tmp_path: PosixPath) -> tuple: "bazel", "rs", "rst", + "md", + "puml", ] ) -def prepare_test_no_header(request: SubRequest, tmp_path: PosixPath) -> tuple: +def prepare_test_no_header(request, tmp_path): extension = request.param test_file = tmp_path / ("file." + extension) header_template = load_template(extension) @@ -138,7 +122,10 @@ def test_process_files_detects_header(prepare_test_with_header): remove_offset=0, ) - assert results["no_copyright"] == 0 + assert results["missing"] == 0 + assert results["misplaced"] == 0 + assert results["wrong_format"] == 0 + assert results["duplicate"] == 0 def test_process_files_detects_missing_header(prepare_test_no_header): @@ -155,7 +142,7 @@ def test_process_files_detects_missing_header(prepare_test_no_header): remove_offset=0, ) - assert results["no_copyright"] == 1 + assert results["missing"] == 1 def test_process_files_inserts_missing_header(prepare_test_no_header): @@ -175,7 +162,7 @@ def test_process_files_inserts_missing_header(prepare_test_no_header): remove_offset=0, ) - assert results["no_copyright"] == 1 + assert results["missing"] == 1 assert results["fixed"] == 1 expected_header = header_template.format(year=datetime.now().year, author="Author") assert test_file.read_text(encoding="utf-8").startswith(expected_header) @@ -189,14 +176,14 @@ def test_process_files_skips_exclusion_with_missing_header(prepare_test_no_heade [test_file], {extension: header_template}, False, - [str(test_file)], + [str(test_file.resolve())], use_mmap=False, encoding="utf-8", offset=0, remove_offset=0, ) - assert results["no_copyright"] == 0 + assert results["missing"] == 0 # test that process_files function validates a license header after the shebang line @@ -221,7 +208,9 @@ def test_process_files_accepts_header_after_shebang(tmp_path): remove_offset=0, ) - assert results["no_copyright"] == 0 + assert results["missing"] == 0 + assert results["misplaced"] == 0 + assert results["wrong_format"] == 0 # test that process_files function fixes a missing license header after the shebang line @@ -249,7 +238,7 @@ def test_process_files_fix_inserts_header_after_shebang(tmp_path): ) assert results["fixed"] == 1 - assert results["no_copyright"] == 1 + assert results["missing"] == 1 expected_header = header_template.format(year=current_year, author=author) assert script.read_text(encoding="utf-8") == ("#!/usr/bin/env python3\n" + expected_header + "\n" + "print('hi')\n") @@ -273,7 +262,7 @@ def test_process_files_accepts_header_without_shebang(tmp_path): remove_offset=0, ) - assert results["no_copyright"] == 0 + assert results["missing"] == 0 # test that process_files function fixes a missing license header without the shebang @@ -298,7 +287,7 @@ def test_process_files_fix_inserts_header_without_shebang(tmp_path): ) assert results["fixed"] == 1 - assert results["no_copyright"] == 1 + assert results["missing"] == 1 expected_header = header_template.format(year=current_year, author=author) assert script.read_text(encoding="utf-8") == expected_header + "\n" + "print('hi')\n" @@ -336,7 +325,7 @@ def test_process_files_accepts_flexible_border(tmp_path): remove_offset=0, ) - assert results["no_copyright"] == 0 + assert results["missing"] == 0 # test that a blank line after the header does not cause a check failure @@ -358,10 +347,10 @@ def test_process_files_accepts_header_with_trailing_blank_line(tmp_path): remove_offset=0, ) - assert results["no_copyright"] == 0 + assert results["missing"] == 0 -# test that fix_copyright inserts a blank line after the header +# test that fixing a missing header inserts a blank line after the header def test_process_files_fix_inserts_trailing_blank_line(tmp_path): cr_checker = load_cr_checker_module() test_file = tmp_path / "file.py" @@ -386,35 +375,36 @@ def test_process_files_fix_inserts_trailing_blank_line(tmp_path): assert test_file.read_text(encoding="utf-8").startswith(expected_header + "\n") -# test that has_duplicate_copyright detects a header that appears twice -def test_has_duplicate_copyright_detects_duplicate(tmp_path): +# --- locate_header / classify (status classification) --- + + +def test_classify_detects_duplicate(tmp_path): cr_checker = load_cr_checker_module() - test_file = tmp_path / "file.py" header_template = load_template("py") current_year = datetime.now().year header = header_template.format(year=current_year, author="Author") - test_file.write_text(header + header + "some content\n", encoding="utf-8") + content = header + header + "some content\n" - result = cr_checker.has_duplicate_copyright(test_file, header_template, False, "utf-8", 0) + layout = cr_checker.locate_header(content) + status, _ = cr_checker.classify(layout, header_template, None) - assert result is True + assert status is cr_checker.Status.DUPLICATE + assert len(layout.blocks) == 2 -# test that has_duplicate_copyright returns False for a single header -def test_has_duplicate_copyright_single_header(tmp_path): +def test_classify_accepts_single_header(tmp_path): cr_checker = load_cr_checker_module() - test_file = tmp_path / "file.py" header_template = load_template("py") current_year = datetime.now().year header = header_template.format(year=current_year, author="Author") - test_file.write_text(header + "some content\n", encoding="utf-8") + content = header + "some content\n" - result = cr_checker.has_duplicate_copyright(test_file, header_template, False, "utf-8", 0) + layout = cr_checker.locate_header(content) + status, _ = cr_checker.classify(layout, header_template, None) - assert result is False + assert status is cr_checker.Status.COMPLIANT -# test that process_files counts duplicate headers separately from missing headers def test_process_files_detects_duplicate_header(tmp_path): cr_checker = load_cr_checker_module() test_file = tmp_path / "file.py" @@ -433,19 +423,857 @@ def test_process_files_detects_duplicate_header(tmp_path): remove_offset=0, ) - assert results["duplicate_copyright"] == 1 - assert results["no_copyright"] == 0 + assert results["duplicate"] == 1 + assert results["missing"] == 0 -# test that has_duplicate_copyright detects two headers with different year ranges -def test_has_duplicate_copyright_detects_different_year_ranges(tmp_path): +def test_classify_detects_duplicate_with_different_year_ranges(tmp_path): cr_checker = load_cr_checker_module() - test_file = tmp_path / "file.py" header_template = load_template("py") header1 = header_template.format(year="2026", author="Author") header2 = header_template.format(year="2024-2026", author="Author") - test_file.write_text(header1 + header2 + "some content\n", encoding="utf-8") + content = header1 + header2 + "some content\n" + + layout = cr_checker.locate_header(content) + status, _ = cr_checker.classify(layout, header_template, None) + + assert status is cr_checker.Status.DUPLICATE + + +# --- locate_header (block span) --- + + +def test_locate_header_block_covers_whole_block(tmp_path): + """The detected block must include the border lines around the legal text + and the trailing blank line, not just the "Copyright...SPDX" text itself.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=2024, author="Author") + body = "print('hi')\n" + content = header + body + + layout = cr_checker.locate_header(content) + + assert len(layout.blocks) == 1 + block = layout.blocks[0] + assert content[block.start : block.end] == header + assert content[block.end :] == body + + +def test_locate_header_returns_no_blocks_without_copyright(tmp_path): + cr_checker = load_cr_checker_module() + content = "print('hi')\n" + + layout = cr_checker.locate_header(content) + + assert layout.blocks == [] + + +# --- classify (rapidfuzz-gated auto-fix similarity) --- + + +def test_classify_scores_formatting_drift_highly(tmp_path): + """A header that differs from the template only by a cosmetic detail + (missing angle brackets around the URL) must score well above the + auto-fix threshold, since it's the same statement, just miswritten.""" + cr_checker = load_cr_checker_module() + header_template = load_template("rs") + config_file = write_config(tmp_path, "Author") + drifted_header = header_template.format(year=2024, author="Author").replace( + "", "https://www.apache.org/licenses/LICENSE-2.0" + ) + + layout = cr_checker.locate_header(drifted_header) + status, similarity = cr_checker.classify(layout, header_template, config_file) + + assert len(layout.blocks) == 1 + assert status is cr_checker.Status.WRONG_FORMAT + assert similarity >= cr_checker.HEADER_SIMILARITY_THRESHOLD + + +def test_classify_scores_unrelated_license_low(tmp_path): + """A header for a genuinely different license must score well below the + auto-fix threshold, so `--fix` never silently overwrites it.""" + cr_checker = load_cr_checker_module() + header_template = load_template("rs") + config_file = write_config(tmp_path, "Author") + unrelated_header = ( + "// Copyright (c) 2020 Some Other Corp. All rights reserved.\n" + "// Licensed under the MIT License; see the LICENSE file for details.\n" + "//\n" + "// SPDX-License-Identifier: MIT\n" + ) + + layout = cr_checker.locate_header(unrelated_header) + status, similarity = cr_checker.classify(layout, header_template, config_file) + + assert status is cr_checker.Status.WRONG_FORMAT + assert similarity < cr_checker.HEADER_SIMILARITY_THRESHOLD + + +# --- duplicate_similarity (diagnostics for DUPLICATE status) --- + + +def test_duplicate_similarity_scores_pasted_twice_highly(tmp_path): + """The same header pasted twice (e.g. from running --fix twice) must + score well above the threshold, signalling it's safe to just delete the + extra copy.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=2024, author="Author") + content = header + header + "print('hi')\n" + + layout = cr_checker.locate_header(content) + similarity = cr_checker.duplicate_similarity(layout.blocks) + + assert similarity is not None + assert similarity >= cr_checker.HEADER_SIMILARITY_THRESHOLD + + +def test_duplicate_similarity_scores_cross_tool_headers_low(tmp_path): + """A cr_checker-style header sitting next to a leftover REUSE-style + header (structurally very different, but both matched as blocks) must + score low, signalling a manual merge is needed rather than a blind + deletion.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=2024, author="Author") + reuse_style_header = "# SPDX-FileCopyrightText: 2024 Author\n# SPDX-License-Identifier: Apache-2.0\n" + content = header + reuse_style_header + "print('hi')\n" + + layout = cr_checker.locate_header(content) + similarity = cr_checker.duplicate_similarity(layout.blocks) + + assert similarity is not None + assert similarity < cr_checker.HEADER_SIMILARITY_THRESHOLD + + +def test_duplicate_similarity_returns_none_for_single_header(tmp_path): + cr_checker = load_cr_checker_module() + header_template = load_template("py") + content = header_template.format(year=2024, author="Author") + "print('hi')\n" + + layout = cr_checker.locate_header(content) + + assert cr_checker.duplicate_similarity(layout.blocks) is None + + +# --- MISPLACED (Option A: junk-based) classification --- + + +def test_classify_detects_misplaced_correct_header(tmp_path): + """A compliant header preceded by real, unrecognized content (not a + registered preamble like a shebang) is MISPLACED, not COMPLIANT.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=datetime.now().year, author="Author") + content = "import os\n\n" + header + "print('hi')\n" + + layout = cr_checker.locate_header(content) + status, _ = cr_checker.classify(layout, header_template, None) + + assert status is cr_checker.Status.MISPLACED + assert layout.leading_junk == "import os\n\n" + + +def test_classify_detects_misplaced_and_wrong_format_header(tmp_path): + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config_file = write_config(tmp_path, "Author") + drifted_header = header_template.format(year=2024, author="Author").replace("Copyright (c)", "Copyright") + content = "import os\n\n" + drifted_header + "print('hi')\n" + + layout = cr_checker.locate_header(content) + status, _ = cr_checker.classify(layout, header_template, config_file) + + assert status is cr_checker.Status.MISPLACED_AND_WRONG_FORMAT + + +def test_process_files_fix_relocates_misplaced_header(tmp_path): + """`--fix` moves a correctly-formatted-but-misplaced header to the very + top of the file (after any recognized preamble), preserving the + unrecognized leading content immediately after it.""" + cr_checker = load_cr_checker_module() + test_file = tmp_path / "file.py" + header_template = load_template("py") + author = "Author" + config = write_config(tmp_path, author) + header = header_template.format(year=datetime.now().year, author=author) + test_file.write_text("import os\n\n" + header + "print('hi')\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=0, + ) + + assert results["misplaced"] == 1 + assert results["fixed"] == 1 + assert test_file.read_text(encoding="utf-8") == header + "\n" + "import os\n\n" + "print('hi')\n" + + +def test_classify_shebang_preamble_is_not_misplaced(tmp_path): + """A shebang is a recognized preamble (see `PREFIX_MATCHERS`), so a + compliant header right after it is COMPLIANT, not MISPLACED.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=datetime.now().year, author="Author") + content = "#!/usr/bin/env python3\n" + header + "print('hi')\n" + + layout = cr_checker.locate_header(content) + status, _ = cr_checker.classify(layout, header_template, None) + + assert status is cr_checker.Status.COMPLIANT + assert layout.leading_junk == "" + + +# --- COPYRIGHT_BLOCK_PATTERN precision (avoid false-positive "blocks") ----- + + +def test_copyright_block_pattern_requires_colon_after_spdx_identifier(): + """A plain-English mention of both keywords (no ``: `` tag) must + not be mistaken for an actual SPDX header block -- otherwise a comment + merely *describing* copyright/SPDX handling (e.g. in this tool's own + source, or a docstring) is treated as a real header.""" + cr_checker = load_cr_checker_module() + text = "# Copyright note: see SPDX-License-Identifier handling below\nbody\n" + + assert cr_checker.COPYRIGHT_BLOCK_PATTERN.search(text) is None + layout = cr_checker.locate_header(text) + assert layout.blocks == [] + + +def test_copyright_block_pattern_rejects_gap_beyond_max(): + """ "Copyright" and "SPDX-License-Identifier: ..." separated by more than + `COPYRIGHT_BLOCK_MAX_GAP` characters of unrelated content must not be + stitched together into a single block -- that gap is far larger than any + real template, so it can only be two unrelated mentions.""" + cr_checker = load_cr_checker_module() + filler = "x" * (cr_checker.COPYRIGHT_BLOCK_MAX_GAP + 50) + text = f"Copyright (c) 2024 Author\n{filler}\nSPDX-License-Identifier: Apache-2.0\n" + + assert cr_checker.COPYRIGHT_BLOCK_PATTERN.search(text) is None + + +def test_copyright_block_pattern_matches_within_max_gap(): + """A real template's gap (well under `COPYRIGHT_BLOCK_MAX_GAP`) must + still match -- the tightened pattern isn't so strict it breaks real + headers.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=2024, author="Author") + + assert cr_checker.COPYRIGHT_BLOCK_PATTERN.search(header) is not None + + +# --- normalize_header / classify duplicate-window consistency (data loss) -- + + +def test_fix_preserves_body_with_coincidental_deep_mention(tmp_path): + """Regression test: a fixable (wrong-format, high-similarity) header at + the top of the file, followed far later by a line that merely mentions + "Copyright" and "SPDX-License-Identifier" in prose (no real second + header), must not cause `--fix` to delete everything in between. This + previously happened because `_find_blocks` matched the deep mention as a + second "block", and `normalize_header` deleted through the *last* block + found anywhere in the file instead of only the in-window one(s) + `classify` actually used.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + # Same statement, missing "(c)" -- a formatting drift, not a different + # license, so it scores above HEADER_SIMILARITY_THRESHOLD and is fixable. + drifted_header = header_template.format(year=2024, author="Author").replace("Copyright (c)", "Copyright") + filler = "x = 1\n" * 200 + deep_mention = "# Copyright note: see SPDX-License-Identifier handling below\n" + test_file = tmp_path / "file.py" + test_file.write_text(drifted_header + filler + deep_mention + "y = 2\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=0, + ) + + fixed = test_file.read_text(encoding="utf-8") + assert results["fixed"] == 1 + assert "x = 1\n" * 200 in fixed + assert deep_mention in fixed + assert fixed.endswith("y = 2\n") + + +def test_normalize_header_leaves_out_of_window_block_untouched(tmp_path): + """Direct unit test of the fix: `normalize_header` must only ever delete + through the last block within the duplicate-detection window, never a + block further into the file -- even if `_find_blocks` did somehow match + one (e.g. a genuine second, unrelated SPDX tag far past the real + header).""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=2024, author="Author").replace("Copyright (c)", "Copyright") + filler = "x = 1\n" * 200 + far_header = "# Copyright (c) 2020 Example Corp\n# SPDX-License-Identifier: MIT\n" + content = header + filler + far_header + "y = 2\n" + + layout = cr_checker.locate_header(content) + assert len(layout.blocks) == 2 # the far, genuinely-SPDX-shaped block is still detected... + + new_text = cr_checker.normalize_header(content, layout, header_template, None) + + # ...but must survive verbatim in the rewritten output, since it's + # outside the duplicate-detection window `classify` used to decide this + # was a single fixable header, not the header itself. + assert filler in new_text + assert far_header in new_text + assert new_text.endswith("y = 2\n") + + +# --- --remove-offset --------------------------------------------------------- + + +def test_process_files_fix_removes_offset_before_inserting_header(tmp_path): + """`remove_offset` strips the given number of characters from the very + start of the file (e.g. an old, invalid header) before the new header is + inserted -- the removed text must not reappear anywhere in the result.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + old_header = "# OLD INVALID HEADER\n# more junk\n" + body = "print('hi')\n" + test_file = tmp_path / "file.py" + test_file.write_text(old_header + body, encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=len(old_header), + ) + + fixed = test_file.read_text(encoding="utf-8") + expected_header = header_template.format(year=datetime.now().year, author="Author") + assert results["fixed"] == 1 + assert "OLD INVALID HEADER" not in fixed + assert fixed == expected_header + "\n" + body + + +def test_process_files_check_mode_ignores_remove_offset(tmp_path): + """`remove_offset` only applies in `--fix` mode (see `process_files`'s + docstring); a check-only run must not be affected by it at all.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=datetime.now().year, author="Author") + test_file = tmp_path / "file.py" + test_file.write_text(header + "print('hi')\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + False, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=5, + ) + + assert results["missing"] == 0 + assert test_file.read_text(encoding="utf-8") == header + "print('hi')\n" + + +# --- --force (bypass the similarity guard) ----------------------------------- + + +def test_process_files_fix_without_force_leaves_low_similarity_header_untouched(tmp_path): + """Baseline: a WRONG_FORMAT header that scores below + `HEADER_SIMILARITY_THRESHOLD` (a genuinely different license, not just a + formatting drift) must be left alone by `--fix` without `--force`.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + unrelated_header = ( + "# Copyright (c) 2020 Some Other Corp. All rights reserved.\n" + "# Licensed under the MIT License; see the LICENSE file for details.\n" + "#\n" + "# SPDX-License-Identifier: MIT\n" + ) + test_file = tmp_path / "file.py" + test_file.write_text(unrelated_header + "print('hi')\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + ) + + assert results["fixed"] == 0 + assert results["wrong_format"] == 1 + assert test_file.read_text(encoding="utf-8") == unrelated_header + "print('hi')\n" + + +def test_process_files_fix_force_rewrites_low_similarity_header(tmp_path): + """With `force=True`, the same low-similarity header IS rewritten -- + `--force` is an explicit, opt-in override of the similarity guard.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + unrelated_header = ( + "# Copyright (c) 2020 Some Other Corp. All rights reserved.\n" + "# Licensed under the MIT License; see the LICENSE file for details.\n" + "#\n" + "# SPDX-License-Identifier: MIT\n" + ) + test_file = tmp_path / "file.py" + test_file.write_text(unrelated_header + "print('hi')\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + force=True, + ) + + expected_header = header_template.format(year=datetime.now().year, author="Author") + fixed = test_file.read_text(encoding="utf-8") + assert results["fixed"] == 1 + assert "Some Other Corp" not in fixed + assert fixed == expected_header + "\n" + "print('hi')\n" + + +def test_process_files_fix_force_does_not_touch_duplicate(tmp_path): + """`force` only bypasses the *similarity* guard for WRONG_FORMAT / + MISPLACED_AND_WRONG_FORMAT; DUPLICATE is not in `FIXABLE_STATUSES` at + all and must still be left for manual review even with `force=True`.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + header = header_template.format(year=2024, author="Author") + content = header + header + "print('hi')\n" + test_file = tmp_path / "file.py" + test_file.write_text(content, encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + force=True, + ) + + assert results["fixed"] == 0 + assert results["duplicate"] == 1 + assert test_file.read_text(encoding="utf-8") == content + + +def test_process_files_check_mode_ignores_force(tmp_path): + """`force` only applies in `--fix` mode; a check-only run must not be + affected by it at all (no similarity gate exists in check mode to begin + with).""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + unrelated_header = ( + "# Copyright (c) 2020 Some Other Corp. All rights reserved.\n" + "# Licensed under the MIT License; see the LICENSE file for details.\n" + "#\n" + "# SPDX-License-Identifier: MIT\n" + ) + test_file = tmp_path / "file.py" + test_file.write_text(unrelated_header + "print('hi')\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + False, + config=config, + use_mmap=False, + encoding="utf-8", + force=True, + ) + + assert results["fixed"] == 0 + assert results["wrong_format"] == 1 + assert test_file.read_text(encoding="utf-8") == unrelated_header + "print('hi')\n" + + +# --- old-style comment-wrapper debris (regression: orphaned /.. ) ---- + + +def test_is_old_wrapper_prefix_recognizes_bare_html_comment_opener(): + """A bare `` line left over from an older md header (whose closing + marker wasn't folded onto the border, unlike the current template) must + be dropped from the remainder, not preserved as orphaned content.""" + cr_checker = load_cr_checker_module() + md_template = load_template("md") + + remainder = cr_checker._strip_old_wrapper_suffix("-->\n\n# Heading\n", md_template) + + assert remainder == "# Heading\n" + + +def test_strip_old_wrapper_suffix_preserves_genuine_content(): + """Real content right after the header must be left alone.""" + cr_checker = load_cr_checker_module() + md_template = load_template("md") + + remainder = cr_checker._strip_old_wrapper_suffix("# Heading\n", md_template) + + assert remainder == "# Heading\n" + + +def test_process_files_fix_force_rewrites_old_style_md_header_cleanly(tmp_path): + """Regression test for a real bug: a `.md` file with an OLDER header + style -- content wrapped in a single ```` HTML comment with + an asterisk border, rather than the current template's dash-border-with- + inline-```` style -- must, after a forced `--fix`, end up + with exactly ONE clean header and no orphaned ```` fragment + left over from the old wrapper (previously, the leftover bare ```` leaked into the body untouched, producing a dangling empty + HTML comment right after the real one).""" + cr_checker = load_cr_checker_module() + md_template = load_template("md") + config = write_config(tmp_path, "Author") + old_style_header = ( + "\n" + ) + test_file = tmp_path / "file.md" + test_file.write_text(old_style_header + "\n# Heading\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"md": md_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + force=True, + ) + + fixed = test_file.read_text(encoding="utf-8") + expected_header = md_template.format(year=datetime.now().year, author="Author") + assert results["fixed"] == 1 + assert fixed == expected_header + "\n# Heading\n" + assert fixed.count("") == 1 + + +def test_process_files_fix_force_rewrites_old_style_rst_header_cleanly(tmp_path): + """Regression test for a real bug: an `.rst` file with an OLDER header + style -- just a bare ``..`` marker followed by plain indented text with + no ``#``-per-line/border formatting at all -- must, after a forced + `--fix`, end up with exactly ONE ``..`` marker (previously, the bare + ``..`` -- not recognized as part of the header block since it doesn't + look like a border-fill line -- was reported as "leading junk" and + blindly re-appended after the new header, which already starts with its + own ``..``, producing a duplicate ``..`` line between the header and the + following heading).""" + cr_checker = load_cr_checker_module() + rst_template = load_template("rst") + config = write_config(tmp_path, "Author") + old_style_header = ( + "..\n" + " Copyright (c) 2026 Contributors to the Eclipse Foundation\n" + "\n" + " See the NOTICE file(s) distributed with this work for additional\n" + " information regarding copyright ownership.\n" + "\n" + " This program and the accompanying materials are made available under the\n" + " terms of the Apache License Version 2.0 which is available at\n" + " https://www.apache.org/licenses/LICENSE-2.0\n" + "\n" + " SPDX-License-Identifier: Apache-2.0\n" + ) + test_file = tmp_path / "file.rst" + test_file.write_text(old_style_header + "\nHeading\n=======\n", encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"rst": rst_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + force=True, + ) + + fixed = test_file.read_text(encoding="utf-8") + expected_header = rst_template.format(year=datetime.now().year, author="Author") + assert results["fixed"] == 1 + assert fixed == expected_header + "\nHeading\n=======\n" + assert fixed.count("..\n") == 1 + + +# --- --offset (manual preamble override) ------------------------------------ + + +def test_locate_header_manual_offset_protects_unrecognized_preamble(): + """`--offset` force-treats the given number of characters (plus any + trailing blank lines) as a recognized preamble, even for content + `PREFIX_MATCHERS` doesn't know about (e.g. a custom marker) -- so a + compliant header right after it is COMPLIANT, not MISPLACED.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=datetime.now().year, author="Author") + marker = "@@CUSTOM_MARKER@@\n" + content = marker + header + "print('hi')\n" + + # Without --offset, the marker is unrecognized junk -> MISPLACED. + layout_auto = cr_checker.locate_header(content) + status_auto, _ = cr_checker.classify(layout_auto, header_template, None) + assert status_auto is cr_checker.Status.MISPLACED + + # With --offset covering exactly the marker, it's a protected preamble. + layout_manual = cr_checker.locate_header(content, manual_prefix_offset=len(marker)) + status_manual, _ = cr_checker.classify(layout_manual, header_template, None) + assert status_manual is cr_checker.Status.COMPLIANT + assert layout_manual.leading_junk == "" + assert layout_manual.prefix_kind == "manual" + + +def test_process_files_fix_with_offset_inserts_header_after_marker(tmp_path): + """End-to-end: `--offset` also drives `--fix`, inserting the new header + immediately after the forced preamble length rather than at char 0.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + marker = "@@CUSTOM_MARKER@@\n" + body = "print('hi')\n" + test_file = tmp_path / "file.py" + test_file.write_text(marker + body, encoding="utf-8") + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + offset=len(marker), + remove_offset=0, + ) + + expected_header = header_template.format(year=datetime.now().year, author="Author") + fixed = test_file.read_text(encoding="utf-8") + assert results["fixed"] == 1 + assert fixed == marker + expected_header + "\n" + body + + +# --- CRLF line endings ------------------------------------------------------- + + +def test_process_files_accepts_compliant_header_with_crlf(tmp_path): + """A file using CRLF line endings throughout (header included) must be + recognized as compliant -- `_normalize_line_endings`/`_restore_line_endings` + exist precisely so CRLF files aren't misdiagnosed just because templates + and regexes are LF-based internally.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=datetime.now().year, author="Author") + content_lf = header + "print('hi')\n" + test_file = tmp_path / "file.py" + test_file.write_bytes(content_lf.replace("\n", "\r\n").encode("utf-8")) + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + False, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=0, + ) + + assert results["missing"] == 0 + + +def test_process_files_fix_preserves_crlf_line_endings(tmp_path): + """`--fix` on a CRLF file must insert a CRLF-terminated header and leave + the rest of the file CRLF throughout -- never a mix of `\\n` and `\\r\\n`.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + body_lf = "print('hi')\n" + test_file = tmp_path / "file.py" + test_file.write_bytes(body_lf.replace("\n", "\r\n").encode("utf-8")) + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=0, + ) + + fixed_bytes = test_file.read_bytes() + fixed_text = fixed_bytes.decode("utf-8") + assert results["fixed"] == 1 + assert "\r\n" in fixed_text + # No bare LF anywhere -- every line ending must be CRLF (a legitimate + # blank line, i.e. two consecutive "\n", correctly becomes "\r\n\r\n", + # which -- as an inherent, harmless side effect -- does contain the + # substring "\n\r"; the real invariant is that nothing but CRLF pairs + # remains once every "\r\n" occurrence is stripped out). + assert fixed_text.replace("\r\n", "").count("\n") == 0 + assert fixed_text.endswith("print('hi')\r\n") + + +# --- BOM handling ------------------------------------------------------------- + + +def test_process_files_accepts_compliant_header_with_bom(tmp_path): + """A leading UTF-8 BOM must not make an otherwise-compliant header look + missing (see `_strip_bom`'s docstring).""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + header = header_template.format(year=datetime.now().year, author="Author") + test_file = tmp_path / "file.py" + test_file.write_bytes(("\ufeff" + header + "print('hi')\n").encode("utf-8")) + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + False, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=0, + ) + + assert results["missing"] == 0 + + +def test_process_files_fix_preserves_leading_bom(tmp_path): + """`--fix` on a file with a leading BOM must restore the BOM verbatim at + the very start of the rewritten file (see `_process_file_fix`'s + `had_bom` handling), not drop or duplicate it.""" + cr_checker = load_cr_checker_module() + header_template = load_template("py") + config = write_config(tmp_path, "Author") + body = "print('hi')\n" + test_file = tmp_path / "file.py" + test_file.write_bytes(("\ufeff" + body).encode("utf-8")) + + results = cr_checker.process_files( + [test_file], + {"py": header_template}, + True, + config=config, + use_mmap=False, + encoding="utf-8", + offset=0, + remove_offset=0, + ) + + fixed_bytes = test_file.read_bytes() + expected_header = header_template.format(year=datetime.now().year, author="Author") + assert results["fixed"] == 1 + assert fixed_bytes.startswith("\ufeff".encode("utf-8")) + fixed_text = fixed_bytes.decode("utf-8") + assert fixed_text == "\ufeff" + expected_header + "\n" + body + assert fixed_text.count("\ufeff") == 1 + + +# --- _atomic_write failure cleanup ------------------------------------------- + + +def test_atomic_write_removes_temp_file_on_failure(tmp_path, monkeypatch): + """If the final rename/move fails partway (disk full, permissions, + ...), `_atomic_write` must not leave a stray temp file behind in the + target directory, and the original file must remain untouched.""" + cr_checker = load_cr_checker_module() + target = tmp_path / "file.txt" + target.write_text("original\n", encoding="utf-8") + + def _boom(*_args, **_kwargs): + raise OSError("simulated disk failure") + + monkeypatch.setattr(cr_checker.shutil, "move", _boom) + + with pytest.raises(OSError): + cr_checker._atomic_write(target, "new content\n", "utf-8") + + assert target.read_text(encoding="utf-8") == "original\n" + leftover = [p for p in tmp_path.iterdir() if p != target] + assert leftover == [] + + +def test_atomic_write_succeeds_and_leaves_no_temp_file(tmp_path): + """Sanity check for the happy path: the temp file used during the write + must not remain once `_atomic_write` returns successfully.""" + cr_checker = load_cr_checker_module() + target = tmp_path / "file.txt" + target.write_text("original\n", encoding="utf-8") - result = cr_checker.has_duplicate_copyright(test_file, header_template, False, "utf-8", 0) + cr_checker._atomic_write(target, "new content\n", "utf-8") - assert result is True + assert target.read_text(encoding="utf-8") == "new content\n" + leftover = [p for p in tmp_path.iterdir() if p != target] + assert leftover == [] diff --git a/cr_checker/tests/test_cr_checker_integration.py b/cr_checker/tests/test_cr_checker_integration.py new file mode 100644 index 00000000..fdcba49f --- /dev/null +++ b/cr_checker/tests/test_cr_checker_integration.py @@ -0,0 +1,580 @@ +# ******************************************************************************* +# 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-License-Identifier: Apache-2.0 +# ******************************************************************************* + +"""End-to-end / integration tests for the cr_checker tool. + +Unlike `test_cr_checker.py` (unit tests calling individual functions), these +tests exercise the tool the way real consumers do: + +* through the CLI entry point (`main`), not individual helper functions; +* against the *real* shipped `resources/templates.ini`, `config.json` and + `exclusion.txt`, across every distinct comment style they define; +* against real files from this repository (dogfooding), and against a real + (throwaway) git repository for the git-based file discovery path. +""" + +from __future__ import annotations + +import subprocess +import sys +from datetime import datetime +from pathlib import Path + +import pytest + +sys.path.insert(0, str(Path(__file__).resolve().parent)) +from conftest import ( # noqa: E402 + PACKAGE_DIR, + REAL_CONFIG_FILE, + REAL_EXCLUSION_FILE, + REAL_TEMPLATES_FILE, + TOOL_MODULE_PATH, + init_git_repo, + load_cr_checker_module, + load_template, + write_config, +) + +REPO_ROOT = PACKAGE_DIR.parent + + +# --- CLI smoke tests: exit code contract ----------------------------------- + + +def test_main_returns_zero_when_all_files_compliant(tmp_path): + cr_checker = load_cr_checker_module() + config_file = write_config(tmp_path, "Author") + header = load_template("py").format(year=datetime.now().year, author="Author") + test_file = tmp_path / "compliant.py" + test_file.write_text(header + "print('hi')\n", encoding="utf-8") + + exit_code = cr_checker.main(["-t", str(REAL_TEMPLATES_FILE), "-c", str(config_file), str(test_file)]) + + assert exit_code == 0 + + +def test_main_returns_one_when_header_missing(tmp_path): + cr_checker = load_cr_checker_module() + config_file = write_config(tmp_path, "Author") + test_file = tmp_path / "missing.py" + test_file.write_text("print('hi')\n", encoding="utf-8") + + exit_code = cr_checker.main(["-t", str(REAL_TEMPLATES_FILE), "-c", str(config_file), str(test_file)]) + + assert exit_code == 1 + + +def test_main_returns_two_on_unreadable_template(tmp_path): + cr_checker = load_cr_checker_module() + missing_template = tmp_path / "does_not_exist.ini" + test_file = tmp_path / "file.py" + test_file.write_text("print('hi')\n", encoding="utf-8") + + exit_code = cr_checker.main(["-t", str(missing_template), str(test_file)]) + + assert exit_code == 2 + + +# --- Different comment signs: fix + check cycle across every real style ---- + +# One representative extension per distinct comment style declared in the +# real templates.ini: "/* */" (cpp family), "#" (py family), "//" (rs), +# "'" (puml), "" (md) and the indented ".." (rst). +COMMENT_STYLE_SAMPLES = { + "cpp": ("sample.cpp", "int main() { return 0; }\n", "/*"), + "py": ("sample.py", "print('hello')\n", "#"), + "rs": ("sample.rs", "fn main() {}\n", "//"), + "puml": ("sample.puml", "@startuml\n@enduml\n", "'"), + "md": ("sample.md", "# Heading\n", "`` left over from an older md header written before + the wrapper was folded onto the border lines) that `_find_blocks`'s + border-adjacency scan didn't absorb into the block. Symmetric + counterpart to `_is_old_wrapper_prefix` for the closing side -- checks + whether the candidate line is a suffix of the *current* template's own + last line. A no-op when `remainder` doesn't start with such a fragment. + """ + newline_idx = remainder.find("\n") + first_line = remainder if newline_idx == -1 else remainder[: newline_idx + 1] + stripped = first_line.strip() + if not stripped or any(ch.isalnum() for ch in stripped): + return remainder + last_template_line = template.splitlines()[-1] if template else "" + if not last_template_line.endswith(stripped): + return remainder + return remainder[len(first_line) :].lstrip("\n") + +def classify(layout, template, config): + """Classifies a file's header state from its `HeaderLayout`. -def collect_inputs(inputs, exts=None): + Args: + layout (HeaderLayout): The result of `locate_header`. + template (str): The copyright template the header should match. + config (Path | None): Path to the config JSON file, used to render + the template's placeholders for comparison. + + Returns: + tuple(Status, float | None): the status, and (when there's exactly + one block to score) the rapidfuzz similarity (0-100) between that + block and the rendered template -- used both for the + WRONG_FORMAT/MISPLACED_AND_WRONG_FORMAT diagnostic and to gate + whether `--fix` may safely rewrite it. None for MISSING/DUPLICATE, + which have no single block to score. + + Note: + Only blocks starting within ``2 * len(template)`` characters of + ``layout.prefix_end`` count toward DUPLICATE detection -- the same + window the original implementation used -- so that a copyright-shaped + mention deep inside a docstring/comment/string literal further into + the file (e.g. an example header, or literally this module's own + ``COPYRIGHT_BLOCK_PATTERN`` regex source) isn't mistaken for a + duplicate of a real header near the top. """ - Collects files from a list of input paths, optionally filtering by file extensions. + if not layout.blocks: + return Status.MISSING, None + + blocks_in_window = _blocks_in_duplicate_window(layout, template) + if len(blocks_in_window) > 1: + return Status.DUPLICATE, None + + block = layout.blocks[0] + rendered = template.format(year=datetime.now().year, author=get_author_from_config(config)) + template_regex = compile_template_regex(template) + + # Some templates have a literal, non-border prefix line before the + # border itself (e.g. the RST comment marker ".." before the "# ****" + # border), which `_find_blocks`'s border-adjacency scan -- deliberately + # template-agnostic -- doesn't recognize and so reports as + # `leading_junk`. Before treating it as genuine misplaced content, check + # whether the junk plus the block together are actually just the + # template's own (longer) literal prefix. + if layout.leading_junk: + extended = layout.leading_junk + block.text + if template_regex.match(extended): + return Status.COMPLIANT, fuzz.ratio(extended, rendered) + + similarity = fuzz.ratio(block.text, rendered) + correct_format = bool(template_regex.match(block.text)) + misplaced = bool(layout.leading_junk) and not _is_old_wrapper_prefix(layout.leading_junk, template) + + if correct_format and not misplaced: + return Status.COMPLIANT, similarity + if correct_format and misplaced: + return Status.MISPLACED, similarity + if misplaced: + return Status.MISPLACED_AND_WRONG_FORMAT, similarity + return Status.WRONG_FORMAT, similarity + + +def duplicate_similarity(blocks): + """ + Best-effort rapidfuzz similarity (0-100) between the two most similar + detected blocks, for diagnostics only. + + `classify`'s DUPLICATE trigger is simply "more than one block found" -- + by design, cross-tool duplicates such as a leftover REUSE-style header + sitting next to a cr_checker one are structurally very different, so + gating *detection* on similarity would regress that case. This helper + only *describes* what was found, for the log message: a high score means + the same header was likely pasted twice (safe to just delete the extra + copy); a low score means two structurally different header blocks are + present (e.g. a REUSE/cr_checker leftover pair), which need a manual + merge rather than a blind deletion. Args: - inputs (list): A list of paths to files or directories. - If a directory is provided, all files within it are added to the output. - exts (list, optional): A list of file extensions to filter by (e.g., ['.py', '.txt']). - Only files with these extensions will be included if specified. + blocks (list[Block]): The blocks found by `locate_header`. Returns: - list: A list of file paths collected from the input paths, filtered by the given extensions. - If an input is neither a file nor a directory, it is skipped with a warning. + float | None: The highest pairwise similarity among the blocks, or + None if fewer than two were found. + """ + if len(blocks) < 2: + return None + return max(fuzz.ratio(a.text, b.text) for i, a in enumerate(blocks) for b in blocks[i + 1 :]) - Logs: - Logs messages at the DEBUG level, detailing processing of directories and files, - and warns if an invalid input path is encountered. + +def extension_key(path): + """Returns the template/extension-filter lookup key for `path`. + + The key is the file extension without the leading dot; the extension-less + ``BUILD`` file is special-cased to use its literal name instead. This is + the single source of truth for that rule, shared by template lookup + (`process_files`) and extension filtering (`_matches_extension`). """ - all_files = [] - LOGGER.debug("Extensions: %s", exts) - for i in inputs: - item = Path(i) - if item.is_dir(): - LOGGER.debug("Processing directory: %s", item) - all_files.extend(get_files_from_dir(item, exts)) - elif item.is_file() and (exts is None or item.suffix[1:] in exts or (item.name == "BUILD" and "BUILD" in exts)): - LOGGER.debug("Processing file: %s", item) - all_files.append(item) - elif item.is_file(): - LOGGER.debug("Skipped (no configuration for file extension): %s", item) - else: - LOGGER.warning("Skipped (input is not a valid file or directory): %s", item) - return all_files + path = Path(path) + return path.name if path.name == "BUILD" else path.suffix[1:] -def create_temp_file(path, encoding): +def _matches_extension(path, exts): + """Returns whether ``path`` should be considered for the given extension filter. + + ``exts`` is the list passed via ``--extensions``. ``None`` means "no filter". """ - Creates a temporary file with the provided content. + if exts is None: + return True + return extension_key(path) in exts + + +def list_tracked_files(base_dir, pathspecs=None): + """Lists repository files via ``git ls-files`` under ``base_dir``. + + Uses git as the source of truth for "which files exist in the repo": + + * ``--cached --others --exclude-standard`` yields tracked plus untracked + files while honoring ``.gitignore`` (so Bazel ``bazel-*`` convenience + symlinks and other generated artifacts are skipped automatically). + * git does not respect Bazel package boundaries, so a single call reaches + files in nested packages without any per-package configuration. Args: - path (str): The path of file to write the content to the temporary file. - encoding (str, optional): Encoding type to use when writing the file. + base_dir (str): Repository root to run git in. + pathspecs (list, optional): git pathspecs (directories or globs) to + restrict the listing. ``None`` lists the + whole repository. Returns: - str: The path to the temporary file created. + list[Path]: Absolute paths to the listed files. """ - with tempfile.NamedTemporaryFile(mode="w", encoding=encoding, delete=False) as temp: - with open(path, "r", encoding=encoding) as handle: - for chunk in iter(lambda: handle.read(4096), ""): - temp.write(chunk) - return temp.name + cmd = [ + "git", + "-C", + str(base_dir), + "ls-files", + "-z", + "--cached", + "--others", + "--exclude-standard", + ] + if pathspecs: + cmd.append("--") + cmd.extend(pathspecs) + + LOGGER.debug("Listing files with: %s", " ".join(cmd)) + result = subprocess.run(cmd, capture_output=True, check=True) + base = Path(base_dir) + return [base / os.fsdecode(rel) for rel in result.stdout.split(b"\0") if rel] + + +def list_modified_files(base_dir): + """Lists files added, copied, modified, or renamed relative to ``HEAD``. + + Used by ``--modified-only`` for fast, incremental runs (e.g. a + pre-commit hook) that should only check what's actually changing, + instead of the whole repository. Compares the working tree directly to + ``HEAD`` (not just the index), so it covers both staged and unstaged + changes to tracked files, plus new files once they're staged (`git + diff` never reports a file it has no record of at all, i.e. a brand + new file that was never `git add`ed); deleted files are excluded since + there's nothing left to check. This matches how pre-commit itself only + ever hands hooks the files staged for the commit. + Args: + base_dir (str): Repository root to run git in. -def remove_old_header(file_path, encoding, num_of_chars): + Returns: + list[Path]: Absolute paths to the modified files. """ - Removes the first `num_of_chars` characters from a file and updates it in-place. + cmd = [ + "git", + "-C", + str(base_dir), + "diff", + "--name-only", + "--diff-filter=ACMR", + "-z", + "HEAD", + ] + + LOGGER.debug("Listing modified files with: %s", " ".join(cmd)) + result = subprocess.run(cmd, capture_output=True, check=True) + base = Path(base_dir) + return [base / os.fsdecode(rel) for rel in result.stdout.split(b"\0") if rel] + + +def collect_inputs(inputs, exts=None, base_dir=None): + """Collects files to check from the given inputs, filtered by extension. + + Existing files are taken as-is; every other input is treated as a git + pathspec (a directory or glob) resolved via ``list_tracked_files``. When + ``inputs`` is empty the whole repository is listed. Args: - file_path (str): Path to the file to be modified. - encoding (str): Encoding used to read and write the file. - num_of_chars (int): Number of characters to remove from the beginning of the file. + inputs (list): Files and/or git pathspecs (relative to ``base_dir``). + exts (list, optional): Extensions to keep (see ``_matches_extension``). + base_dir (str, optional): Repository root. Defaults to the current + working directory. - Raises: - IOError: If there is an issue reading or writing the file. - ValueError: If `num_of_chars` is negative. + Returns: + list[Path]: The files to check. """ - with open(file_path, "r", encoding=encoding) as file: - file.seek(num_of_chars) - with tempfile.NamedTemporaryFile("w", delete=False, encoding=encoding) as temp_file: - shutil.copyfileobj(file, temp_file) - shutil.move(temp_file.name, file_path) + base = Path(base_dir) if base_dir else Path.cwd() + LOGGER.debug("Extensions: %s", exts) + explicit_files = [] + pathspecs = [] + for i in inputs: + candidate = Path(i) + absolute = candidate if candidate.is_absolute() else base / candidate + if absolute.is_file(): + explicit_files.append(absolute) + else: + pathspecs.append(i) + + candidates = list(explicit_files) + if pathspecs or not inputs: + candidates.extend(list_tracked_files(base, pathspecs or None)) + + collected = [] + seen = set() + for path in candidates: + if path.is_symlink() or not path.is_file(): + continue + # An explicit file and an overlapping directory/pathspec (e.g. a file + # passed both directly and via its parent directory) can list the + # same path twice; de-duplicate so it isn't processed more than once. + resolved = path.resolve() + if resolved in seen: + continue + if _matches_extension(path, exts): + seen.add(resolved) + collected.append(path) + else: + LOGGER.debug("Skipped (no configuration for file extension): %s", path) + return collected -def fix_copyright(path, copyright_text, encoding, offset, config=None) -> bool: - """ - Inserts a copyright header into the specified file, ensuring that existing - content is preserved according to the provided offset. + +def render_template(template, config): + """Renders `template`'s `{year}`/`{author}` placeholders. Args: - path (str): The path to the file that needs the copyright header. - copyright_text (str): The copyright text to be added. - encoding (str): The character encoding used to read and write the file. - offset (int): The number of bytes to preserve at the top of the file. - If 0, the first line is overwritten unless it's empty. - For non-zero offsets, ensures the correct number of bytes - are preserved. - config (Path): Path to the config JSON file where configuration - variables are stored (e.g. years for copyright headers). + template (str): The copyright template text. + config (Path | None): Path to the config JSON file (see + `get_author_from_config`). + Returns: - bool: True if the copyright header was successfully added, False if there was an error + str: The rendered header text. """ + return template.format(year=datetime.now().year, author=get_author_from_config(config)) + + +def _atomic_write(path, content, encoding): + """Writes `content` to `path` atomically. - temporary_file = create_temp_file(path, encoding) + Builds the full replacement in a temp file in the same directory as + `path`, then renames it over the original -- so a crash/interrupt mid-write + (disk full, process killed, ...) never leaves `path` truncated or + partially written, unlike writing into `path` in-place. The temp file is + always cleaned up: moved into place on success, removed on failure. - with open(temporary_file, "r", encoding=encoding) as temp: - first_line = temp.readline() - byte_array = len(first_line.encode(encoding)) + Args: + path (str): Path to the file to (re)write. + content (str): The full new content of the file. + encoding (str): Encoding to use when writing. + """ + directory = os.path.dirname(os.path.abspath(path)) or "." + descriptor, tmp_name = tempfile.mkstemp(dir=directory) + try: + with os.fdopen(descriptor, "w", encoding=encoding, newline="") as handle: + handle.write(content) + shutil.move(tmp_name, path) + except BaseException: + with contextlib.suppress(OSError): + os.remove(tmp_name) + raise + + +def normalize_header(text, layout, template, config): + """Rebuilds `text` with a single, correctly rendered copyright header + placed immediately after the recognized preamble (see `locate_header`). + + Every block within the duplicate-detection window (see + `_blocks_in_duplicate_window` -- the same blocks `classify` treats as + "the header") is dropped. Any block further into the file is left + completely untouched, as ordinary body content: it was never counted as + part of the header for classification either, so deleting through it + would silently destroy unrelated content (e.g. a coincidental + "Copyright...SPDX-License-Identifier:" mention deep in a docstring or + example). `leading_junk` -- real content that isn't the recognized + preamble and isn't a copyright block -- is preserved, but relocated to + *after* the new header. This one routine resolves MISSING, MISPLACED, + WRONG_FORMAT and MISPLACED_AND_WRONG_FORMAT alike, replacing what used + to be a strip-then-reinsert composition of two separate functions. - if offset > 0 and offset != byte_array: - LOGGER.error("%s: Invalid offset value: %d, expected: %d", path, offset, byte_array) - return False + Args: + text (str): The decoded, BOM-stripped, LF-normalized whole file + content (the caller restores the original line ending + style and BOM on write). + layout (HeaderLayout): The result of `locate_header` for `text`. + template (str): The copyright template to render. + config (Path | None): Path to the config JSON file. - with open(path, "w", encoding=encoding) as handle: - temp.seek(0) - if offset > 0: - handle.write(first_line) - temp.seek(offset) - handle.write(copyright_text.format(year=datetime.now().year, author=get_author_from_config(config)) + "\n") - for chunk in iter(lambda: temp.read(4096), ""): - handle.write(chunk) - LOGGER.info("Fixed missing header in: %s", path) - return True + Returns: + str: The rebuilt, LF-normalized file content. + """ + prefix = text[: layout.prefix_end] + kept_blocks = _blocks_in_duplicate_window(layout, template) + remainder_start = kept_blocks[-1].end if kept_blocks else layout.prefix_end + remainder = _strip_old_wrapper_suffix(text[remainder_start:].lstrip("\n"), template) + + # `leading_junk` is dropped rather than preserved-after-header when it's + # just a leftover fragment of an OLD-style header's own comment-wrapper + # marker (see `_is_old_wrapper_prefix`) -- `render_template` already + # emits the *current* template's own complete wrapper, so re-appending + # this debris after it would create a duplicate/orphaned fragment + # instead of preserving genuinely misplaced content. + leading_junk = "" if _is_old_wrapper_prefix(layout.leading_junk, template) else layout.leading_junk + + parts = [prefix, render_template(template, config), "\n"] + if leading_junk: + parts.append(leading_junk) + if not leading_junk.endswith("\n"): + parts.append("\n") + parts.append(remainder) + return "".join(parts) + + +def _tally(status, results): + """Bumps the appropriate counter in `results` for a classified `status` + (see `process_files`'s return value docs). COMPLIANT contributes + nothing.""" + if status is Status.MISSING: + results["missing"] += 1 + elif status is Status.DUPLICATE: + results["duplicate"] += 1 + elif status is Status.MISPLACED: + results["misplaced"] += 1 + elif status in (Status.WRONG_FORMAT, Status.MISPLACED_AND_WRONG_FORMAT): + results["wrong_format"] += 1 + + +def _log_status(item, status, layout, similarity): + """Logs a diagnostic message for a classified `status`.""" + if status is Status.COMPLIANT: + LOGGER.debug("File %s has copyright.", item) + elif status is Status.MISSING: + LOGGER.error("Missing copyright header in: %s, use --fix to introduce it", item) + elif status is Status.MISPLACED: + LOGGER.error( + "Copyright header in %s is correctly formatted but preceded by other content " + "(similarity: %.0f%%); use --fix to move it to the top", + item, + similarity, + ) + elif status is Status.MISPLACED_AND_WRONG_FORMAT: + LOGGER.error( + "Copyright header in %s is preceded by other content and doesn't match the " + "expected format (similarity to template: %.0f%%)", + item, + similarity, + ) + elif status is Status.WRONG_FORMAT: + LOGGER.error( + "Wrong copyright format in: %s (similarity to template: %.0f%%), expected format from template", + item, + similarity, + ) + elif status is Status.DUPLICATE: + similarity = duplicate_similarity(layout.blocks) + if similarity is None: + LOGGER.error("Duplicate copyright header in: %s", item) + elif similarity >= HEADER_SIMILARITY_THRESHOLD: + LOGGER.error( + "Duplicate copyright header in: %s (repeated headers are %.0f%% similar -- " + "likely the same header pasted twice)", + item, + similarity, + ) + else: + LOGGER.error( + "Duplicate copyright header in: %s (repeated headers are only %.0f%% similar -- " + "likely different header formats/tools; review both before merging)", + item, + similarity, + ) + + +def _process_file_check(item, template, encoding, offset, use_mmap, config, results): + """Read-only path: classifies the file's header state and logs/tallies it.""" + header_window = max(BYTES_TO_READ, 2 * len(template)) + raw = load_header_text(item, header_window, encoding, use_mmap) + text, _ = _strip_bom(raw) + text = _normalize_line_endings(text) + + layout = locate_header(text, manual_prefix_offset=offset) + status, similarity = classify(layout, template, config) + _log_status(item, status, layout, similarity) + _tally(status, results) + + +def _process_file_fix(item, template, encoding, offset, remove_offset, config, results, force=False): + """Mutating path: classifies the file's header state, logs/tallies it, and + -- for any `FIXABLE_STATUSES` result that passes the similarity guard (or + `force`, which bypasses it) -- rewrites the file with `normalize_header`, + atomically.""" + with open(item, "r", encoding=encoding, newline="") as handle: + raw = handle.read() + + if remove_offset: + raw = raw[remove_offset:] + + text, had_bom = _strip_bom(raw) + line_ending = _detect_line_ending(text) + text = _normalize_line_endings(text) + + layout = locate_header(text, manual_prefix_offset=offset) + status, similarity = classify(layout, template, config) + _log_status(item, status, layout, similarity) + _tally(status, results) + + if status not in FIXABLE_STATUSES: + return + if ( + not force + and status in (Status.WRONG_FORMAT, Status.MISPLACED_AND_WRONG_FORMAT) + and similarity < HEADER_SIMILARITY_THRESHOLD + ): + # Likely an unrelated, genuinely different license text -- never + # silently overwritten, unless the caller explicitly opted in via + # --force. + return + + new_text = normalize_header(text, layout, template, config) + new_text = _restore_line_endings(new_text, line_ending) + if had_bom: + new_text = BOM + new_text + _atomic_write(item, new_text, encoding) + results["fixed"] += 1 + LOGGER.info("Fixed (%s) header in: %s", status.value, item) def process_files( files, templates, fix, - exclusion=[], + exclusion=None, config=None, use_mmap=False, encoding="utf-8", offset=0, remove_offset=0, + force=False, ): # pylint: disable=too-many-arguments """ Processes a list of files to check for the presence of copyright text. @@ -603,53 +1169,67 @@ def process_files( config (Path): Path to the config JSON file where configuration variables are stored (e.g. years for copyright headers). use_mmap (bool): Flag for using mmap function for reading files - (instead of standard option). + (instead of standard option); ignored in ``--fix`` + mode, which always reads the whole file. encoding (str): Encoding type to use when reading the file. - offset (int): Additional number of characters to read beyond the length - of `copyright_text`, used to account for extra content - (such as a shebang) before the copyright text. - remove_offset(int): Flag for removing old header from source files - (before applying the new one) in number of chars. + offset (int): Number of characters to force-treat as a recognized + preamble (see `locate_header`), overriding + auto-detection. Typically only needed for preamble + kinds `PREFIX_MATCHERS` doesn't recognize. + remove_offset(int): Number of characters to remove from the very + start of the file before processing, in + ``--fix`` mode only. + force (bool): Bypass the ``HEADER_SIMILARITY_THRESHOLD`` guard for + WRONG_FORMAT/MISPLACED_AND_WRONG_FORMAT, rewriting the + header regardless of how different it looks from the + template. Only used in ``--fix`` mode. Never applies to + DUPLICATE, which is always left for manual review. Returns: - int: The number of files that do not contain the required copyright text. + dict: Counters for ``missing``, ``misplaced``, ``wrong_format``, + ``duplicate`` and ``fixed``. + + Note: + A wrong-format or misplaced-and-wrong-format header is only + auto-fixed if its rapidfuzz similarity to the rendered template is + at or above ``HEADER_SIMILARITY_THRESHOLD`` -- i.e. it looks like + the same copyright statement with a formatting difference (border + style, missing angle brackets, a typo, ...) -- unless ``force`` is + set, in which case the similarity is ignored. Otherwise it is left + untouched and only reported, since it may be a genuinely different + license text that must never be silently overwritten. Duplicate + headers are never auto-fixed, regardless of similarity or ``force``. """ - results = {"no_copyright": 0, "fixed": 0, "duplicate_copyright": 0} + if exclusion is None: + exclusion = [] + results = {"missing": 0, "misplaced": 0, "wrong_format": 0, "duplicate": 0, "fixed": 0} + for item in files: - name = Path(item).name - key = name if name == "BUILD" else Path(item).suffix[1:] - if key not in templates.keys(): - logging.debug("Skipped (no configuration for selected file extension): %s", item) + key = extension_key(item) + if key not in templates: + LOGGER.debug("Skipped (no configuration for selected file extension): %s", item) continue - if str(item) in exclusion: - logging.debug("Skipped due to exclusion: %s", item) + if str(Path(item).resolve()) in exclusion: + LOGGER.debug("Skipped due to exclusion: %s", item) continue if os.path.getsize(item) == 0: # No need to add copyright headers to empty files continue - # Automatically detect shebang and use its offset if no manual offset provided - shebang_offset = detect_shebang_offset(item, encoding) - effective_offset = offset + shebang_offset if offset == 0 else offset - - if has_duplicate_copyright(item, templates[key], use_mmap, encoding, effective_offset): - LOGGER.error("Duplicate copyright header in: %s", item) - results["duplicate_copyright"] += 1 - elif not has_copyright(item, templates[key], use_mmap, encoding, effective_offset, config): - if has_any_copyright(item, use_mmap, encoding, effective_offset): - LOGGER.warning("Wrong copyright format in: %s, expected format from template", item) - elif fix: - if remove_offset: - remove_old_header(item, encoding, remove_offset) - fix_result = fix_copyright(item, templates[key], encoding, effective_offset, config) - results["no_copyright"] += 1 - if fix_result: - results["fixed"] += 1 + template = templates[key] + try: + if fix: + _process_file_fix(item, template, encoding, offset, remove_offset, config, results, force) else: - LOGGER.error("Missing copyright header in: %s, use --fix to introduce it", item) - results["no_copyright"] += 1 + _process_file_check(item, template, encoding, offset, use_mmap, config, results) + except (IOError, OSError, UnicodeError) as err: + # A single unreadable/undecodable file (permissions, binary + # content matched by an over-broad -e filter, ...) shouldn't + # abort the whole batch -- log it and keep going. + LOGGER.error("Failed to process %s: %s", item, err) + return results @@ -729,7 +1309,9 @@ def parse_arguments(argv): dest="offset", type=int, default=0, - help="Additional length offset to account for characters like a shebang (default is 0)", + help="Force this many characters (plus any trailing blank lines) at the start of the " + "file to be treated as a recognized preamble (e.g. a shebang), overriding " + "auto-detection. Character-based, not byte-based. Default: auto-detect (0).", ) parser.add_argument( @@ -741,11 +1323,32 @@ def parse_arguments(argv): (supported only with --fix mode)", ) + parser.add_argument( + "--force", + dest="force", + action="store_true", + help="With --fix, also rewrite WRONG_FORMAT/MISPLACED_AND_WRONG_FORMAT headers whose " + "similarity to the template is below HEADER_SIMILARITY_THRESHOLD (normally left " + "untouched since they may be a genuinely different license text). Never affects " + "DUPLICATE, which always requires manual review. Ignored without --fix.", + ) + parser.add_argument( "inputs", - nargs="+", + nargs="*", action=ParamFileAction, - help="Directories and/or files to parse.", + help="Files and/or directories to check. When omitted, the whole repository (per 'git ls-files') is checked.", + ) + + parser.add_argument( + "--modified-only", + dest="modified_only", + action="store_true", + help="Only check files that differ from HEAD (staged and/or unstaged), " + "e.g. for a fast, incremental pre-commit run. Takes precedence " + "over 'inputs' (including any 'srcs' pathspec baked into a " + "Bazel target's args), so the same whole-repo target used by CI " + "can be reused for incremental, modified-files-only runs.", ) return parser.parse_args(argv) @@ -764,32 +1367,61 @@ def main(argv=None): If `None`, defaults to `sys.argv[1:]`. Returns: - int: Error code if an IOError occurs during loading templates or collecting input files; - otherwise, returns 0 as success. + int: ``0`` if all files are compliant, ``1`` if violations were found, + ``2`` if the tool failed to run (e.g. unreadable inputs). """ - args = parse_arguments(argv if argv is not None else sys.argv[1:]) + try: + args = parse_arguments(argv if argv is not None else sys.argv[1:]) + except (IOError, OSError) as err: + LOGGER.error("Failed to parse arguments: %s", err) + return 2 configure_logging(args.log_file, args.verbose) try: templates = load_templates(args.template_file) except IOError as err: LOGGER.error("Failed to load copyright text: %s", err) - return err.errno + return 2 + + if args.config_file: + try: + get_author_from_config(args.config_file) + except (IOError, OSError, ValueError) as err: + LOGGER.error("Failed to load config file: %s", err) + return 2 exclusion = [] exclusion_valid = True + workspace = os.environ.get("BUILD_WORKSPACE_DIRECTORY") if args.exclusion_file: try: - exclusion, exclusion_valid = load_exclusion(args.exclusion_file) + exclusion, exclusion_valid = load_exclusion(args.exclusion_file, workspace) except IOError as err: LOGGER.error("Failed to load exclusion list: %s", err) - return err.errno - + return 2 + + # When invoked via ``bazel run`` the process runs inside the runfiles tree, but + # the files to check live in the user's workspace. ``git ls-files``/``git diff`` + # (used by ``collect_inputs``/``list_modified_files``) are run from + # ``BUILD_WORKSPACE_DIRECTORY`` so the checker operates on the real source + # tree, honoring ``.gitignore`` (which excludes the ``bazel-*`` convenience + # symlinks) and reaching nested Bazel packages. try: - files = collect_inputs(args.inputs, args.extensions) - except IOError as err: - LOGGER.error("Failed to process file %s with error", err.filename) - return err.errno + if args.modified_only: + base_dir = workspace or Path.cwd() + files = [ + f + for f in list_modified_files(base_dir) + if not f.is_symlink() and f.is_file() and _matches_extension(f, args.extensions) + ] + else: + files = collect_inputs(args.inputs, args.extensions, workspace) + except (IOError, subprocess.SubprocessError) as err: + LOGGER.error("Failed to collect input files: %s", err) + return 2 + + if not files: + LOGGER.warning("No files matched the configured extensions/inputs; nothing to check.") LOGGER.debug("Running check on files: %s", files) @@ -799,6 +1431,12 @@ def main(argv=None): LOGGER.info("Use ONLY if invalid copyright header is present that needs to be removed!") LOGGER.info("%s!-----------------------!%s", COLORS["RED"], COLORS["ENDC"]) + if args.fix and args.force: + LOGGER.info("%s!------DANGER ZONE------!%s", COLORS["RED"], COLORS["ENDC"]) + LOGGER.info("Force set! Headers with low similarity to the template will be overwritten too!") + LOGGER.info("Review the diff afterwards -- this can rewrite genuinely different license text!") + LOGGER.info("%s!-----------------------!%s", COLORS["RED"], COLORS["ENDC"]) + results = process_files( files, templates, @@ -809,17 +1447,33 @@ def main(argv=None): args.encoding, args.offset, args.remove_offset, + args.force, ) - total_no = results["no_copyright"] + total_missing = results["missing"] + total_misplaced = results["misplaced"] + total_wrong_format = results["wrong_format"] + total_duplicates = results["duplicate"] total_fixes = results["fixed"] - total_duplicates = results["duplicate_copyright"] + total_violations = total_missing + total_misplaced + total_wrong_format + total_duplicates LOGGER.info("=" * 64) LOGGER.info("Process completed.") LOGGER.info( - "Total files without copyright: %s%d%s", - COLORS["RED"] if total_no > 0 else COLORS["GREEN"], - total_no, + "Total files missing a copyright header: %s%d%s", + COLORS["RED"] if total_missing > 0 else COLORS["GREEN"], + total_missing, + COLORS["ENDC"], + ) + LOGGER.info( + "Total files with a misplaced (but correctly formatted) header: %s%d%s", + COLORS["RED"] if total_misplaced > 0 else COLORS["GREEN"], + total_misplaced, + COLORS["ENDC"], + ) + LOGGER.info( + "Total files with a wrong-format header: %s%d%s", + COLORS["RED"] if total_wrong_format > 0 else COLORS["GREEN"], + total_wrong_format, COLORS["ENDC"], ) LOGGER.info( @@ -831,7 +1485,7 @@ def main(argv=None): if not exclusion_valid: LOGGER.info("The exclusion file contains paths that do not exist.") if args.fix: - total_not_fixed = total_no - total_fixes + total_not_fixed = total_violations - total_fixes LOGGER.info( "Total files that were fixed: %s%d%s", COLORS["GREEN"], @@ -846,7 +1500,7 @@ def main(argv=None): ) LOGGER.info("=" * 64) - return 0 if (total_no == 0 and total_duplicates == 0 and exclusion_valid) else 1 + return 0 if (total_violations == 0 and exclusion_valid) else 1 if __name__ == "__main__": diff --git a/defs.bzl b/defs.bzl index a5234786..c90e26f9 100644 --- a/defs.bzl +++ b/defs.bzl @@ -19,9 +19,6 @@ load("//cli_helper:cli_helper.bzl", _cli_helper = "cli_helper") # --- coverage --- load("//coverage:coverage.bzl", _rust_coverage_report = "rust_coverage_report") -# --- cr_checker --- -load("//cr_checker:cr_checker.bzl", _copyright_checker = "copyright_checker") - # --- dash --- load("//dash:dash.bzl", _dash_license_checker = "dash_license_checker") @@ -45,7 +42,6 @@ load( score_virtualenv = _score_virtualenv score_py_pytest = _score_py_pytest dash_license_checker = _dash_license_checker -copyright_checker = _copyright_checker cli_helper = _cli_helper setup_starpls = _setup_starpls rust_coverage_report = _rust_coverage_report From d18feb8932af4aca3c42e29f6e679962913d9538 Mon Sep 17 00:00:00 2001 From: Jochen Hoenle <173445474+hoe-jo@users.noreply.github.com> Date: Thu, 30 Jul 2026 16:57:07 +0200 Subject: [PATCH 2/3] fix copyright --- README.md | 15 +++++++++---- .../rules_score/docs/tool_qualification.rst | 22 ++++++++++--------- .../rules_score/examples/seooc/docs/BUILD | 12 +++++----- coverage/README.md | 15 +++++++++---- .../integration_test/test_framework.rs | 6 ++--- cpp/libclang/src/main.rs | 7 +++--- cpp/libclang/src/utils/lib.rs | 7 +++--- cpp/libclang/src/utils/render.rs | 7 +++--- cpp/libclang/src/utils/write.rs | 7 +++--- .../src/visitor/src/class_parser_helper.rs | 7 +++--- .../visitor/src/class_parser_helper_test.rs | 6 ++--- cpp/libclang/src/visitor/src/class_visitor.rs | 7 +++--- .../src/visitor/src/class_visitor_test.rs | 6 ++--- cpp/libclang/src/visitor/src/context.rs | 7 +++--- cpp/libclang/src/visitor/src/enum_visitor.rs | 7 +++--- .../src/visitor/src/function_visitor.rs | 6 ++--- cpp/libclang/src/visitor/src/lib.rs | 6 ++--- cpp/libclang/src/visitor/src/visitor.rs | 7 +++--- third_party/docs_runtime/README.md | 20 ++++++++--------- .../class_diagram.puml | 7 +++--- .../negative_class_missing/class_diagram.puml | 6 +++-- .../class_diagram.puml | 4 +++- .../negative_enum_literal_mismatch/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../negative_enum_literal_missing/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../negative_method_mismatch/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../negative_method_mismatch/transport.cpp | 8 +++++++ .../negative_method_missing/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../negative_method_missing/transport.cpp | 8 +++++++ .../negative_method_modifier_mismatch/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../expected.yaml | 9 ++++++++ .../transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../expected.yaml | 9 ++++++++ .../transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../negative_method_visibility_mismatch/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../negative_relationship_missing/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../class_diagram.puml | 4 +++- .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../negative_type_alias_mismatch/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../negative_type_alias_missing/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../negative_type_alias_missing/transport.cpp | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../negative_variable_mismatch/transport.cpp | 8 +++++++ .../negative_variable_static_mismatch/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../positive_class_features/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../positive_class_features/transport.cpp | 8 +++++++ .../positive_method_features/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../positive_method_features/transport.cpp | 8 +++++++ .../BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../positive_relationship_features/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../transport.cpp | 8 +++++++ .../positive_variable_features/BUILD | 8 +++++++ .../class_diagram.puml | 10 +++++++++ .../positive_variable_features/transport.cpp | 8 +++++++ 93 files changed, 722 insertions(+), 84 deletions(-) diff --git a/README.md b/README.md index faa9cba9..2e151be3 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,15 @@ - + 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-License-Identifier: Apache-2.0 +----------------------------------------------------------------------------- --> # Score Tooling diff --git a/bazel/rules/rules_score/docs/tool_qualification.rst b/bazel/rules/rules_score/docs/tool_qualification.rst index 0fba2557..9c926119 100644 --- a/bazel/rules/rules_score/docs/tool_qualification.rst +++ b/bazel/rules/rules_score/docs/tool_qualification.rst @@ -1,14 +1,16 @@ .. - 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-License-Identifier: Apache-2.0 + # ******************************************************************************* + # 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-License-Identifier: Apache-2.0 + # ******************************************************************************* Tool Qualification ================== diff --git a/bazel/rules/rules_score/examples/seooc/docs/BUILD b/bazel/rules/rules_score/examples/seooc/docs/BUILD index d0fb80d4..23a8993d 100644 --- a/bazel/rules/rules_score/examples/seooc/docs/BUILD +++ b/bazel/rules/rules_score/examples/seooc/docs/BUILD @@ -1,9 +1,3 @@ -load( - "@score_tooling//bazel/rules/rules_score:rules_score.bzl", - "assumptions_of_use", - "glossary", -) - # ******************************************************************************* # Copyright (c) 2026 Contributors to the Eclipse Foundation # @@ -16,6 +10,12 @@ load( # # SPDX-License-Identifier: Apache-2.0 # ******************************************************************************* + +load( + "@score_tooling//bazel/rules/rules_score:rules_score.bzl", + "assumptions_of_use", + "glossary", +) load("@trlc//:trlc.bzl", "trlc_requirements_test") assumptions_of_use( diff --git a/coverage/README.md b/coverage/README.md index f428dd1a..2b7fcff9 100644 --- a/coverage/README.md +++ b/coverage/README.md @@ -1,8 +1,15 @@ - + 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-License-Identifier: Apache-2.0 +----------------------------------------------------------------------------- --> # Coverage diff --git a/cpp/libclang/integration_test/test_framework.rs b/cpp/libclang/integration_test/test_framework.rs index abeed7be..1e31e25e 100644 --- a/cpp/libclang/integration_test/test_framework.rs +++ b/cpp/libclang/integration_test/test_framework.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,10 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* use std::{path::PathBuf, str::FromStr}; diff --git a/cpp/libclang/src/main.rs b/cpp/libclang/src/main.rs index c887d989..82bfb3c0 100644 --- a/cpp/libclang/src/main.rs +++ b/cpp/libclang/src/main.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use clap::Parser as ClapParser; use env_logger::Builder; use log::{debug, error, LevelFilter}; diff --git a/cpp/libclang/src/utils/lib.rs b/cpp/libclang/src/utils/lib.rs index 30065d5d..0824fae5 100644 --- a/cpp/libclang/src/utils/lib.rs +++ b/cpp/libclang/src/utils/lib.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + mod render; mod write; diff --git a/cpp/libclang/src/utils/render.rs b/cpp/libclang/src/utils/render.rs index d8bba080..9a4a23a1 100644 --- a/cpp/libclang/src/utils/render.rs +++ b/cpp/libclang/src/utils/render.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use clang::{Entity, EntityKind, EntityVisitResult}; pub fn render_entity_tree(entity: &Entity, level: usize) -> String { diff --git a/cpp/libclang/src/utils/write.rs b/cpp/libclang/src/utils/write.rs index e7eee7dd..b451670f 100644 --- a/cpp/libclang/src/utils/write.rs +++ b/cpp/libclang/src/utils/write.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use log::{debug, error}; use serde::Serialize; use std::fs; diff --git a/cpp/libclang/src/visitor/src/class_parser_helper.rs b/cpp/libclang/src/visitor/src/class_parser_helper.rs index a714b907..28d37688 100644 --- a/cpp/libclang/src/visitor/src/class_parser_helper.rs +++ b/cpp/libclang/src/visitor/src/class_parser_helper.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + #![cfg_attr(test, allow(dead_code))] use clang::{Entity, EntityKind, Type, TypeKind}; diff --git a/cpp/libclang/src/visitor/src/class_parser_helper_test.rs b/cpp/libclang/src/visitor/src/class_parser_helper_test.rs index 728d0793..a2b70fb6 100644 --- a/cpp/libclang/src/visitor/src/class_parser_helper_test.rs +++ b/cpp/libclang/src/visitor/src/class_parser_helper_test.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,10 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* #[path = "class_parser_helper.rs"] mod class_parser_helper; diff --git a/cpp/libclang/src/visitor/src/class_visitor.rs b/cpp/libclang/src/visitor/src/class_visitor.rs index cfca7f66..14c22eb6 100644 --- a/cpp/libclang/src/visitor/src/class_visitor.rs +++ b/cpp/libclang/src/visitor/src/class_visitor.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use clang::{Entity, EntityKind}; use std::collections::HashSet; diff --git a/cpp/libclang/src/visitor/src/class_visitor_test.rs b/cpp/libclang/src/visitor/src/class_visitor_test.rs index 0eee96d4..6968cead 100644 --- a/cpp/libclang/src/visitor/src/class_visitor_test.rs +++ b/cpp/libclang/src/visitor/src/class_visitor_test.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,10 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* use class_diagram::{RelationType, SimpleEntity, SourceLocation}; use visit_tu::context::{ diff --git a/cpp/libclang/src/visitor/src/context.rs b/cpp/libclang/src/visitor/src/context.rs index 84ad5da9..bc4f4911 100644 --- a/cpp/libclang/src/visitor/src/context.rs +++ b/cpp/libclang/src/visitor/src/context.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use serde::{Deserialize, Serialize}; use std::collections::HashMap; diff --git a/cpp/libclang/src/visitor/src/enum_visitor.rs b/cpp/libclang/src/visitor/src/enum_visitor.rs index 10e7d702..e359a470 100644 --- a/cpp/libclang/src/visitor/src/enum_visitor.rs +++ b/cpp/libclang/src/visitor/src/enum_visitor.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use crate::class_visitor::parse_source_location; use crate::context::VisitContext; use crate::visitor::AstVisitor; diff --git a/cpp/libclang/src/visitor/src/function_visitor.rs b/cpp/libclang/src/visitor/src/function_visitor.rs index a9fc2e92..60777e98 100644 --- a/cpp/libclang/src/visitor/src/function_visitor.rs +++ b/cpp/libclang/src/visitor/src/function_visitor.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,10 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* //! Visits C++ method entities via libclang and populates [`VisitContext::functions`]. //! diff --git a/cpp/libclang/src/visitor/src/lib.rs b/cpp/libclang/src/visitor/src/lib.rs index e31a8249..382b767a 100644 --- a/cpp/libclang/src/visitor/src/lib.rs +++ b/cpp/libclang/src/visitor/src/lib.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,10 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* mod class_parser_helper; mod class_visitor; diff --git a/cpp/libclang/src/visitor/src/visitor.rs b/cpp/libclang/src/visitor/src/visitor.rs index 469eb875..3734a680 100644 --- a/cpp/libclang/src/visitor/src/visitor.rs +++ b/cpp/libclang/src/visitor/src/visitor.rs @@ -1,4 +1,4 @@ -/////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* // Copyright (c) 2026 Contributors to the Eclipse Foundation // // See the NOTICE file(s) distributed with this work for additional @@ -6,10 +6,11 @@ // // 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-License-Identifier: Apache-2.0 -//////////////////////////////////////////////////////////////////////////////////// +// ******************************************************************************* + use crate::class_visitor::ClassVisitor; use crate::context::VisitContext; use crate::enum_visitor::EnumVisitor; diff --git a/third_party/docs_runtime/README.md b/third_party/docs_runtime/README.md index 2949fa6c..2b0b8206 100644 --- a/third_party/docs_runtime/README.md +++ b/third_party/docs_runtime/README.md @@ -1,17 +1,15 @@ - + SPDX-License-Identifier: Apache-2.0 +----------------------------------------------------------------------------- --> # Hermetic graphviz for docs (`docs_runtime` + `exec_in_sysroot`) diff --git a/validation/core/integration_test/class_design_implementation/negative_class_member_missing/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_class_member_missing/class_diagram.puml index bbd7f4cc..c440d1d7 100644 --- a/validation/core/integration_test/class_design_implementation/negative_class_member_missing/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_class_member_missing/class_diagram.puml @@ -1,14 +1,15 @@ - -' Copyright (c) 2025 Contributors to the Eclipse Foundation +' ******************************************************************************* +' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_class_missing/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_class_missing/class_diagram.puml index 96c4251a..ec771cda 100644 --- a/validation/core/integration_test/class_design_implementation/negative_class_missing/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_class_missing/class_diagram.puml @@ -1,13 +1,15 @@ -' Copyright (c) 2025 Contributors to the Eclipse Foundation +' ******************************************************************************* +' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/class_diagram.puml index 3f7d8a51..c5199ca6 100644 --- a/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/class_diagram.puml @@ -1,3 +1,4 @@ +' ******************************************************************************* ' Copyright (c) 2026 Contributors to the Eclipse Foundation ' ' See the NOTICE file(s) distributed with this work for additional @@ -5,9 +6,10 @@ ' ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/class_diagram.puml index 00343051..d4b2783a 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/transport.cpp index 8d4c1ed4..d2f7f14b 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/BUILD b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/class_diagram.puml index a115ece5..e56ca7a8 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/transport.cpp index 42cd726d..6ec05219 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/class_diagram.puml index 73f64b91..fea1af14 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/transport.cpp index 41438dd3..b8b08499 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_missing/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_missing/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_missing/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_missing/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_missing/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_missing/class_diagram.puml index c1b64145..14a53d4d 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_missing/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_missing/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_missing/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_missing/transport.cpp index 2b20d6aa..be3b207a 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_missing/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_missing/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/class_diagram.puml index 2aed8b99..ccc2b8c3 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml index 504cebd2..bc9e1aa8 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml @@ -1,6 +1,15 @@ +# ******************************************************************************* # 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-License-Identifier: Apache-2.0 +# ******************************************************************************* should_pass: false error_contains: | Implementation class data differs from unit design entity: diff --git a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/transport.cpp index 5db54717..e553fee6 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/class_diagram.puml index 8b98efcd..9052bf56 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml index 59e89688..31feeee3 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml @@ -1,6 +1,15 @@ +# ******************************************************************************* # 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-License-Identifier: Apache-2.0 +# ******************************************************************************* should_pass: false error_contains: | Implementation class data differs from unit design entity: diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/transport.cpp index 14818166..b08b78de 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/class_diagram.puml index 7074a5d4..dae456e4 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/transport.cpp index 946fe7a5..dafc00b2 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/class_diagram.puml index 8b98efcd..9052bf56 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/transport.cpp index 3fc447e6..6bcc8545 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/class_diagram.puml index 8b98efcd..9052bf56 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/transport.cpp index 5f496c5a..2a113044 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_variadic_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/class_diagram.puml index 2aed8b99..ccc2b8c3 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/transport.cpp index d3f84d88..192049c8 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/BUILD b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/class_diagram.puml index 43b9fbcd..f0944339 100644 --- a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/transport.cpp index 167c03c3..92e6a45a 100644 --- a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/class_diagram.puml index 82164c7d..b0467651 100644 --- a/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/class_diagram.puml @@ -1,3 +1,4 @@ +' ******************************************************************************* ' Copyright (c) 2026 Contributors to the Eclipse Foundation ' ' See the NOTICE file(s) distributed with this work for additional @@ -5,9 +6,10 @@ ' ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/class_diagram.puml index 579d699e..a5bcc37a 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/transport.cpp index 82d2366e..1b6e424d 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/class_diagram.puml index 9fea712b..6d367071 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/transport.cpp index f1ea2d52..79fd1d91 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/class_diagram.puml index 4e0be002..f6d5fe89 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/transport.cpp index 2c6ba353..3502a8bb 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/BUILD b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/class_diagram.puml index 4e0be002..f6d5fe89 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/transport.cpp index 47dbfe2c..c9b72fd9 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/class_diagram.puml index 7191d03e..7c6c8dca 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/transport.cpp index 1845ac96..b676eb81 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/class_diagram.puml index 7191d03e..7c6c8dca 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/transport.cpp index b476d48c..47f2dc8c 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/BUILD b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/BUILD +++ b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/class_diagram.puml b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/class_diagram.puml index 7191d03e..7c6c8dca 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/transport.cpp b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/transport.cpp index 27509d88..7e26c7ea 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/positive_class_features/BUILD b/validation/core/integration_test/class_design_implementation/positive_class_features/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/positive_class_features/BUILD +++ b/validation/core/integration_test/class_design_implementation/positive_class_features/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/positive_class_features/class_diagram.puml b/validation/core/integration_test/class_design_implementation/positive_class_features/class_diagram.puml index 78edd550..34c70910 100644 --- a/validation/core/integration_test/class_design_implementation/positive_class_features/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/positive_class_features/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/positive_class_features/transport.cpp b/validation/core/integration_test/class_design_implementation/positive_class_features/transport.cpp index cd448881..9aae7ddf 100644 --- a/validation/core/integration_test/class_design_implementation/positive_class_features/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/positive_class_features/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/positive_method_features/BUILD b/validation/core/integration_test/class_design_implementation/positive_method_features/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/positive_method_features/BUILD +++ b/validation/core/integration_test/class_design_implementation/positive_method_features/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/positive_method_features/class_diagram.puml b/validation/core/integration_test/class_design_implementation/positive_method_features/class_diagram.puml index 4c430c18..f5f7a97e 100644 --- a/validation/core/integration_test/class_design_implementation/positive_method_features/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/positive_method_features/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/positive_method_features/transport.cpp b/validation/core/integration_test/class_design_implementation/positive_method_features/transport.cpp index 8ee196c4..d083f14a 100644 --- a/validation/core/integration_test/class_design_implementation/positive_method_features/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/positive_method_features/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/BUILD b/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/BUILD +++ b/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/class_diagram.puml b/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/class_diagram.puml index 749c318d..5bc77943 100644 --- a/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/transport.cpp b/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/transport.cpp index 2d87fde5..45f6015f 100644 --- a/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/positive_method_template_pack_features/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/positive_relationship_features/BUILD b/validation/core/integration_test/class_design_implementation/positive_relationship_features/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/positive_relationship_features/BUILD +++ b/validation/core/integration_test/class_design_implementation/positive_relationship_features/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/positive_relationship_features/class_diagram.puml b/validation/core/integration_test/class_design_implementation/positive_relationship_features/class_diagram.puml index 7ed8f55b..495217e3 100644 --- a/validation/core/integration_test/class_design_implementation/positive_relationship_features/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/positive_relationship_features/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/positive_relationship_features/transport.cpp b/validation/core/integration_test/class_design_implementation/positive_relationship_features/transport.cpp index 4523cbdd..0dec5b91 100644 --- a/validation/core/integration_test/class_design_implementation/positive_relationship_features/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/positive_relationship_features/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ diff --git a/validation/core/integration_test/class_design_implementation/positive_variable_features/BUILD b/validation/core/integration_test/class_design_implementation/positive_variable_features/BUILD index 7c27590b..c3206a03 100644 --- a/validation/core/integration_test/class_design_implementation/positive_variable_features/BUILD +++ b/validation/core/integration_test/class_design_implementation/positive_variable_features/BUILD @@ -1,5 +1,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-License-Identifier: Apache-2.0 # ******************************************************************************* diff --git a/validation/core/integration_test/class_design_implementation/positive_variable_features/class_diagram.puml b/validation/core/integration_test/class_design_implementation/positive_variable_features/class_diagram.puml index 5c1831a8..1ac7e0c7 100644 --- a/validation/core/integration_test/class_design_implementation/positive_variable_features/class_diagram.puml +++ b/validation/core/integration_test/class_design_implementation/positive_variable_features/class_diagram.puml @@ -1,5 +1,15 @@ +' ******************************************************************************* ' 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-License-Identifier: Apache-2.0 +' ******************************************************************************* @startuml diff --git a/validation/core/integration_test/class_design_implementation/positive_variable_features/transport.cpp b/validation/core/integration_test/class_design_implementation/positive_variable_features/transport.cpp index 0c50f5b4..e8ea2729 100644 --- a/validation/core/integration_test/class_design_implementation/positive_variable_features/transport.cpp +++ b/validation/core/integration_test/class_design_implementation/positive_variable_features/transport.cpp @@ -1,5 +1,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-License-Identifier: Apache-2.0 ********************************************************************************/ From 2ad524ad7c83dcf5fb321a27a43b3e53c2887ba1 Mon Sep 17 00:00:00 2001 From: Jochen Hoenle <173445474+hoe-jo@users.noreply.github.com> Date: Thu, 30 Jul 2026 17:49:36 +0200 Subject: [PATCH 3/3] fix wrong source line in test cases --- .../negative_class_member_missing/expected.yaml | 2 +- .../negative_class_missing/expected.yaml | 2 +- .../negative_entity_type_mismatch/expected.yaml | 2 +- .../negative_enum_literal_mismatch/expected.yaml | 4 ++-- .../negative_enum_literal_missing/expected.yaml | 2 +- .../negative_method_mismatch/expected.yaml | 4 ++-- .../negative_method_missing/expected.yaml | 2 +- .../negative_method_modifier_mismatch/expected.yaml | 4 ++-- .../negative_method_parameter_count_mismatch/expected.yaml | 4 ++-- .../negative_method_parameter_name_mismatch/expected.yaml | 4 ++-- .../negative_method_parameter_type_mismatch/expected.yaml | 4 ++-- .../negative_method_visibility_mismatch/expected.yaml | 4 ++-- .../negative_relationship_missing/expected.yaml | 2 +- .../negative_relationship_type_mismatch/expected.yaml | 2 +- .../negative_template_parameter_mismatch/expected.yaml | 4 ++-- .../negative_template_parameter_pack_mismatch/expected.yaml | 4 ++-- .../negative_type_alias_mismatch/expected.yaml | 4 ++-- .../negative_type_alias_missing/expected.yaml | 2 +- .../negative_variable_mismatch/expected.yaml | 4 ++-- .../negative_variable_static_mismatch/expected.yaml | 4 ++-- .../negative_variable_visibility_mismatch/expected.yaml | 4 ++-- 21 files changed, 34 insertions(+), 34 deletions(-) diff --git a/validation/core/integration_test/class_design_implementation/negative_class_member_missing/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_class_member_missing/expected.yaml index 6e9bbe7a..cb112d2c 100644 --- a/validation/core/integration_test/class_design_implementation/negative_class_member_missing/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_class_member_missing/expected.yaml @@ -16,5 +16,5 @@ error_contains: | Entity ID : Engine Member : manufacturer Design source file : class_diagram.puml - Design source line : 17 + Design source line : 18 Required Action : Implement the member or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_class_missing/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_class_missing/expected.yaml index d4dd8126..4565a9db 100644 --- a/validation/core/integration_test/class_design_implementation/negative_class_missing/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_class_missing/expected.yaml @@ -15,5 +15,5 @@ error_contains: | Missing implementation class for unit design entity: Entity ID : Manufacturer Design source file : class_diagram.puml - Design source line : 16 + Design source line : 18 Required Action : Add a matching implementation class or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/expected.yaml index aa695031..7177ec67 100644 --- a/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/expected.yaml @@ -17,7 +17,7 @@ error_contains: | Field : entity_type Design value : Class Design source file : class_diagram.puml - Design source line : 14 + Design source line : 16 Implement value : Struct Implement source file : validation/core/integration_test/class_design_implementation/negative_entity_type_mismatch/transport.cpp Implement source line : 14 diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/expected.yaml index 7eab6e36..5add080e 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : "On" Design value : 2 Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : 1 Implement source file : validation/core/integration_test/class_design_implementation/negative_enum_literal_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/expected.yaml index 466a9e73..88f6623d 100644 --- a/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_enum_literal_missing/expected.yaml @@ -16,5 +16,5 @@ error_contains: | Entity ID : Mode Member : On Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Required Action : Implement the member or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/expected.yaml index 93f27367..0ddb1de6 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : method "stop" return_type Design value : int Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : void Implement source file : validation/core/integration_test/class_design_implementation/negative_method_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_missing/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_missing/expected.yaml index a6aee43d..01519c5b 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_missing/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_missing/expected.yaml @@ -16,5 +16,5 @@ error_contains: | Entity ID : Engine Member : restart() Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Required Action : Implement the member or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml index bc9e1aa8..fe70a293 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : method "stop" modifiers Design value : [] Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : [Static] Implement source file : validation/core/integration_test/class_design_implementation/negative_method_modifier_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml index 31feeee3..fd993fc0 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : method "stop" parameter_count Design value : 2 parameters (mode: int, force: int) Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : 1 parameter (mode: int) Implement source file : validation/core/integration_test/class_design_implementation/negative_method_parameter_count_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/expected.yaml index 8c5e5800..6699635b 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : method "stop" parameter name Design value : force: double Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : thrust: double Implement source file : validation/core/integration_test/class_design_implementation/negative_method_parameter_name_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/expected.yaml index 7c925b5f..e845c834 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : method "stop" parameter type Design value : force: int Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : force: double Implement source file : validation/core/integration_test/class_design_implementation/negative_method_parameter_type_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/expected.yaml index d33caac7..81f6a107 100644 --- a/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : method "stop" visibility Design value : Public Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : Private Implement source file : validation/core/integration_test/class_design_implementation/negative_method_visibility_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/expected.yaml index 6866ca60..f51da9ae 100644 --- a/validation/core/integration_test/class_design_implementation/negative_relationship_missing/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_relationship_missing/expected.yaml @@ -16,5 +16,5 @@ error_contains: | Entity ID : Manufacturer Member : Manufacturer -> Composition -> Engine Design source file : class_diagram.puml - Design source line : 7 + Design source line : 17 Required Action : Implement the member or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/expected.yaml index 60cad939..ee56a4f1 100644 --- a/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/expected.yaml @@ -17,7 +17,7 @@ error_contains: | Field : relationship type Design value : Engine -> Aggregation -> Manufacturer Design source file : class_diagram.puml - Design source line : 16 + Design source line : 18 Implement value : Engine -> Composition -> Manufacturer Implement source file : validation/core/integration_test/class_design_implementation/negative_relationship_type_mismatch/transport.cpp Implement source line : 18 diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/expected.yaml index 92b717a5..79ba985b 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : template_parameters Design value : ["T"] Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : ["U"] Implement source file : validation/core/integration_test/class_design_implementation/negative_template_parameter_mismatch/transport.cpp - Implement source line : 7 + Implement source line : 15 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/expected.yaml index f78ea741..af4168a5 100644 --- a/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : template_parameters Design value : ["T..."] Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : ["T"] Implement source file : validation/core/integration_test/class_design_implementation/negative_template_parameter_pack_mismatch/transport.cpp - Implement source line : 7 + Implement source line : 15 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/expected.yaml index 627674d4..a75848c1 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : type_alias "Speed" original_type Design value : std::uint8_t Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : std::uint16_t Implement source file : validation/core/integration_test/class_design_implementation/negative_type_alias_mismatch/transport.cpp - Implement source line : 8 + Implement source line : 16 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/expected.yaml index f0b75f4f..4b3a28ee 100644 --- a/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_type_alias_missing/expected.yaml @@ -16,5 +16,5 @@ error_contains: | Entity ID : Engine Member : Speed Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Required Action : Implement the member or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/expected.yaml index fc52ff5b..4aa3e4ec 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_variable_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : variable "speed" data_type Design value : int Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : double Implement source file : validation/core/integration_test/class_design_implementation/negative_variable_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/expected.yaml index b9d8f0b3..566f7dbb 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : variable "speed" is_static Design value : false Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : true Implement source file : validation/core/integration_test/class_design_implementation/negative_variable_static_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design diff --git a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/expected.yaml b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/expected.yaml index 0a3d6986..907ee96b 100644 --- a/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/expected.yaml +++ b/validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/expected.yaml @@ -17,8 +17,8 @@ error_contains: | Field : variable "speed" visibility Design value : Public Design source file : class_diagram.puml - Design source line : 6 + Design source line : 16 Implement value : Private Implement source file : validation/core/integration_test/class_design_implementation/negative_variable_visibility_mismatch/transport.cpp - Implement source line : 6 + Implement source line : 14 Required Action : Align the implementation with the unit design or update the unit design