System for identifying same or similar instances of source code
The technology disclosed relates to a system for identifying same or similar instances of source code. In particular, the technology disclosed relates to a data repository designed for storing information regarding one or more associations between an instance of source code and a semantic hash code value. Wherein, semantic hash code value being determined in accordance with a semantic hash code algorithm. Wherein, semantic hash code algorithm being designed for computing a quantification of a set of measured characteristics of instance of source code. Wherein, quantification of set of source code characteristics of instance of source code being represented by semantic hash code value. Wherein, semantic hash code value corresponding to instance of source code. Wherein, an association between an identity of instance of source code and semantic hash code value is stored into data repository.
1 . A system for identifying abnormal dependencies from a
software application of third-party software components that are erroneously left out of the software application, by identifying same or similar instances of source code in the software application to identify the third-party software components that are not bound into the software application, the system including:
a data repository designed for storing information regarding associations between an instance of the source code for the software application and a semantic hash code value;
wherein said semantic hash code value is determined in accordance with a semantic hash code algorithm that identifies a quantification of a set of measured characteristics of said instance of the source code;
wherein characteristics of said instance of the source code are represented by said semantic hash code value; and
wherein an association between an identity of said instance of source code and said semantic hash code value is stored into said data repository;
a non-volatile data storage that stores the software application and other data including information regarding the source code in the software application;
a source code search engine employed to perform a search for instances of the source code, residing outside of the software application, that are matching or that are similar to that of an instance of a target source code, via employment of the semantic hash algorithm; and
a processor controlled by code stored in the non-volatile data storage which when executed by the processor in conjunction with execution of the source code search engine causes performance of the following operations:
performing by the source code search engine a search through the non-volatile data storage to identify directives from within said source code using the semantic hash algorithm to identify dependencies from the software application;
identifying among the third-party software components those that are not identified and bound into the software application as found software components with abnormal dependencies that are erroneously left out of the software application;
updating the software application to correct the software application to include the found software components by storing the found software components as part of the software application and further storing data to identify the found software components as being part of the software application.
2 . The system of claim 1 , wherein said semantic hash code algorithm processes an abstract syntax tree (AST) corresponding to said instance of source code.
3 . The system of claim 2 wherein said semantic hash code value is computed from a plurality of measured characteristics of said abstract syntax tree (AST).
4 . The system of claim 1 wherein said data repository is designed to store a plurality of associations, and wherein each of said plurality of associations represents an association between an identity of a unique instance of source code, and a semantic hash code value corresponding to said unique instance of source code.
5 . The system of claim 4 wherein said unique instance of source code is included within a source code file, and wherein an association between said unique instance of source code and a semantic hash code value corresponding to said unique instance of source code, further includes a name and a location of said source code file.
6 . A computer-implemented method for identifying third-party software components that are erroneously left out of a software application, the third-party software components including computer programming language source code, the method including the actions of:
executing a semantic hash algorithm upon a first instance of source code, being a target instance of source code;
computing a first semantic hash code value in association with said first instance of source code, in accordance with a first semantic hash algorithm;
computing a second semantic hash code value in association with a second instance of source code, in accordance with said semantic hash algorithm;
comparing said first semantic hash code value and said second semantic hash code value and determining if said first semantic hash code value is equivalent to said second semantic hash code value;
storing an association of said second instance of source code with said first instance of source code, within a data repository, in response to each instance of source code having an equivalent semantic hash code value
identifying that the first instance of source code has an equivalent semantic hash code value stored in the data repository and is among third-party software components not identified and bound into the software application as a found software component that was erroneously left out of the software application;
updating the software application to correct the software application to include the found software component by storing the found software component as part of the software application.
7 . The method of claim 6 , wherein said semantic hash algorithm processes an abstract syntax tree (AST) corresponding to an instance of source code.
8 . The method of claim 7 , wherein a semantic hash value for an instance of source code, is determined based upon a plurality of measured characteristics of said abstract syntax tree (AST) corresponding to said instance of source code.
9 . The method of claim 8 wherein said plurality of measured characteristics of said abstract syntax tree (AST) include a number of nodes within said abstract syntax tree (AST) falling into each one of a plurality of node type categories.
10 . The method of claim 7 wherein an instance of source code is included within a source code file, and wherein an association between a semantic hash code value corresponding to said instance of source code, includes at least one of a name of said source code file, and a location of said source code file.