DataDog / datadog-static-analyzer

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

[STAL-2820] feat: add end-to-end testing for R, Rust, and SQL #505

Closed amaanq closed 1 month ago

amaanq commented 1 month ago

What problem are you trying to solve?

We've added support for several new languages in the analyzer, but we haven't added proper end-to-end testing to ensure that we can write rules in the rule editor for these languages, retrieve them from the backend, run them in the analyzer, and get some number of results back.

What is your solution?

This PR adds 3 integration test files, named integration-test-{lang}.sh which incorporate the same logic as the other currently existing integration scripts. It downloads a repository that is a project written mostly in the target language, writes a config file to use the {lang}-inclusive and {lang}-code-style rulesets in the cloned path, and executes the analyzer in this path. Each language has a function-name-min-length and comments rule which are in the code-style and inclusive rulesets for each language. We expect to get at least two results in each case; currently the R repo has 10 results, the Rust one 9, and the SQL one 27. While there might be slight variation in the number of results over time as the repository changes, we're not likely to see this number go below 2.

These three integration test scripts have been added to the integration-tests GitHub CI job as well to check for any regressions/issues.

Alternatives considered

What the reviewer should know