Code similarity detection method and device

A detection method and similarity technology, applied in the computer field, can solve problems such as undetectable and code structure problems, and achieve the effect of improving code structure and readability

Pending Publication Date: 2019-10-18
BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD +1
View PDF6 Cites 8 Cited by
  • Summary
  • Abstract
  • Description
  • Claims
  • Application Information

AI Technical Summary

Problems solved by technology

[0005] In view of this, the embodiment of the present invention provides a method and device for detecting code similarity, which can solve problems in the prior art that do not violate programming logic or programming style, and variables, naming, and types are normal but the code structure is obviously problematic. Situation Undetectable Problems

Method used

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
View more

Image

Smart Image Click on the blue labels to locate them in the text.
Viewing Examples
Smart Image
  • Code similarity detection method and device
  • Code similarity detection method and device
  • Code similarity detection method and device

Examples

Experimental program
Comparison scheme
Effect test

Embodiment Construction

[0040] Exemplary embodiments of the present invention are described below in conjunction with the accompanying drawings, which include various details of the embodiments of the present invention to facilitate understanding, and they should be regarded as exemplary only. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.

[0041] figure 1 is a method for detecting code similarity according to an embodiment of the present invention, such as figure 1 As shown, the detection method based on code similarity includes:

[0042] In step S101, a code file is acquired to establish an abstract syntax tree corresponding to the code.

[0043] Among them, usually a project includes many packages and t...

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

PUM

No PUM Login to view more

Abstract

The invention discloses a code similarity detection method and a code similarity detection device, and relates to the technical field of computers. A specific embodiment of the method comprises the steps of obtaining a code file to establish an abstract syntax tree corresponding to a code; extracting vocabularies in the abstract syntax tree so as to map the abstract syntax tree into space vectorsaccording to the vocabularies; and calculating the code similarity based on the cosine distance of the space vectors. According to the embodiment, the problem that in the prior art, the situation thatprogramming logic or programming style is not violated, variables, names and types are normal, but a code architecture has obvious problems cannot be detected can be solved.

Description

technical field [0001] The invention relates to the field of computer technology, in particular to a method and device for detecting code similarity. Background technique [0002] At present, general software companies use various tools to perform static detection on codes, so as to modify unreasonable parts of the codes. Existing static analysis software includes static inspection tools such as Coverity or Infer. Static testing includes code inspection, static structural analysis, and code quality measurement. It can be done manually, giving full play to the advantages of human logical thinking, or it can be done automatically with the help of software tools. Among them, code inspection includes code walkthrough, desktop inspection, code review, etc. It mainly checks the correctness of the logical expression of the code, and can find problems that violate the programming standards, unsafe, unclear and vague parts of the program, and find out the program Non-portable parts...

Claims

the structure of the environmentally friendly knitted fabric provided by the present invention; figure 2 Flow chart of the yarn wrapping machine for environmentally friendly knitted fabrics and storage devices; image 3 Is the parameter map of the yarn covering machine
Login to view more

Application Information

Patent Timeline
no application Login to view more
Patent Type & Authority Applications(China)
IPC IPC(8): G06F8/75G06F8/41
CPCG06F8/751G06F8/427
Inventor 陆韬
Owner BEIJING JINGDONG SHANGKE INFORMATION TECH CO LTD
Who we serve
  • R&D Engineer
  • R&D Manager
  • IP Professional
Why Eureka
  • Industry Leading Data Capabilities
  • Powerful AI technology
  • Patent DNA Extraction
Social media
Try Eureka
PatSnap group products