facebook / infer

A static analyzer for Java, C, C++, and Objective-C
http://fbinfer.com/
MIT License
14.89k stars 2.01k forks source link

Is it possible to prevent Infer from stopping analyzing a method when it finds an error? #1657

Closed kobifeldman closed 2 years ago

kobifeldman commented 2 years ago

I have a question regarding the use of Infer. On the documentation it states that "Infer analyzes each function and method separately. If Infer encounters an error when analyzing a method or function, it stops there for that method or function, but will continue the analysis of other methods and functions" (https://fbinfer.com/docs/infer-workflow).

Is there any way to get Infer to NOT stop analyzing a method when it encounters an error? I am attempting to use the tool in a context where it would be more beneficial for me to see all of the errors for a given method instead of the suggested workflow of "to run Infer on your code, fix the errors generated, and run it again to find possibly more errors or to check that all the errors have been fixed."

Let me know if there are any ways to go about this.

Thanks

jvillard commented 2 years ago

I think I answered this same issue on IRC but repeating here: In general that's not possible, and for error types where it is possible we usually already do continue. For example in the Pulse analysis (or in biabduction), when a null pointer dereference is encountered the analysis stops because it doesn't know how to keep going: the program state it has computed so far is meaningless after the error, or at least there's no easy way to "fix" it to make it go past the error in a coherent state. But, for DEAD_STORE we do report all the errors we can find at once because a useless store to a variable is not a fatal error.