US 12,481,486 B2
Long method autofix engine
Aditya Kumar Ghosh, Bangalore (IN); Akash Chaudhary, Hapur (IN); Vaibhav Tulsyan, Mumbai (IN); and Arun Krishna, New Delhi (IN)
Assigned to DevFactory Innovations FZ-LLC, Dubai Media (AE)
Filed by DevFactory Innovations FZ-LLC, Dubai Media (AE)
Filed on Jun. 24, 2020, as Appl. No. 16/911,134.
Prior Publication US 2021/0405980 A1, Dec. 30, 2021
Int. Cl. G06F 8/41 (2018.01); G06F 8/72 (2018.01)
CPC G06F 8/4441 (2013.01) [G06F 8/436 (2013.01); G06F 8/72 (2013.01)] 23 Claims
OG exemplary drawing
 
1. A method performed by a device having a processor and memory for enhancing operable functionality of a software program by eliminating and automatically fixing long code segments in the software program, comprising:
receiving, by the device, a graph database structure representation of the software program comprising a plurality of input source code segments;
evaluating, by the device, the graph database structure representation of the software program to identify at least a first long code segment from the plurality of input source code segments based on a plurality of predetermined code metric values, wherein evaluating the graph database structure comprises:
applying natural language processing (NLP) or machine learning techniques to assess each of the code segments for predetermined code metrics for use in determining whether the code segment is overlong;
assessing the input source code segments to determine if the any of the code segments are autogenerated; and
using an NLP or machine learning process to determine if any of the code segments are one of either (a) a test method or (b) normal method, wherein the test method includes at least one of (i) a segment name and (ii) annotations that indicate a method is the test method;
outputting, by the device, the first long code segment for storage in a code fix issue queue;
applying, by the device, a plurality of extraction algorithms to at least refactor the first long code segment to generate a second code segment that is semantically equivalent to and shorter than the first long code segment, wherein the extraction algorithms include a fixer service that includes a variable cohesion based extraction module, which is configured to construct extraction candidates as graphs of clustered method variables and statements that use variables, wherein the variables are clustered together if the variables depend on each other and the variable cohesion based extraction module splits extraction candidates around at least one of
(i) biggest articulation points and (ii) around re-initializations of a same variable;
outputting, by the device, the second code segment for storage in a fixed issue queue;
generating, by the device, a fixed graph database structure representation of the software program using the second code segment to replace the first long code segment; and
outputting, by the device, the fixed graph database structure representation for storage in memory.