CN110399132A - Maintaining method, device, computer equipment and the storage medium of item code - Google Patents

Maintaining method, device, computer equipment and the storage medium of item code Download PDF

Info

Publication number
CN110399132A
CN110399132A CN201910524813.3A CN201910524813A CN110399132A CN 110399132 A CN110399132 A CN 110399132A CN 201910524813 A CN201910524813 A CN 201910524813A CN 110399132 A CN110399132 A CN 110399132A
Authority
CN
China
Prior art keywords
method name
code
name
code file
called
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910524813.3A
Other languages
Chinese (zh)
Other versions
CN110399132B (en
Inventor
王建华
马琳
徐网
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Technology Shenzhen Co Ltd
Original Assignee
Ping An Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Ping An Technology Shenzhen Co Ltd filed Critical Ping An Technology Shenzhen Co Ltd
Priority to CN201910524813.3A priority Critical patent/CN110399132B/en
Publication of CN110399132A publication Critical patent/CN110399132A/en
Priority to PCT/CN2019/119072 priority patent/WO2020253080A1/en
Application granted granted Critical
Publication of CN110399132B publication Critical patent/CN110399132B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/44Encoding
    • G06F8/443Optimisation
    • G06F8/4434Reducing the memory space required by the program code
    • G06F8/4435Detection or removal of dead or redundant code
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

This application involves research and development management domains, this application discloses a kind of maintaining method of item code, device, computer equipment and storage mediums, the described method includes: multiple code files in acquisition project, each code file is numbered, and the code in each code file is scanned, the method name and annotation in the code of each code file are obtained, the method name and annotation are carried out with the number of each code file corresponding, and storage is in the database;Method name in the database is summarized, the called number of each method name is obtained;According to the method name be called number in each code file method name and annotation clear up.The application obtains the code segment abandoned by the detection to method name in code file and annotation, can effectively clear up code, improves code operational efficiency, the later maintenance of advantageous code.

Description

Maintaining method, device, computer equipment and the storage medium of item code
Technical field
This application involves research and development management domain, in particular to a kind of maintaining methods of item code, device, computer equipment And storage medium.
Background technique
Currently, developer can be rewritten very due to various factors such as time, place and projects in project development process It after method in mostly duplicate code or code is abandoned, stills remain in class, is unfavorable for the exploitation received below in this way Personnel or maintenance personnel safeguard or rectify and improve to the code in project;And when the size of code of a project is accumulative excessive When, when resulting even in release product, file is excessive, influences to issue and promote.
Summary of the invention
The purpose of the application is to provide the maintaining method, device, meter of a kind of item code in view of the deficiencies of the prior art It calculates machine equipment and storage medium and the code segment abandoned is obtained by the detection to method name in code file and annotation, can have Effect clears up code, improves code operational efficiency, the later maintenance of advantageous code.
In order to achieve the above objectives, the technical solution of the application provides the maintaining method, device, computer of a kind of item code Equipment and storage medium.
This application discloses a kind of maintaining methods of item code, comprising the following steps:
Multiple code files in acquisition project, are numbered each code file, and to each code file In code be scanned, the method name and annotation in the code of each code file are obtained, by the method name and note Release carried out with the number of each code file it is corresponding, and store in the database;
Method name in the database is summarized, the called number of each method name is obtained;
According to the method name be called number in each code file method name and annotation clear up.
Preferably, described be numbered each code file, and the code in each code file is swept It retouches, obtains the method name in the code of each code file, comprising:
Each code file is numbered, and according to the number order successively to the generation in each code file Code is scanned, and obtains the method name in the code of each code file;
It is inquired in code file corresponding with the method name according to the method name, obtains the method name and exist First trip position and tail line position in code file corresponding with the method name are set, and are stored in the database.
Preferably, the annotation in the code for obtaining each code file, comprising:
Default first comment flags, the second comment flags, the first detection line number and the second detection line number;
It is carried out in the first detection line number before the first trip position of the method name according to first comment flags Detection then records first trip position locating for first comment flags and tail line position if there is first comment flags exist It sets;
It is carried out in the second detection line number before the first trip position of the method name according to second comment flags Detection then records first trip position locating for second comment flags and tail line position if there is second comment flags exist It sets.
Preferably, the method name in the database summarizes, the called number of each method name is obtained, Include:
It is inquired in the database according to the method name, obtains all code texts corresponding with each method name The number of part;
The statistics of code file number corresponding with the method name is carried out according to the number of the code file, is obtained every The called number of a method name.
Preferably, the number being called according to the method name is to the method name and note in each code file It releases before being cleared up, comprising:
Default first method type, second method type, the first cumulative number threshold value and the second cumulative number threshold value;
The called Method type of the method name is detected, if the called Method type of the method name is described the When one Method type, the number that the method name is called is compared with the first cumulative number threshold value, if described When the called Method type of method name is the second method type, by the called number and described second of the method name Cumulative number threshold value is compared.
Preferably, the number being called according to the method name is to the method name and note in each code file It releases and is cleared up, comprising:
Each code file is successively detected, if the method name in the code file has annotation, records institute State the corresponding position of method name, method name, location of annotated information and code file number;
If the method name no noting in the code file, when the Method type that the method name is called is described When the number that first method type and the method name are called is less than or equal to the first cumulative number threshold value, the side is recorded The corresponding position of religious name, method name and code file number;
If the method name no noting in the code file, when the Method type that the method name is called is described When the number that second method type and the method name are called is less than or equal to the second cumulative number threshold value, the side is recorded The corresponding position of religious name, method name and code file number;
The corresponding position of the method name, method name of record, location of annotated information and code file number are sent.
Preferably, the number being called according to the method name is to the method name and note in each code file It releases and is cleared up, comprising:
Each code file is successively detected, if the method name in the code file has annotation, according to described The position of method name and the annotation is deleted by the method name and annotation;
If the method name no noting in the code file, when the Method type that the method name is called is described When the number that first method type and the method name are called is less than or equal to the first cumulative number threshold value, according to the side The position of religious name is deleted by the method name;
If the method name no noting in the code file, when the Method type that the method name is called is described When the number that second method type and the method name are called is less than or equal to the second cumulative number threshold value, according to the side The position of religious name is deleted by the method name.
Disclosed herein as well is a kind of maintenance device of item code, described device includes:
Code scans module: each code file is numbered in the multiple code files being set as in acquisition project, and Code in each code file is scanned, the method name and note in the code of each code file are obtained It releases, the method name and annotation is carried out with the number of each code file corresponding, and storage is in the database;
Data summarization module: being set as summarizing the method name in the database, obtains each method name and is adjusted Number;
Code maintenance module: the number for being set as being called according to the method name is to the side in each code file Religious name and annotation are cleared up.
Disclosed herein as well is a kind of computer equipment, the computer equipment includes memory and processor, described to deposit Computer-readable instruction is stored in reservoir to be made when the computer-readable instruction is executed by one or more processors Obtain the step of one or more processors execute maintaining method described above.
Disclosed herein as well is a kind of storage medium, the storage medium can be read and write by processor, and the storage medium is deposited Computer instruction is contained, when the computer-readable instruction is executed by one or more processors, so that one or more processing Device executes the step of maintaining method described above.
The beneficial effect of the application is: the application is obtained and is abandoned by the detection to method name in code file and annotation Code segment can effectively clear up code, improve code operational efficiency, the later maintenance of advantageous code.
Detailed description of the invention
Fig. 1 is a kind of flow diagram of the maintaining method of item code of the application one embodiment;
Fig. 2 is a kind of flow diagram of the maintaining method of item code of second embodiment of the application;
Fig. 3 is a kind of flow diagram of the maintaining method of item code of the application third embodiment;
Fig. 4 is a kind of flow diagram of the maintaining method of item code of the 4th embodiment of the application;
Fig. 5 is a kind of flow diagram of the maintaining method of item code of the 5th embodiment of the application;
Fig. 6 is a kind of flow diagram of the maintaining method of item code of the 6th embodiment of the application;
Fig. 7 is a kind of flow diagram of the maintaining method of item code of the 6th embodiment of the application;
Fig. 8 is a kind of maintenance device structural schematic diagram of item code of the embodiment of the present application.
Specific embodiment
It is with reference to the accompanying drawings and embodiments, right in order to which the objects, technical solutions and advantages of the application are more clearly understood The application is further elaborated.It should be appreciated that specific embodiment described herein is only used to explain the application, and It is not used in restriction the application.
Those skilled in the art of the present technique are appreciated that unless expressly stated, singular " one " used herein, " one It is a ", " described " and "the" may also comprise plural form.It is to be further understood that being arranged used in the description of the present application Diction " comprising " refer to that there are the feature, integer, step, operation, element and/or component, but it is not excluded that in the presence of or addition Other one or more features, integer, step, operation, element, component and/or their group.
A kind of maintaining method process of item code of the application one embodiment is as shown in Figure 1, the present embodiment includes Following steps:
Step s101, multiple code files in acquisition project, is numbered each code file, and to described each Code in code file is scanned, and method name and annotation in the code of each code file is obtained, by the side Religious name and annotation carried out with the number of each code file it is corresponding, and storage in the database;
Specifically, each exploration project would generally include multiple code files, and can be comprising many in each code file Method, class and interface, can be related to calling mutually again between the method, class and interface, therefore can be to entire project All code files are scanned, and also the code file can be numbered before being scanned to the code file, The coding rule can be to be numbered with number, can also be numbered with subtitle, for distinguishing each code file;Institute Stating scanning can be carried out by the reflection mechanism of java, and the java reflection mechanism refers in operating status, for any One class can know all properties and method of this class;For any one object, its any side can be called Method and attribute;This dynamic acquisition information and the function of dynamic call object method are known as the reflection mechanism of java language, when After being scanned to all code files, available method name and annotation in each code file, the method Name refers to the title of each call method, and the annotation refers to the annotation to the call method, wherein the called side Method is a part of program, and the annotation is not a part of program.
Specifically, after an each pair of code file scans through and gets method name and annotation, can by the method name and The specific location of annotation is recorded, and the position includes the first trip position of the method name and tail line position is set, the annotation First trip position and tail line position are set, and the method name and annotation are carried out with the number of code file corresponding, are stored in database In, after being scanned through to all code files, the position of all method names and annotation will be obtained and numbered with code file Between corresponding relationship.
Step s102 summarizes the method name in the database, obtains the called number of each method name;
Specifically, since each method name may occur in any one code file, i.e., by any one code File is called, therefore can be counted by the number occurred to method name in the code file to the method name, Obtain the called number of each method name.
Step s103, the number being called according to the method name is to the method name and annotation in each code file It is cleared up.
Specifically, whether can there is corresponding annotation to detect method name each in code file first, if described Method name has annotation, then can directly clear up the method name and the annotation.
Specifically, if do not annotated by detection discovery the method name, when getting called time of method name After number, it can judge whether the method name is often called according to the number that the method name is called, for example, can set in advance Call number threshold value is set, and the number that the method name is called is compared with the call number threshold value, if described The called number of method name is greater than the call number threshold value, then illustrates that the method name is often called, be not it is idle or The code segment of person's redundancy cannot be directly deleted, otherwise can be according to position of the method name in code file to the side Religious name is cleared up.
In the present embodiment, by the detection to method name in code file and annotation, the code segment abandoned is obtained, can be had Effect clears up code, improves code operational efficiency, the later maintenance of advantageous code.
Fig. 2 is a kind of maintaining method flow diagram of item code of second embodiment of the application, as shown, institute Step s101 is stated, each code file is numbered, and the code in each code file is scanned, obtains institute State the method name in the code of each code file, comprising:
Each code file is numbered in step s201, and according to the number order successively to each code Code in file is scanned, and obtains the method name in the code of each code file;
Specifically, first each code file can be numbered, before being scanned to code file to all Code file distinguishes;It then can be according to the number order of the code file successively to the generation in each code file Code be scanned, the number order can be it is descending or ascending, only need to by all code files traverse sweep Completion is retouched, after scanned, can be obtained the method name in the code of each code file.
Step s202 is inquired in code file corresponding with the method name according to the method name, obtains institute It states first trip position and tail line position of the method name in code file corresponding with the method name to set, and stores in the database.
Specifically, after scanning is to method name in code file, it can be according to the method name in corresponding code text It is inquired in part, gets the corresponding lines of code of the method name, since a call method would generally include one section of generation Code includes many line codes, therefore the lines of code includes that first trip position and tail line position are set.
It, can be right by the scanning acquisition methods name to method name and the position in code file in the present embodiment The method name is effectively deleted.
Fig. 3 is a kind of maintaining method flow diagram of item code of the application third embodiment, as shown, institute Step s101 is stated, the annotation in the code of each code file is obtained, comprising:
Step s301 presets the first comment flags, the second comment flags, the first detection line number and the second detection line number;
Specifically, first comment flags and second comment flags for detect annotation in code file whether In the presence of and specific position, for example, first comment flags can be " // " symbol, and second comment flags can be with "/* " symbol, wherein since comment flags are not a part of program, usually in pairs occur, for identify start and Ending, then with the ending of " // " symbol, starts, then with " */" symbol if it is with the beginning of " // " symbol if it is with "/* " symbol Ending.
Specifically, the detection line number is corresponding with the comment flags, before the detection line number is used for call method The comment flags are detected in the detection line number, since usual " // " symbol is only present in same a line, that is, are being adjusted Occur in the lastrow of method, therefore the first detection line number can be set as 1 row, and usually "/* " symbol occur can It can be multirow, i.e., occur in the first few lines of call method, generally all in 4-5 row or so, seldom occur more than 10 rows, therefore institute Stating the second detection line number can be set as 10 rows.
Step s302 goes according to first detection of first comment flags before the first trip position of the method name It is detected on number, if there is first comment flags exist, then records first trip position locating for first comment flags And tail line position is set;
Specifically, according to first comment flags in step s301 before the first trip position of the method name described in It is detected in first detection line number, if the first detection line number is set as 1, in the first trip position of the method name Previous row is detected, and is detected whether with the presence of symbol corresponding with first comment flags, if so, then explanation has annotation In the presence of, it records first trip position locating for first comment flags and tail line position is set, if only a line, first trip position and tail Line position is set identical.
Step s303 goes according to second detection of second comment flags before the first trip position of the method name It is detected on number, if there is second comment flags exist, then records first trip position locating for second comment flags And tail line position is set.
Specifically, according to second comment flags in step s301 before the first trip position of the method name described in It is detected in second detection line number, if the second detection line number is set as 10, in the first trip position of the method name Preceding 10 row detected one by one to preceding 1 row, detect whether with the presence of symbol corresponding with first comment flags, if Have, then explanation records first trip position locating for first comment flags and tail line position is set with the presence of annotation.
In the present embodiment, by setting annotation callout and is detected, can effectively detect the presence of annotation, and carry out phase The deletion of code segment is answered, code operational efficiency is improved.
Fig. 4 is a kind of maintaining method flow diagram of item code of the 4th embodiment of the application, as shown, institute Step s102 is stated, the method name in the database is summarized, obtains the called number of each method name, comprising:
Step s401 is inquired in the database according to the method name, is obtained corresponding with each method name The number of all code files;
Specifically, can summarize in the database to all method names first, each method name is then counted respectively Called number, the called number of each method name of statistics can be by counting the corresponding code of each method name The number of file carries out, i.e., is inquired in the database by the method name, and it is corresponding all to obtain the method name Code file number, wherein a code file number represents primary.
Step s402 carries out the system of code file number corresponding with the method name according to the number of the code file Meter obtains the called number of each method name.
Specifically, can be carried out according to the number of the code file since a code file number represents once The statistics of code file number corresponding with the method name obtains the called number of each method name, and is cached.
In the present embodiment, the number being called by acquisition methods name can effectively differentiate whether the method name needs It is cleaned, improves code maintenance efficiency.
Fig. 5 is a kind of maintaining method flow diagram of item code of the 5th embodiment of the application, as shown, institute Step s103 is stated, the number being called according to the method name is to the method name in each code file and annotates progress clearly Before reason, comprising:
Step s501 presets first method type, second method type, the first cumulative number threshold value and the second cumulative number Threshold value;
Specifically, call method can be divided into interface class and realize class, wherein interface class and reality due in code development Idle or redundancy the judgement of the existing corresponding call method of class is also different, as long as example, realize the call method of class by Called it is primary be believed that the call method be it is important, cannot be cleaned;And the call method of interface class needs It is called repeatedly can just be considered the call method be it is important, cannot be cleaned.Therefore first method class can be preset Type, second method type, the first cumulative number threshold value and the second cumulative number threshold value, wherein the first method type and institute State second method type for distinguish be interface class or realization class, the first cumulative number threshold value and the second cumulative number threshold Value carried out with the method type it is corresponding, for judging whether corresponding with the method type call method needs to clear up.
Step s502, the called Method type of detection the method name, if the method class that the method name is called When type is the first method type, the number that the method name is called is compared with the first cumulative number threshold value It is right, if the Method type that the method name is called is the second method type, the method name is called secondary Number is compared with the second cumulative number threshold value.
Specifically, the Method type that can be called to the method name detects, if detecting the method name quilt When the Method type of calling is the first method type, the number and described first that the method name can be called are accumulative secondary Number threshold value is compared, for example, the first cumulative number threshold value can be set as if the first method type is interface class 2, if the number that the method name is called is greater than 2, illustrate that the method name should not be cleaned;If detecting the side When the called Method type of religious name is the second method type, the number and described second that the method name can be called Cumulative number threshold value is compared, for example, if the second method type is to realize class, the first cumulative number threshold value It can be set as 1, if the number that the method name is called is greater than 1, illustrate that the method name should not be cleaned.
It, can be effectively to described by detecting the Method type and called number of call method in the present embodiment Call method is cleared up, and code operational efficiency is improved.
Fig. 6 is a kind of maintaining method flow diagram of item code of the 6th embodiment of the application, as shown, institute Step s103 is stated, the number being called according to the method name is to the method name in each code file and annotates progress clearly Reason, comprising:
Step s601 successively detects each code file, if the method name in the code file has annotation, Then record the corresponding position of the method name, method name, location of annotated information and code file number;
Specifically, can successively detect to all code files, the detection can be according to the code in database The corresponding relationship of file and method name and annotation carries out, and can inquire in the database each code file, if institute Stating has method name in code file, can carry out annotation inquiry to the method name, if the method name has annotation, record institute State the corresponding position of method name, method name, location of annotated information and code file number.
Step s602, if the method name no noting in the code file, when the method that the method name is called When type is that the number that the first method type and the method name are called is less than or equal to the first cumulative number threshold value, Record the method name, the corresponding position of method name and code file number;
Specifically, continuing to judge whether the method name leaves unused if method name no noting in the code file Or redundancy, the method for the judgement can carry out judgement and being adjusted to the method name by the Method type to the method name It is carried out with the judgement of number, i.e., when the Method type that the method name is called is the first method type and the method name Called number be less than or equal to the first cumulative number threshold value when, record the method name, the corresponding position of method name and Code file number.
Step s603, if the method name no noting in the code file, when the method that the method name is called When type is that the number that the second method type and the method name are called is less than or equal to the second cumulative number threshold value, Record the method name, the corresponding position of method name and code file number;
Specifically, continuing to judge whether the method name leaves unused if method name no noting in the code file Or redundancy, the method for the judgement can carry out judgement and being adjusted to the method name by the Method type to the method name It is carried out with the judgement of number, i.e., when the Method type that the method name is called is the second method type and the method name Called number be less than or equal to the second cumulative number threshold value when, record the method name, the corresponding position of method name and Code file number.
Step s604, by the corresponding position of the method name, method name, location of annotated information and the code file of record number into Row is sent.
Specifically, after be detected to all code files, get the method name recorded in all code files, The corresponding position of method name, location of annotated information and code file number, the method name that the method name of above-mentioned record as needs to clear up, Therefore the method name of the record, the corresponding position of method name, location of annotated information and code file can be numbered and is exported, informed User clears up.
In the present embodiment, by recording the corresponding position of method name, method name for needing to clear up, location of annotated information and code text Part is numbered and is exported, and can effectively be cleared up code file, and code operational efficiency is improved.
Fig. 7 is a kind of maintaining method flow diagram of item code of the 6th embodiment of the application, as shown, institute Step s103 is stated, the number being called according to the method name is to the method name in each code file and annotates progress clearly Reason, comprising:
Step s701 successively detects each code file, if the method name in the code file has annotation, The method name and annotation are deleted according to the position of the method name and the annotation;
Specifically, can successively detect to all code files, the detection can be according to the code in database The corresponding relationship of file and method name and annotation carries out, and can inquire in the database each code file, if institute Stating has method name in code file, can carry out annotation inquiry to the method name, can be in number if the method name has annotation According to inquiring the method name and the corresponding position of the annotation in library, and can be corresponding according to the method name and the annotation Position is deleted by the method name and annotation.
Step s702, if the method name no noting in the code file, when the method that the method name is called When type is that the number that the first method type and the method name are called is less than or equal to the first cumulative number threshold value, The method name is deleted according to the position of the method name;
Specifically, continuing to judge whether the method name leaves unused if method name no noting in the code file Or redundancy, the method for the judgement can carry out judgement and being adjusted to the method name by the Method type to the method name It is carried out with the judgement of number, i.e., when the Method type that the method name is called is the first method type and the method name When called number is less than or equal to the first cumulative number threshold value, it is corresponding the method name can be inquired in the database Position, and the method name can be deleted according to the method name corresponding position.
Step s703, if the method name no noting in the code file, when the method that the method name is called When type is that the number that the second method type and the method name are called is less than or equal to the second cumulative number threshold value, The method name is deleted according to the position of the method name.
Specifically, continuing to judge whether the method name leaves unused if method name no noting in the code file Or redundancy, the method for the judgement can carry out judgement and being adjusted to the method name by the Method type to the method name It is carried out with the judgement of number, i.e., when the Method type that the method name is called is the second method type and the method name When called number is less than or equal to the second cumulative number threshold value, it is corresponding the method name can be inquired in the database Position, and the method name can be deleted according to the method name corresponding position.
In the present embodiment, by the detection to method name call number and annotation in code file to the method name and note It releases and is directly deleted, code operational efficiency can be effectively improved.
A kind of maintenance device structure of item code of the embodiment of the present application is as shown in Figure 8, comprising:
Code scans module 801, data summarization module 802 and code maintenance module 803;Wherein, code scans module 801 It is connected with data summarization module 802, data summarization module 802 is connected with code maintenance module 803;Code scans module 801 is set The multiple code files being set in acquisition project, are numbered each code file, and in each code file Code is scanned, and obtains method name and annotation in the code of each code file, by the method name and annotation and The number of each code file is corresponded to, and is stored in the database;Data summarization module 802 is set as to the number Summarized according to the method name in library, obtains the called number of each method name;Code maintenance module 803 is set as according to institute State the called number of method name in each code file method name and annotation clear up.
The embodiment of the present application also discloses a kind of computer equipment, and the computer equipment includes memory and processor, Computer-readable instruction is stored in the memory, the computer-readable instruction is executed by one or more processors When, so that one or more processors execute the step in maintaining method described in the various embodiments described above.
The embodiment of the present application also discloses a kind of storage medium, and the storage medium can be read and write by processor, the storage Device is stored with computer-readable instruction, when the computer-readable instruction is executed by one or more processors so that one or Multiple processors execute the step in maintaining method described in the various embodiments described above.
Those of ordinary skill in the art will appreciate that realizing all or part of the process in above-described embodiment method, being can be with Relevant hardware is instructed to complete by computer program, which can be stored in a computer-readable storage and be situated between In matter, the program is when being executed, it may include such as the process of the embodiment of above-mentioned each method.Wherein, storage medium above-mentioned can be The non-volatile memory mediums such as magnetic disk, CD, read-only memory (Read-Only Memory, ROM) or random storage note Recall body (Random Access Memory, RAM) etc..
Each technical characteristic of embodiment described above can be combined arbitrarily, for simplicity of description, not to above-mentioned reality It applies all possible combination of each technical characteristic in example to be all described, as long as however, the combination of these technical characteristics is not deposited In contradiction, all should be considered as described in this specification.
The several embodiments of the application above described embodiment only expresses, the description thereof is more specific and detailed, but simultaneously The limitation to the application the scope of the patents therefore cannot be interpreted as.It should be pointed out that for those of ordinary skill in the art For, without departing from the concept of this application, various modifications and improvements can be made, these belong to the guarantor of the application Protect range.Therefore, the scope of protection shall be subject to the appended claims for the application patent.

Claims (10)

1. a kind of maintaining method of item code, which comprises the following steps:
Multiple code files in acquisition project, are numbered each code file, and in each code file Code is scanned, and obtains method name and annotation in the code of each code file, by the method name and annotation and The number of each code file is corresponded to, and is stored in the database;
Method name in the database is summarized, the called number of each method name is obtained;
According to the method name be called number in each code file method name and annotation clear up.
2. the maintaining method of item code as described in claim 1, which is characterized in that described to be compiled to each code file Number, and the code in each code file is scanned, the method name in the code of each code file is obtained, Include:
Each code file is numbered, and according to the number order successively to the code in each code file into Row scanning, obtains the method name in the code of each code file;
Inquired in code file corresponding with the method name according to the method name, obtain the method name with institute The first trip position and tail line position stated in the corresponding code file of method name are set, and are stored in the database.
3. the maintaining method of item code as claimed in claim 2, which is characterized in that described to obtain each code file Code in annotation, comprising:
Default first comment flags, the second comment flags, the first detection line number and the second detection line number;
It is detected in the first detection line number before the first trip position of the method name according to first comment flags, If there is first comment flags exist, then records first trip position locating for first comment flags and tail line position is set;
It is detected in the second detection line number before the first trip position of the method name according to second comment flags, If there is second comment flags exist, then records first trip position locating for second comment flags and tail line position is set.
4. the maintaining method of item code as described in claim 1, which is characterized in that the method in the database Name is summarized, and the called number of each method name is obtained, comprising:
It is inquired in the database according to the method name, obtains all code files corresponding with each method name Number;
The statistics that code file number corresponding with the method name is carried out according to the number of the code file, obtains each side The called number of religious name.
5. the maintaining method of item code as described in claim 1, which is characterized in that described called according to the method name Number to the method name in each code file and before annotation clears up, comprising:
Default first method type, second method type, the first cumulative number threshold value and the second cumulative number threshold value;
The called Method type of the method name is detected, if the Method type that the method name is called is the first party When method type, the number that the method name is called is compared with the first cumulative number threshold value, if the method When the called Method type of name is the second method type, the number that the method name is called is added up with described second Frequency threshold value is compared.
6. the maintaining method of item code as claimed in claim 5, which is characterized in that described called according to the method name Number in each code file method name and annotation clear up, comprising:
Each code file is successively detected, if the method name in the code file has annotation, records the side The corresponding position of religious name, method name, location of annotated information and code file number;
If the method name no noting in the code file, when the Method type that the method name is called is described first When the number that Method type and the method name are called is less than or equal to the first cumulative number threshold value, the method is recorded Name, the corresponding position of method name and code file number;
If the method name no noting in the code file, when the Method type that the method name is called is described second When the number that Method type and the method name are called is less than or equal to the second cumulative number threshold value, the method is recorded Name, the corresponding position of method name and code file number;
The corresponding position of the method name, method name of record, location of annotated information and code file number are sent.
7. the maintaining method of item code as claimed in claim 5, which is characterized in that described called according to the method name Number in each code file method name and annotation clear up, comprising:
Each code file is successively detected, if the method name in the code file has annotation, according to the method The position of name and the annotation is deleted by the method name and annotation;
If the method name no noting in the code file, when the Method type that the method name is called is described first When the number that Method type and the method name are called is less than or equal to the first cumulative number threshold value, according to the method name Position the method name is deleted;
If the method name no noting in the code file, when the Method type that the method name is called is described second When the number that Method type and the method name are called is less than or equal to the second cumulative number threshold value, according to the method name Position the method name is deleted.
8. a kind of maintenance device of item code, which is characterized in that described device includes:
Code scans module: each code file is numbered in the multiple code files being set as in acquisition project, and to institute The code stated in each code file is scanned, and obtains method name and annotation in the code of each code file, will The method name and annotation carried out with the number of each code file it is corresponding, and storage in the database;
Data summarization module: being set as summarizing the method name in the database, obtains what each method name was called Number;
Code maintenance module: the number for being set as being called according to the method name is to the method name in each code file It is cleared up with annotation.
9. a kind of computer equipment, which is characterized in that the computer equipment includes memory and processor, in the memory It is stored with computer-readable instruction, when the computer-readable instruction is executed by one or more processors, so that one Or multiple processors are executed as described in any one of claims 1 to 7 the step of maintaining method.
10. a kind of storage medium, which is characterized in that the storage medium can be read and write by processor, and the storage medium is stored with Computer instruction, when the computer-readable instruction is executed by one or more processors, so that one or more processors are held Row is as described in any one of claims 1 to 7 the step of maintaining method.
CN201910524813.3A 2019-06-18 2019-06-18 Method, device, computer equipment and storage medium for maintaining project codes Active CN110399132B (en)

Priority Applications (2)

Application Number Priority Date Filing Date Title
CN201910524813.3A CN110399132B (en) 2019-06-18 2019-06-18 Method, device, computer equipment and storage medium for maintaining project codes
PCT/CN2019/119072 WO2020253080A1 (en) 2019-06-18 2019-11-18 Project code maintenance method and apparatus, computer device, and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910524813.3A CN110399132B (en) 2019-06-18 2019-06-18 Method, device, computer equipment and storage medium for maintaining project codes

Publications (2)

Publication Number Publication Date
CN110399132A true CN110399132A (en) 2019-11-01
CN110399132B CN110399132B (en) 2023-12-22

Family

ID=68323202

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910524813.3A Active CN110399132B (en) 2019-06-18 2019-06-18 Method, device, computer equipment and storage medium for maintaining project codes

Country Status (2)

Country Link
CN (1) CN110399132B (en)
WO (1) WO2020253080A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111722874A (en) * 2020-06-24 2020-09-29 中国平安财产保险股份有限公司 Automatic cleaning method, device, equipment and storage medium for mobile terminal codes
WO2020253080A1 (en) * 2019-06-18 2020-12-24 平安科技(深圳)有限公司 Project code maintenance method and apparatus, computer device, and storage medium

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102662736A (en) * 2012-03-09 2012-09-12 北京神州数码思特奇信息技术股份有限公司 Method for acquiring calling relationship of component based on system source code
CN106598828A (en) * 2015-10-14 2017-04-26 阿里巴巴集团控股有限公司 Method and device for determining invalid class in source code
US20180081655A1 (en) * 2016-09-16 2018-03-22 Oracle International Corporation Metadata-Driven Binding of Converted Source Code to Original Source Code
CN109753286A (en) * 2018-12-28 2019-05-14 四川新网银行股份有限公司 A method of the code method based on functional label counts its call number
CN109783081A (en) * 2018-12-27 2019-05-21 百富计算机技术(深圳)有限公司 A kind of development approach of application program, device and Integrated Development Tool
CN109871319A (en) * 2019-01-18 2019-06-11 深圳壹账通智能科技有限公司 Item code scan method, device, computer equipment and storage medium

Family Cites Families (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8201157B2 (en) * 2006-05-24 2012-06-12 Oracle International Corporation Dependency checking and management of source code, generated source code files, and library files
CN104809071B (en) * 2015-05-14 2017-08-11 北京润科通用技术有限公司 A kind of code test method and device
CN106484401B (en) * 2016-09-23 2019-07-23 东北大学 A kind of Automated Refactoring of object-oriented software
CN110399132B (en) * 2019-06-18 2023-12-22 平安科技(深圳)有限公司 Method, device, computer equipment and storage medium for maintaining project codes

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102662736A (en) * 2012-03-09 2012-09-12 北京神州数码思特奇信息技术股份有限公司 Method for acquiring calling relationship of component based on system source code
CN106598828A (en) * 2015-10-14 2017-04-26 阿里巴巴集团控股有限公司 Method and device for determining invalid class in source code
US20180081655A1 (en) * 2016-09-16 2018-03-22 Oracle International Corporation Metadata-Driven Binding of Converted Source Code to Original Source Code
CN109783081A (en) * 2018-12-27 2019-05-21 百富计算机技术(深圳)有限公司 A kind of development approach of application program, device and Integrated Development Tool
CN109753286A (en) * 2018-12-28 2019-05-14 四川新网银行股份有限公司 A method of the code method based on functional label counts its call number
CN109871319A (en) * 2019-01-18 2019-06-11 深圳壹账通智能科技有限公司 Item code scan method, device, computer equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
李宁: "《独门架构 Java Web开发应用详解》", 中国铁道出版社, pages: 61 *

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2020253080A1 (en) * 2019-06-18 2020-12-24 平安科技(深圳)有限公司 Project code maintenance method and apparatus, computer device, and storage medium
CN111722874A (en) * 2020-06-24 2020-09-29 中国平安财产保险股份有限公司 Automatic cleaning method, device, equipment and storage medium for mobile terminal codes
CN111722874B (en) * 2020-06-24 2024-04-02 中国平安财产保险股份有限公司 Automatic cleaning method, device and equipment for mobile terminal codes and storage medium

Also Published As

Publication number Publication date
WO2020253080A1 (en) 2020-12-24
CN110399132B (en) 2023-12-22

Similar Documents

Publication Publication Date Title
US10572863B2 (en) Systems and methods for managing allocation of machine data storage
US8290994B2 (en) Obtaining file system view in block-level data storage systems
CN108255925A (en) A kind of display methods and its terminal of data list structure alteration
CN104899016B (en) Allocating stack Relation acquisition method and device
ATE341141T1 (en) DATA MANAGEMENT SYSTEM AND PROCEDURES
CN110309336A (en) Image search method, device, system, server and storage medium
CN104239443B (en) A kind of storage method of serialized data operation log
CN108108127A (en) A kind of file reading and system
CN107704203A (en) It polymerize delet method, device, equipment and the computer-readable storage medium of big file
CN110399132A (en) Maintaining method, device, computer equipment and the storage medium of item code
US20120131428A1 (en) Web page crawling method, web page crawling device and computer storage medium thereof
CN110147203A (en) A kind of file management method, device, electronic equipment and storage medium
CN110888837A (en) Object storage small file merging method and device
CN110262870A (en) Utilize method, apparatus, computer equipment and the storage medium of dump document alignment exception
CN110750494A (en) Hierarchical storage system of files in computer field
CN103324407A (en) Information processing apparatus and information processing method
CN101150822B (en) A method for telecommunication operator to collect user numbers
CN111625506A (en) Distributed data deleting method, device and equipment based on deleting queue
US20160055211A1 (en) Apparatus and method for memory storage and analytic execution of time series data
CN106886471A (en) A kind of read-write fault detection method and system based on disk in linux
CN109669814A (en) A kind of restoration methods of Metadata Service, device, equipment and readable storage medium storing program for executing
CN115454947A (en) Method, device and equipment for storing unstructured data and storage medium
CN114281769A (en) Method and device for managing files on disk, computer equipment and storage medium
CN114675783A (en) Data storage method, system, equipment and medium
CN106649458A (en) Method and system for detecting file update amount

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant