[K9VULN-12932] Add Dart support#903
Merged
jasonforal merged 1 commit intomainfrom Apr 29, 2026
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds Dart language support to the static analysis kernel by wiring in a tree-sitter Dart grammar, recognizing Dart generated files, and ensuring Dart files are detected/parsed across CLI + analysis components.
Changes:
- Add
Language::Dartto the core language model and CLI file-extension mapping. - Integrate the Dart tree-sitter grammar via
build.rs, and route Dart through tree-sitter parsing + a basic parsing test. - Add Dart generated-file header detection + tests, and include Dart in inline-suppression comment handling.
Reviewed changes
Copilot reviewed 6 out of 6 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| crates/static-analysis-kernel/src/model/common.rs | Adds Dart to Language, display formatting, and language listing. |
| crates/static-analysis-kernel/src/analysis/tree_sitter.rs | Adds Dart tree-sitter language binding and a parse sanity test. |
| crates/static-analysis-kernel/src/analysis/generated_content.rs | Adds Dart generated-file header detection and tests. |
| crates/static-analysis-kernel/src/analysis/analyze.rs | Treats Dart as //-comment language for inline suppression scanning. |
| crates/static-analysis-kernel/build.rs | Vendors/compiles a forked tree-sitter-dart pinned to an ABI-14-compatible commit. |
| crates/cli/src/file_utils.rs | Maps .dart extension to Language::Dart. |
Comments suppressed due to low confidence (1)
crates/static-analysis-kernel/src/model/common.rs:76
ALL_LANGUAGESis used by the server/languagesendpoint to report supported languages, but it currently omitsLanguage::Elixireven though Elixir is supported elsewhere (e.g., tree-sitter integration). This means Elixir won't be advertised as supported. AddLanguage::ElixirtoALL_LANGUAGES(or rename/scope this list if it is intentionally not meant to include all supported languages).
#[allow(dead_code)]
pub static ALL_LANGUAGES: &[Language] = &[
Language::Csharp,
Language::Dart,
Language::Dockerfile,
Language::Go,
Language::Java,
Language::JavaScript,
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
🎯 Code Coverage (details) 🔗 Commit SHA: ea20ab2 | Docs | Datadog PR Page | Give us feedback! |
bahar-shah
approved these changes
Apr 29, 2026
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What this PR does
Adds support for Dart
Notes
We're using UserNobody14's grammar at https://github.com/UserNobody14/tree-sitter-dart. This repo has committed the generated
parser.candscanner.cfiles, but it generated them targeting ABI 15 (#define LANGUAGE_VERSION 15inparser.c).Our current version of tree-sitter only supports up to ABI 14, so the repo was forked and grammar (re)generated for ABI 14 (See: muh-nee/tree-sitter-dart#1).
The above context is documented with code comments in
build.rs:datadog-static-analyzer/crates/static-analysis-kernel/build.rs
Lines 260 to 264 in ea20ab2