Skip to content

feat: allow non root docs()#657

Merged
MaximilianSoerenPollak merged 2 commits into
eclipse-score:mainfrom
etas-contrib:testing
Jul 24, 2026
Merged

feat: allow non root docs()#657
MaximilianSoerenPollak merged 2 commits into
eclipse-score:mainfrom
etas-contrib:testing

Conversation

@AlexanderLanin

Copy link
Copy Markdown
Member

📌 Description

So far docs() was only callable from the root BUILD file. While that was intentional, this also prevents us from running docs() commands in order to test them properly.

Quite a lot of technical debt has accumulated due to this restriction we imposed. Notably:

  • Finding needs_json from different places was not implemented
  • Testlogs read everything from the module, but a non root docs() command will typically now know most of the linked requirements
  • Generated documentation must not be placed into /_bazel but in <docs()-dir>/bazel

🚨 Impact Analysis

  • This change does not violate any tool requirements
  • ... is covered by existing tool requirements
  • This change does not violate any design decisions
  • Otherwise I have created a ticket for new tool qualification

✅ Checklist

  • Added/updated documentation for new or changed features <-- intentionally skipped for now. Not sure we want that.
  • Added/updated tests to cover the changes
  • Followed project coding standards and guidelines

@github-actions

github-actions Bot commented Jul 22, 2026

Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //src:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.6.0) and connecting to it...
INFO: Invocation ID: 871be269-da90-400d-8791-5a33e99f6edb
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
DEBUG: /home/runner/.bazel/external/rules_python+/python/private/repo_utils.bzl:101:16: 
rules_python:coverage_dep WARNING: rules_python's bundled coverage tool has no wheel for python_version=3.12.13, platform=ppc64le-unknown-linux-gnu. `bazel coverage` will produce empty lcov for py_test targets in this configuration. Either pin python_version to a version in the bundled set (see python/private/coverage_deps.bzl), or configure coverage manually via py_runtime.coverage_tool. See docs/coverage.md.
DEBUG: /home/runner/.bazel/external/rules_python+/python/private/repo_utils.bzl:101:16: 
rules_python:coverage_dep WARNING: rules_python's bundled coverage tool has no wheel for python_version=3.12.13, platform=riscv64-unknown-linux-gnu. `bazel coverage` will produce empty lcov for py_test targets in this configuration. Either pin python_version to a version in the bundled set (see python/private/coverage_deps.bzl), or configure coverage manually via py_runtime.coverage_tool. See docs/coverage.md.
DEBUG: /home/runner/.bazel/external/rules_python+/python/private/repo_utils.bzl:101:16: 
rules_python:coverage_dep WARNING: rules_python's bundled coverage tool has no wheel for python_version=3.12.13, platform=s390x-unknown-linux-gnu. `bazel coverage` will produce empty lcov for py_test targets in this configuration. Either pin python_version to a version in the bundled set (see python/private/coverage_deps.bzl), or configure coverage manually via py_runtime.coverage_tool. See docs/coverage.md.
DEBUG: /home/runner/.bazel/external/rules_python+/python/private/repo_utils.bzl:101:16: 
rules_python:coverage_dep WARNING: rules_python's bundled coverage tool has no wheel for python_version=3.12.13, platform=x86_64-unknown-linux-musl. `bazel coverage` will produce empty lcov for py_test targets in this configuration. Either pin python_version to a version in the bundled set (see python/private/coverage_deps.bzl), or configure coverage manually via py_runtime.coverage_tool. See docs/coverage.md.
Loading: 0 packages loaded
    currently loading: src
Loading: 0 packages loaded
    currently loading: src
WARNING: Target pattern parsing failed.
ERROR: Skipping '//src:license-check': no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
ERROR: no such target '//src:license-check': target 'license-check' not declared in package 'src' defined by /home/runner/work/docs-as-code/docs-as-code/src/BUILD
INFO: Elapsed time: 8.334s
INFO: 0 processes.
ERROR: Build did NOT complete successfully
ERROR: Build failed. Not running target

@github-actions

Copy link
Copy Markdown

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

@AlexanderLanin
AlexanderLanin marked this pull request as ready for review July 22, 2026 14:34

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Overall looks good, just some questions I have that we should address.

Comment thread docs.bzl
data: Additional data files to include in the documentation build.
deps: Additional dependencies for the documentation build.
scan_code: List of code targets to scan for source code links.
test_sources: Optional list of repo-relative directory paths which will be used to filter testcases for documentation generation.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What happens to testcases that do not have file in the attributes?
As that is added by our plugin I think?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Yeah those would show up in all docs as unlinked tests. Acceptable for now / for my test-use-case.

Comment thread src/extensions/score_metamodel/external_needs.py
Comment on lines +75 to +87
def is_testcase_in_scope(test_file: str | None, allowed_dirs: list[str]) -> bool:
"""Return True if the testcase should be turned into a need.

An empty `allowed_dirs` disables filtering (everything is in scope). Otherwise
a testcase is in scope only if it has a `file` attribute that is located under
one of the allowed (repo-relative) directories.
"""
if not allowed_dirs:
return True
if not test_file:
return False
file_path = Path(test_file)
return any(file_path.is_relative_to(allowed) for allowed in allowed_dirs)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

If this is now new behaviour, and different than what currently is (have everything regardlesss of attributes & properties be a testcase due to the metrics) we should think if this is okay and if so it should be documented

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Default is unfiltered. The entire new docs()-parameter / behavior is undocumented.

Maybe we should call it experimental?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Hmm I think we should do that, but in seperate PR's.
We need to document the docs macro somewhere in the future.

Comment thread src/extensions/score_source_code_linker/xml_parser.py
@AlexanderLanin AlexanderLanin mentioned this pull request Jul 24, 2026
6 tasks

@MaximilianSoerenPollak MaximilianSoerenPollak left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like a good step in the right direction.
Talked about in calls & explained. So all fine for me atm.

@MaximilianSoerenPollak
MaximilianSoerenPollak merged commit 99e070e into eclipse-score:main Jul 24, 2026
16 of 20 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Development

Successfully merging this pull request may close these issues.

2 participants