DataDog / datadog-static-analyzer

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

Fix the unnecessary updating of ddsa FileContext #433

Closed jasonforal closed 3 months ago

jasonforal commented 3 months ago

What problem are you trying to solve?

https://github.com/DataDog/datadog-static-analyzer/pull/408 fixed a bug that was causing file contexts to be generated for all files, regardless of applicability (e.g. it would calculate a Go package alias map for a JavaScript file).

However, there is still a logic bug that causes the FileContext to be regenerated for every execution, which is wasteful, as it doesn't change between different rule executions.

What is your solution?

Update the FileContext only when a call to set_root_context detects that the tree changed.

Alternatives considered

What the reviewer should know