Skip to main navigation Skip to search Skip to main content

Detecting Inline Code Comment Smells Leveraging CodeBERT Model

Research output: Contribution to journal › Article › peer-review

2 Scopus citations

Abstract

Inline code comments provide contextual information within source code, potentially enhancing readability and maintainability. However, suboptimal commenting practices, commonly referred to as comment smells, can obscure code intent, reduce maintainability, and increase the likelihood of defects. Automated detection of these smells remains challenging due to their diverse manifestations and the interplay between code and natural language. In this paper, we present a model that leverages CodeBERT embeddings to detect and classify multiple types of inline comment smells. The method incorporates systematic preprocessing of code comment pairs, class balancing to mitigate skewed label distributions, and contextual representation learning to capture semantic and syntactic aspects of the code. The proposed approach is evaluated on a publicly available benchmark dataset comprising 2,189 manually annotated code–comment pairs extracted from open-source Java and Python projects. Evaluation on a benchmark dataset shows that CodeBERT consistently outperforms traditional machine/deep learning classifiers in accuracy and Matthews Correlation Coefficient (MCC), establishing a new state-of-the-art for multi-class comment-smell detection. These results demonstrate the effectiveness of pre-trained, code-aware language models for detecting inline comment smells in a software project. These findings highlight the promise of code-aware transformer models for automated assessment of inline comment quality in real-world software systems.

Original languageEnglish
Pages (from-to)28367-28382
Number of pages16
JournalIEEE Access
Volume14
DOIs
StatePublished - 2026

Bibliographical note

Publisher Copyright:
© 2013 IEEE.

Keywords

  • CodeBERT embeddings
  • Inline code comments
  • automated detection
  • comment smells

ASJC Scopus subject areas

  • General Computer Science
  • General Materials Science
  • General Engineering

Fingerprint

Dive into the research topics of 'Detecting Inline Code Comment Smells Leveraging CodeBERT Model'. Together they form a unique fingerprint.

Cite this