-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Overlay: Add script to help maintain overlay annotations #19778
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
base: main
Are you sure you want to change the base?
Conversation
@ginsbach I've updated the script to add overlay annotations with a I've closed the previous PR as it was based on a Would you mind reviewing this PR before I send this PR and the PR that adds overlay annotations for Java to review with the Java team? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR introduces a new Python script (add-overlay-annotations.py
) that walks the .qll
directory tree for specified languages, detects files without any overlay[...]
annotations, and injects sensible default overlay[local?]
and overlay[caller]
annotations. It also supports a --check
mode to surface missing annotations without modifying files.
- Adds a script to auto-annotate unannotated
.qll
files and skip files per naming/dataflow heuristics - Implements a dry-run (
--check
) mode and prints a CI-friendly list of unannotated files - Defines language mappings to target directories and shared code
Comments suppressed due to low confidence (1)
config/add-overlay-annotations.py:1
- [nitpick] There are no tests covering this new script. Consider adding unit or integration tests to verify the insertion logic in various scenarios (e.g., files with only comments, existing module statements, qldoc cases).
# This script is used to annotate .qll files without any existing overlay annotations
This PR adds a script to automatically add sensible default annotations to files without existing overlay annotations. The script uses naming heuristics to determine which files to annotate. The script adds a module-level
overlay[local?]
annotation and annotates all non-private inline predicatesoverlay[caller]
for selected files. Maintenance of overlay annotations in already annotated files is not the responsibility of this script and will be handled using QL-for-QL queries. This is intended to allow QL authors to gradually take ownership of overlay annotations and manually add & remove automatically added overlay annotations.A CI check will be added in a subsequent PR to enforce that the script is run for select languages.
The script is based on @ginsbach's annotation script. However, instead of removing existing overlay annotations, it only annotates files without existing annotations and offloads maintenance of annotated files to QL-for-QL queries.
For https://github.com/github/codeql-core/issues/4951.