Static code analysis (SCA) is a popular bug detection technique. However, several problems slow down the adoption of SCA. First of all, when first applying SCA to a mature software system, the SCA tools tend to report a large number of alerts which developers do not act on. Second, it is unclear how effective SCA is to find real defects. Therefore, we decided to conduct a case study in Valuatum to evaluate and enhance the effectiveness of FindBugs, a popular SCA tool for Java. The main goal of this thesis is to learn how to make FindBugs as an effective tool providing immediate, useful feedback for developers in Valuatum.
We have used several approaches to study FindBugs. First, we have analyzed how many and what types of fixed defects could have been prevented with FindBugs. Second, we have developed custom detectors for the most important defects missed by FindBugs. Third, we have studied the precision of FindBugs to detect open defects. Last, we have presented several approaches, such as defect differencing and IDE integration, to deal with the large number of alerts.
The results indicate that FindBugs is not very effective in detecting fixed defects. We estimated that 9-16% of the fixed bugs should be feasible to detect with SCA. However, only 0 - 2% of the reported fixed bugs and 1 - 6% of the unreported fixed bugs could have been prevented with FindBugs. Moreover, only 18.5% of the high-priority open alerts are considered actionable. Nevertheless, we think FindBugs is a cost-effective tool, because it detected several important open issues and can be enhanced with custom detectors.
Staattinen koodianalyysi (SCA) on suosittu menetelmä ohjelmistovirheiden eli bugien etsinnässä. Sen käyttöönottoa kuitenkin haittaavat useat ongelmat. Ensinnäkin SCA tuottaa kehittyneissä ohjelmistoissa paljon varoituksia, joihin käyttäjät eivät reagoi. On myös epäselvää, kuinka tehokkaasti SCA löytää oikeita bugeja. Siksi toteutimmekin tässä työssä tapaustutkimuksen Valuatumilla, jossa arvioimme ja parannamme FindBugsin tehokkuutta. Työn päätarkoitus on oppia hyödyntämään FindBugsia niin, että se antaisi mahdollisimman hyödyllistä ja välitöntä palautetta Valuatumin ohjelmistokehittäjille.
Käytimme tutkimuksessa useita eri tapoja FindBugsin arviointiin. Ensinnäkin analysoimme, mitä korjattuja ohjelmistovirheitä FindBugs olisi voinut estää. Kirjoitimme myös omia bugi-ilmaisimia niille tärkeimmille virheille, joita FindBugs ei löytänyt. Lisäksi tutkimme FindBugsin löytämiä avoimia bugeja sekä esitimme erilaisia tapoja, miten hallita suuria määriä varoituksia.
Tutkimustulokset viittaavat siihen, että FindBugs ei ole kovin tehokas löytämään korjattuja ohjelmistovirheitä. Arvioimme, että SCA:lla pystyisi löytämään 9 - 16% korjatuista bugeista. Kuitenkin vain 0 - 2 % raportoiduista ja 1 - 6 % raportoimattomista bugeista olisi voitu estää FindBugsilla. Avoimista FindBugsin löytämistä korkeimman prioriteetin varoituksista vain 18,5 % luokiteltiin oleellisiksi. FindBugs on kuitenkin mielestämme kustannustehokas työkalu bugien etsintään, koska sitä pystyy tehostamaan omilla bugi-ilmaisimilla ja sen avulla olemme löytäneet useita tärkeitä virheitä koodista.