.net - What does the "Be optimistic on external API" option do? -
in "static checking" options code contracts there option named "be optimistic on external api". cannot find documentation on option does. how affect analyzer's behaviour?
there indeed not seem documentation option. browsing source gives few clues. in options.cs
links boolean lowscoreforexternal
:
[optiondescription("be optimistic on external api? assign proof obligations depending on low score")] [donothashincache] public bool lowscoreforexternal = true;
where in warningscoresmanager
used during initialization set score assigned info in external assembly. option turned on, same score applied if referencing different assembly applied framework assembly, otherwise high penalty applies.
private void initializedefaultvaluesforcontextsofcalleeassumecandischarge (bool lowscoreforexternalapi) { // ... scorecalleeassumeextrainfodeclaredinaframeworkassembly = .05; scorecalleeassumeextrainfodeclaredinadifferentassembly = lowscoreforexternalapi ? scorecalleeassumeextrainfodeclaredinaframeworkassembly : 100.0;
it seem using setting forces analyzer assume similar level of trust code quality of external assemblies afforded framework assemblies.
this seems use of variable - passed warningscoresmanager
in constructor , not used anywhere else.
Comments
Post a Comment