Repository navigation
Add signal-reachability checker and source quality checks (qualityChecks task) #893
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
jbachorik
wants to merge
7
commits into
main
Choose a base branch
from
signal-reachability-checker
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
8f68665
Add static signal-reachability checker for native objects
jbachorik 5f6cc8f
Add opt-in checkSignalReachability Gradle task
jbachorik 5cb8d2d
Add source quality checks and opt-in qualityChecks task
jbachorik c966c5e
Harden quality checks per review: sink coverage, allowlist strictness…
jbachorik 03a07a7
RefCountGuard: count nested-overflow instead of logging from signal c…
jbachorik 585a559
Merge branch 'main' into signal-reachability-checker
jbachorik 2ee769c
sphinx: address review feedback on PR #893
jbachorik File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,74 @@ | ||
| #!/usr/bin/env python3 | ||
| # Copyright 2026, Datadog, Inc | ||
| # | ||
| # Licensed under the Apache License, Version 2.0 (the "License"); | ||
| # you may not use this file except in compliance with the License. | ||
| # You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| """Check that every tracked doc/**/*.md is linked from doc/README.md and named in PascalCase. | ||
|
|
||
| doc/README.md itself is the only exception to both rules. | ||
|
|
||
| Exit codes: 0 clean, 1 violations, 2 environment error. | ||
| """ | ||
|
|
||
| import argparse | ||
| import os | ||
| import posixpath | ||
| import re | ||
| import subprocess | ||
| import sys | ||
|
|
||
| INDEX = "doc/README.md" | ||
| _LINK = re.compile(r"\]\((<?[^)\s>]+>?)\)") | ||
| _PASCAL = re.compile(r"^[A-Z][A-Za-z0-9]*\.md$") | ||
|
|
||
|
|
||
| def main(argv): | ||
| ap = argparse.ArgumentParser(description=__doc__.split("\n\n")[0]) | ||
| ap.add_argument("--root", default=os.path.dirname(os.path.dirname(os.path.abspath(__file__))), | ||
| help="repository root (default: the checkout containing this script)") | ||
| root = ap.parse_args(argv).root | ||
|
|
||
| try: | ||
| docs = subprocess.run(["git", "-C", root, "ls-files", "--", "doc/*.md", "doc/**/*.md"], | ||
| capture_output=True, text=True, check=True).stdout.splitlines() | ||
| with open(os.path.join(root, INDEX), encoding="utf-8") as f: | ||
| index = f.read() | ||
| except (OSError, subprocess.CalledProcessError) as e: | ||
| print("error: %s" % e, file=sys.stderr) | ||
| return 2 | ||
|
|
||
| linked = set() | ||
| for target in _LINK.findall(index): | ||
| target = target.strip("<>").split("#", 1)[0] | ||
| if target and "://" not in target: | ||
| linked.add(posixpath.normpath(posixpath.join("doc", target))) | ||
|
|
||
| errors = [] | ||
| tracked = set(docs) | ||
| for doc in sorted(tracked - {INDEX}): | ||
| if doc not in linked: | ||
| errors.append("%s: not linked from %s" % (doc, INDEX)) | ||
| if not _PASCAL.match(posixpath.basename(doc)): | ||
| errors.append("%s: file name is not PascalCase (e.g. BuildSystemGuide.md)" % doc) | ||
| # Reverse direction: every relative index link must resolve to a tracked | ||
| # file, so renames that leave a dangling link fail here too. | ||
| for target in sorted(linked): | ||
| if target.startswith("doc/") and target not in tracked: | ||
| errors.append("%s: %s links to a file that is not tracked" % (INDEX, target)) | ||
| for e in errors: | ||
| print(e) | ||
| print("doc index: %s" % ("%d problem(s)" % len(errors) if errors else "OK (%d docs)" % (len(docs) - 1))) | ||
| return 1 if errors else 0 | ||
|
|
||
|
|
||
| if __name__ == "__main__": | ||
| sys.exit(main(sys.argv[1:])) |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.