DataDog / datadog-static-analyzer

Datadog Static Analyzer
https://docs.datadoghq.com/static_analysis/
Apache License 2.0
100 stars 12 forks source link

[STAL-2337] feat: add Starlark support #413

Closed amaanq closed 3 months ago

amaanq commented 3 months ago

What problem are you trying to solve?

Currently, we do not support Bazel (Starlark) files. Even though it is very similar to Python, there are some slight differences, which would make it not ideal to reuse the grammar for Python for Starlark files.

What is your solution?

Add the Starlark grammar to the analyzer itself, which is fetched from https://github.com/tree-sitter-grammars/tree-sitter-starlark. This grammar accounts for the minute differences between Starlark and Python, making it a good candidate to add in the analyzer. This will allow us (and customers down the line) to begin writing rules targeting Bazel/Isopod files

Alternatives considered

Not adding another grammar and reusing the Python grammar for Starlark

What the reviewer should know

A couple notes, since I tacked on a few code changes that are not directly needed for this PR, but are more plumbing/nice-to-haves and relate to it more or less.