Code odor detection method and system based on large language model

By constructing a prompt word and hierarchical adjustment strategy for large language models, the misjudgment and information loss of code odor detection in the existing technology is solved, and accurate detection and efficient analysis of complex code structures are achieved.

CN120407366APending Publication Date: 2025-08-01ZHEJIANG SCI-TECH UNIV
0 Cites 2 Cited by

Patent Information

Application Number
CN202510338368.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-03-21
Publication Date
2025-08-01

AI Technical Summary

Technical Problem

In the prior art, Feature Envy detection method has misjudgment or misjudgment when facing complex code structures, making it difficult to accurately model the dynamic behavior of the code. In addition, large language models rely on ordinary prompt words in code odor detection, resulting in information loss or incomplete analysis.

Method used

By extracting the context information of the code to be detected, building a collection of methods and class information, combining the thinking chain and thinking tree to build a prompt word for a large language model, and using a hierarchical code replacement strategy, dynamically adjusting the context code information and inputting it to the large language model for code odor detection.

Benefits of technology

Improves the accuracy and efficiency of code odor detection, reduces misjudgment and misjudgment, ensures that long code snippets are not limited by context window size, and provides comprehensive analysis results.

✦ Generated by Eureka AI based on patent content.
Patent Text Reader

Abstract

The invention provides a code peculiar smell detection method and system based on a large language model, and relates to the technical field of code peculiar smell detection.The method comprises the steps that context code information of a to-be-detected code is extracted, and the context code information comprises a method code and a class code; respectively extracting key information of the method codes and the class codes, and constructing a method information set and a class information set; constructing a large language model; on the basis of a thinking chain and a thinking tree, constructing cue words of the large language model; constructing a hierarchy-based code replacement strategy; dynamically adjusting the context code information by using the method information set and the class information set according to the code replacement strategy; and inputting the cue word and the dynamically adjusted context code information into the large language model for code odor detection, and outputting a code odor detection result of the to-be-detected code.
Need to check novelty before this filing date? Find Prior Art