Code-comment inconsistency detection in Java projects with focus on ranges

M. Cuénez. Code-comment inconsistency detection in Java projects with focus on ranges. 6, 2017.

  • Michel Cuénez

Documenting source code is a routine that occurs almost on a daily basis for any programmer, regardless of the programming field. However, due to time limits, too little motivation and possibly other factors, often times only little effort is made to properly document any implemented feature. Especially, if the functionality of the code was altered. This can lead to bugs in source code, written by a programmer who relies on third party libraries and, therefore, their documentation. Automatically analyzing such documentation – usually written in form of comments – may help detect code-comment inconsistencies (i.e., the documentation implies different behavior than the source code). By doing so, the inconsistencies can be fixed and any programmer using a third party library can rely on the documentation. Therefore, less bugs will be introduced because of inadequate comments. For this reason, a project was implemented and evaluated, in order to determine the feasibility of code-comment inconsistency detection. The implemented approach is based on an existing project and has been extended to focus on ranges, rather than null-related information (which is the focus of the original approach). The evaluation was conducted manually, with the help of automatically created reports. Ultimately, this lead to an overall accuracy of approximately 98% for the inference algorithm. However, as expected, due to rather low metrics, the code-comment inconsistency detection is only about 56%. Additionally, the results of the evaluation are compared to other projects and discussed extensively.