uber-go / nilaway

Static analysis tool to detect potential nil panics in Go code
Apache License 2.0
3.17k stars 65 forks source link

Generalize trusted function framework to be a hook framework #278

Closed yuxincs closed 1 month ago

yuxincs commented 2 months ago

This PR generalizes the trusted function framework to be a NilAway-wide hook framework.

To be honest it was already a NilAway-wide thing: it hooks into different parts of the system and can do different actions based on certain conditions. This PR simply lifts it up to the root level and call it "hook" instead of trusted function: in the future we may leverage this framework to handle more than function calls, with more types of actions, and hooking into more points (e.g., even in inference).

This PR is the first of a series of PRs to generalize this framework: this one simply does the relocation with no changes other than reference updates.

codecov[bot] commented 2 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.60%. Comparing base (c91e71c) to head (6884546). Report is 1 commits behind head on main.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #278 +/- ## ======================================= Coverage 87.60% 87.60% ======================================= Files 63 63 Lines 7916 7916 ======================================= Hits 6935 6935 Misses 799 799 Partials 182 182 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 2 months ago

Golden Test

[!NOTE]
✅ NilAway errors reported on standard libraries are identical.

3271 errors on base branch (main, c91e71c) 3271 errors on test branch (3ce6698)