CN113448838A - Code processing method and device and electronic equipment - Google Patents

Code processing method and device and electronic equipment Download PDF

Info

Publication number
CN113448838A
CN113448838A CN202011439775.0A CN202011439775A CN113448838A CN 113448838 A CN113448838 A CN 113448838A CN 202011439775 A CN202011439775 A CN 202011439775A CN 113448838 A CN113448838 A CN 113448838A
Authority
CN
China
Prior art keywords
code
code file
command
file
target
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.)
Pending
Application number
CN202011439775.0A
Other languages
Chinese (zh)
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.)
Soyoung Technology Beijing Co Ltd
Original Assignee
Soyoung Technology Beijing 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 Soyoung Technology Beijing Co Ltd filed Critical Soyoung Technology Beijing Co Ltd
Priority to CN202011439775.0A priority Critical patent/CN113448838A/en
Publication of CN113448838A publication Critical patent/CN113448838A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • G06F11/3608Software analysis for verifying properties of programs using formal methods, e.g. model checking, abstract interpretation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis

Abstract

The application relates to a code processing method and device and electronic equipment. The code processing method comprises the following steps: retrieving a target code file cached in a first equipment terminal according to a set command, and extracting a modified first code file from the target code file; after the first code file is subjected to type conversion to obtain a second code file, code specification inspection is carried out; and if the code specification check result is correct, submitting the target code file to a second equipment terminal. The scheme provided by the application can improve the efficiency of code grammar specification checking and can also submit the accuracy of the code file.

Description

Code processing method and device and electronic equipment
Technical Field
The present application relates to the field of computer technologies, and in particular, to a code processing method and apparatus, and an electronic device.
Background
And in the process of developing the front-end code, code grammar specification checking is carried out, and after the checking is finished, the modified file is submitted to a remote warehouse.
In the related art, when the code syntax specification check is performed, all files of the current project are traversed, and the time consumption for performing the code syntax specification check in such a way is different for different computer systems and different project sizes. In the case of a computer with better performance and a small project file, the waiting time for code syntax specification checking in this way is slightly shorter, but in the case of a computer with poorer performance and a large project file, the waiting time for code syntax specification checking in this way is longer.
Therefore, the related art processing method is inefficient in performing code syntax specification checking.
Disclosure of Invention
In order to overcome the problems in the related art, the application provides a code processing method, a code processing device and electronic equipment, and the code processing method, the code processing device and the electronic equipment can improve the efficiency of code grammar specification checking.
A first aspect of the present application provides a code processing method, including:
retrieving a target code file cached in a first equipment terminal according to a set command, and extracting a modified first code file from the target code file;
after the first code file is subjected to type conversion to obtain a second code file, code specification inspection is carried out;
and if the code specification check result is correct, submitting the target code file to a second equipment terminal.
In one embodiment, the submitting the object code file to the second device includes:
acquiring a warehouse branch name of the first equipment end;
and splicing the warehouse branch name of the first equipment end with a code submitting command, executing the code submitting command after splicing, and submitting the target code file to a remote warehouse arranged at the second equipment end, wherein the remote warehouse arranged at the second equipment end comprises the warehouse branch of the first equipment end.
In one embodiment, the retrieving the object code file cached in the first device according to the setting command, and extracting the modified first code file from the object code file includes:
adding the target code file from the working area of the first equipment end to the cache area of the first equipment end according to a git add command;
and extracting the modified first code file in the target code file from the cache region according to a gitdiff command.
In one embodiment, the extracting the modified first code file of the target code files from the cache according to the gitdiff command comprises:
and if the file name containing the. vue suffix or the.js suffix exists in the target code file, extracting the file corresponding to the file name containing the. vue suffix or the.js suffix as the modified first code file.
In one embodiment, the obtaining the warehouse branch name of the first device side includes:
and acquiring the current modification information of the target code file according to the git status command, and matching the warehouse branch name of the first equipment end from the acquired modification information in a regular mode.
In one embodiment, after the first code file is subjected to type conversion to obtain a second code file, performing code specification checking includes:
performing file type conversion on the first code file to obtain a second code file, wherein the data type of the first code file is a character string type, and the data type of the second code file is an array type;
code specification checking is performed on the second code file using a code specification checking command.
In one embodiment, the code specification checking the second code file using a code specification check command includes:
and splicing the name of the second code file with a code specification checking command, executing the code specification checking command after splicing, and checking the code specification of the second code file.
In one embodiment, the code specification check command is an es-linet command or a linet command;
the code submission command is a Git command.
A second aspect of the present application provides a code processing apparatus comprising:
the retrieval module is used for retrieving the target code file cached in the first equipment terminal according to the set command and extracting the modified first code file from the target code file;
the checking module is used for carrying out code specification checking after the first code file extracted by the retrieval module is subjected to type conversion to obtain a second code file;
and the submitting module is used for submitting the target code file to a second equipment terminal if the code specification checking result of the checking module is correct.
In one embodiment, the commit module includes:
the branch name acquisition submodule is used for acquiring the warehouse branch name of the first equipment end;
and the command execution submodule is used for splicing the warehouse branch name of the first equipment end acquired by the branch name acquisition submodule with the code submission command, executing the code submission command after splicing, and submitting the target code file to a remote warehouse of a second equipment end, wherein the remote warehouse arranged at the second equipment end comprises the warehouse branch of the first equipment end.
In one embodiment, the retrieval module comprises:
the first command submodule is used for adding the target code file from the working area of the first equipment end to the cache area of the first equipment end according to a git add command;
and the second command submodule is used for extracting the modified first code file in the target code file from the cache region according to a gitdiff command.
A third aspect of the present application provides an electronic device comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method described above.
A fourth aspect of the present application provides a non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the above-described method.
The technical scheme provided by the application can comprise the following beneficial effects:
according to the scheme, before code specification inspection is carried out on the code file, the cached target code file is retrieved according to the set command, the modified first code file is extracted from the target code file, so that code specification inspection is only carried out on the modified code file, traversal inspection on all the code files of the target code file is not needed when code specification inspection is carried out, the efficiency of code specification inspection is improved, and meanwhile, subsequent command operation is facilitated.
Furthermore, the scheme provided by the application can automatically acquire the warehouse branch name, splice the warehouse branch name with the code submitting command, execute the code submitting command after splicing, and submit the target code file to the remote warehouse, so that errors possibly caused by manually inputting the warehouse branch name in the related technology are avoided, and the accuracy of submitting the code file is improved.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The foregoing and other objects, features and advantages of the application will be apparent from the following more particular descriptions of exemplary embodiments of the application, as illustrated in the accompanying drawings wherein like reference numbers generally represent like parts throughout the exemplary embodiments of the application.
FIG. 1 is a flowchart illustrating a code processing method according to an embodiment of the present application;
FIG. 2 is another schematic flow chart diagram illustrating a code processing method according to an embodiment of the present application;
FIG. 3 is another flowchart illustrating a code processing method according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of a code processing apparatus according to an embodiment of the present application;
fig. 5 is another schematic structural diagram of a code processing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device shown in an embodiment of the present application.
Detailed Description
Preferred embodiments of the present application will be described in more detail below with reference to the accompanying drawings. While the preferred embodiments of the present application are shown in the drawings, it should be understood that the present application may be embodied in various forms and should not be limited to the embodiments set forth herein. Rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the scope of the disclosure to those skilled in the art.
The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the application. As used in this application and the appended claims, the singular forms "a," "an," and "the" are intended to include the plural forms as well, unless the context clearly indicates otherwise. It should also be understood that the term "and/or" as used herein refers to and encompasses any and all possible combinations of one or more of the associated listed items.
It should be understood that although the terms "first," "second," "third," etc. may be used herein to describe various information, these information should not be limited to these terms. These terms are only used to distinguish one type of information from another. For example, first information may also be referred to as second information, and similarly, second information may also be referred to as first information, without departing from the scope of the present application. Thus, a feature defined as "first" or "second" may explicitly or implicitly include one or more of that feature. In the description of the present application, "a plurality" means two or more unless specifically limited otherwise.
Code grammar specification checking is carried out in the process of developing the front-end code of the related technology, and the file modified this time is submitted to a remote warehouse after the checking. However, when the related art performs code syntax specification checking, all files of the current project are traversed, which results in long code syntax specification checking time and low checking efficiency. The technical solutions of the embodiments of the present application are described in detail below with reference to the accompanying drawings. In this embodiment of the present application, the first device side is a local device side, the second device side is a remote server side, and the remote server side is provided with a remote warehouse, where the remote warehouse includes at least one warehouse branch of the first device side.
Fig. 1 is a flowchart illustrating a code processing method according to an embodiment of the present application.
In the embodiment of the application, a code processing device which can be used for code specification checking and file submission is designed, and the code processing method of the application is applied to the code processing device.
Referring to fig. 1, the method includes:
step S101, retrieving the target code file cached in the first equipment terminal according to the setting command, and extracting the modified first code file from the target code file.
In practical applications, the first device side generally refers to a local side where a programmer writes code, that is, the object code file is generally cached locally. However, in some special computer scenarios, if a programmer uses a cloud computer, that is, data of the computer is stored in the cloud, and only data writing and data transceiving operations are performed locally, the scenario may also run the code specification checking method in this embodiment, and the first device end in this embodiment may also be the cloud computer.
In the embodiment of the application, the target code file can be added to the cache region of the first equipment end from the working region of the first equipment end according to the git add command; and extracting the modified first code file in the target code file from the cache region according to the gitdiff command.
The target code file is a front-end development code file to be subjected to grammar specification checking, and the first code file is a modified code file. The modified code file typically has a modified file name, such as a file with a. vue suffix or a.js suffix, and is typically the first code file that has been modified.
The target code file can be a section of branch code in the front-end development code file in actual application. By performing step 101, the modified first code file can be retrieved by recognizing the suffix of the file name in the entire object code file. Because the modified code is generally a small part in the whole target code file in the actual code writing, the modified first code file can be retrieved before the code specification check is carried out, and the code specification check is necessary for the part of the code file, so that the efficiency can be improved.
And S102, after the first code file is subjected to type conversion to obtain a second code file, code specification inspection is carried out.
In the embodiment of the application, because the parameter type accepted by the Git command for executing the code specification check is an array type, the file type conversion can be performed on the first code file to obtain the second code file, wherein the data type of the first code file is a character string type, and the data type of the second code file is an array type; a code specification check is performed on the second code file using the code specification check command. The name of the second code file can be spliced with the code specification checking command, and the code specification checking command is executed after splicing to check the code specification of the second code file. For example, the name of the second code file is added after the code specification check command.
It should be understood that any command capable of executing code specification checking on a code file is within the scope of the embodiments of the present application, and is not limited to a specific code specification checking command.
Step S103, if the result of the code specification check is correct, the target code file is submitted to the second equipment terminal.
And after determining that the code specification check of the object code file is correct at the first equipment end, sending the object code file to a remote warehouse arranged at a second equipment end, wherein the second equipment end is a remote server end, and the remote server end is provided with the remote warehouse.
It can be found that, in the embodiment of the present application, before performing code specification check on a code file, a cached object code file is retrieved according to a set command, and a modified first code file is extracted from the object code file, so that code specification check only needs to be performed on the modified code file, and traversal check on all code files of the object code file is not needed when performing code specification check, thereby improving the efficiency of code specification check, and facilitating subsequent command operation.
Fig. 2 is another schematic flow chart of a code processing method according to an embodiment of the present application.
In the specific application of the code processing method, after the syntax specification is checked, the current project file, such as the object code file, is pushed to the remote repository, and this operation needs to be completed according to the related command of Git. In the related art, the command for executing Git requires a programmer to manually input the name of a warehouse branch of a remote warehouse, and since the development habits of each person are different, the lengths of the used warehouse branch names are different, and the naming modes may also be different, the wrong name of the warehouse branch is easily input, which results in failure of pushing or pushing to other people such as warehouse branches of other terminal devices. The embodiment of the application can further solve the problem and avoid errors which can occur when the warehouse branch name is manually input in the related art.
Referring to fig. 2, the method includes:
step 201, retrieving the target code file cached in the first device according to the setting command, and extracting the modified first code file from the target code file.
For the step 201, reference may be made to the content of the step 101 in the foregoing embodiment, which is not described herein again.
Step 202, performing file type conversion on the first code file to obtain a second code file.
In the embodiment of the application, because the parameter type accepted by the Git command for executing code specification check is an array type, the file type conversion can be carried out on the first code file to obtain a second code file; the data type of the first code file is a character string type, and the data type of the second code file is an array type.
In the embodiment of the present application, the setting operation in the embodiment of the present application is performed according to the Git command. Git is an open-source distributed version control system, can effectively process the version management of projects from very small to very large at high speed, and is version control software of an open source code developed for helping to manage a Linux kernel.
In the use of the Git command, since the parameter type accepted by the Git command (child _ process. spawn) for performing the code specification check is an array type, and the first code file retrieved in step 201 is presented in a string type, a file type conversion is required to obtain a second code file presented in an array type. The file name type of the code file can be converted from the character string type to the array type according to a command for operating the character string in the JavaScript, namely a split command.
And 203, splicing the name of the second code file with the code specification checking command, executing the code specification checking command after splicing, and checking the code specification of the second code file.
For example, the name of the second code file may be added to the end of the npm run es-line command or the npm run line command, the name of the second code file may be concatenated with the code specification check command, and then the code specification check command may be executed to perform the code specification check on the second code file.
And step 204, acquiring the warehouse branch name of the first equipment end.
According to the method and the device, the current modification information of the target code file can be obtained according to the git status command, and the warehouse branch name of the first device end is matched from the obtained modification information in a regular mode.
And 205, splicing the warehouse branch name of the first equipment end with the code submitting command, executing the code submitting command after splicing, and submitting the target code file to a remote warehouse arranged at the second equipment end.
In the embodiment of the present application, the remote warehouse provided at the second equipment side includes at least one warehouse branch of the first equipment side.
Compared with the related art, the warehouse branch name needs to be manually input in the related art, errors are prone to occurring, the warehouse branch name can be directly obtained and spliced with the code submitting command, the code submitting command is executed after splicing, and the target code file is submitted to the remote warehouse of the second equipment side, so that on one hand, the efficiency of the whole code specification checking process can be greatly improved, on the other hand, errors which may occur when the warehouse branch name is manually input in the related art are avoided, and the accuracy of submitting the code file is improved.
Fig. 3 is another flowchart illustrating a code processing method according to an embodiment of the present application. Fig. 3 describes the solution of the present application in more detail with respect to fig. 1 and 2. In this embodiment, the first device side is a local device side, the second device side is a remote server side, and the remote server side is provided with a remote warehouse including at least one warehouse branch of the first device side.
Referring to fig. 3, the method includes:
and step S301, executing the slp command at the first equipment end.
The embodiment of the application provides a code processing device as a detection tool, wherein the detection tool firstly executes an slp command by default, and the slp command is a default command of the detection tool.
And step S302, adding the target code file from the working area to the cache area according to the git add command.
And adding the target code file into the cache region from the working region according to a Git add command in the Git command, so that the cache region of the first equipment end stores the target code file.
In practical applications, the git add command is used to add the code file to be submitted from the working area to the cache area (i.e. the temporary storage area), and generally, the git add parameter-path format may be adopted, and if no parameter is added, the file for modification operation is defaulted to be added to the cache area.
Step S303, retrieving the modified code file in the target code file according to the git diff command.
The gitdiff command is typically used to compare differences in code files, typically differences in files between the working area and the cache area, i.e., differences in the working area and the working area of the file.
The modified code file in the target code file is retrieved based on the Git diff command for the Git hit. Where the gitdiff command may be: a gitdiff-cached-name-only to retrieve the modified code file in the local cache.
Since there is only a cache entry after the git add command, the git add command is typically executed first, followed by the git diff command. Wherein- -cached represents the cache, and- -name-only represents the file name of the code file that is only exposed after being modified. Therefore, according to the git diff command, the extracted code files are all the code files modified by the operation, so that when the subsequent checking is carried out according to the relevant code specification checking command of the es-lint, all the code files do not need to be traversed, the code specification checking efficiency can be greatly improved, and the subsequent command operation is facilitated.
Illustratively, the commands executed in the actual application in steps 302 and 303 are:
git add.&&git diff--cached--name-only
the result of executing the above command is:
bin/bindex.js
package.json
wherein-cached represents the cache, and-name-only represents the file name which is only shown and bin/bindex.js is the file name of the file suffix, and the file corresponding to the file name of the js suffix is the modified code file.
In step S304, it is determined whether or not a file name including. vue or.js as a suffix exists, and if so, the process proceeds to step S305, and if not, the process proceeds to step S312.
According to the executed command: the file name containing the vue or js suffix can be detected by gitdiff, cached, name-only, diff-filter, ACM, vue and js.
In step S305, a file corresponding to the file name including the. vue or the.js suffix is used as a modified code file, and the file name type of the modified code file is converted from a string type to an array type.
Generally, the modified code file will have the file name of. vue or.js as the suffix of the file, so that it can be determined whether the modified code file is the modified code file according to the file name of. vue or.js suffix. In step S305, a file corresponding to the file name including the. vue suffix or the.js suffix is extracted as a modified code file, based on the presence of the file name including the. vue suffix or the.js suffix in the target code file.
The retrieved information, i.e., the file name of the modified code file retrieved from the Git local cache, is shown in the type of the string, but the parameter type received by the internally executed command (child _ process. spawn) is an array type, so that a type conversion is required to convert the file name type of the code file from the string type to the array type. According to a command for operating the character string in the JavaScript, namely a split command, the file name type of the code file can be converted into an array type from the character string type.
And S306, splicing the file name of the modified code file with the code specification checking command.
Lint is a general term for tools for checking code formats, and specific tools include ES-Lint, JS-Lint, etc., but the ES-Lint can be used in the embodiments of the present application without being limited thereto. ES-Lint is a code instrumentation tool that recognizes ECMAScript and gives reports according to rules, using which low-level errors and the style of uniform code can be avoided. ECMAScript is a scripting language specification defined by Ecma international (formerly the european association of computer manufacturers) in the standard Ecma-262. This language is widely used on the world wide web, often referred to as JavaScript or Jscript, but in reality the latter two are implementations and extensions of the ECMA-262 standard.
In the present embodiment, the code specification checking command may be, for example, an es-line command or a line command, and may specifically be, for example, an npm run es-line command or an npm run line command. The file name of the modified code file can be added behind the npm run line command for splicing, for example: npm run line [ filename ]. Or, the file name of the modified code file can be added after the npm run es-line command for splicing, for example: npm run es-line [ filename ].
And step S307, executing the code specification checking command after the splicing processing, and checking the code specification of the modified code file.
Step S308, judging whether the code specification check is wrong, if the code specification check result is correct, executing step 311; if the code specification check results in a false positive, step 309 is performed.
Step S309, obtain the warehouse branch name corresponding to the current information modification.
According to the method and the device, the current modification information of the target code file can be obtained according to the git status command, and the warehouse branch name corresponding to the current information modification is matched from the obtained modification information in a regular mode. For example, the information of the current item modification, that is, the current modification information of the object code file, is obtained according to the git operation command, that is, the git status command, the content shown by the obtained information is shown in the utf8 format, and then the matching is performed by using the regular mode (match (/ ^ On branch (. +) \ s /) [1]), so as to match the warehouse branch name. According to the embodiment of the application, the warehouse branch name is directly obtained through program matching, and errors possibly caused by manual input of the warehouse branch name in the related technology are avoided.
And S310, splicing the warehouse branch name with the code submitting command, executing the code submitting command after splicing, and submitting the target code file to a remote warehouse set by a second equipment end.
In this step, the remote warehouse branch name is concatenated with the code submission command, i.e. the remote warehouse branch name is concatenated after the git command, which may be, for example: git push origin [ branch name ].
Step S311, feeding back the modified code file to check the detected modification error information.
And feeding back the modification error information detected by the code specification check of the modified code file according to the code specification check result so as to facilitate a programmer to modify the error code.
And step S312, outputting the result that the current project does not modify the code file.
In summary, the solution of the embodiment of the present application provides an efficient flow of code specification checking and remote repository submission, so that the code specification checking latency is reduced, and the code can be submitted to the remote repository with zero error. According to the scheme of the embodiment of the application, only one execution command is needed, the complexity of inputting the command is reduced, the waiting time of code specification checking is reduced, and the efficiency can be improved by 80-90%; in addition, the input error when the code is submitted to a remote warehouse is avoided, and the accuracy of submitting the code file is improved.
Corresponding to the embodiment of the application function implementation method, the application also provides a code processing device, electronic equipment and a corresponding embodiment.
Fig. 4 is a schematic structural diagram of a code processing apparatus according to an embodiment of the present application.
Referring to fig. 4, a code processing apparatus shown in an embodiment of the present application includes: a retrieval module 401, a checking module 402, and a submission module 403.
The retrieving module 401 is configured to retrieve the target code file cached in the first device according to the setting command, and extract the modified first code file from the target code file.
The checking module 402 is configured to perform code specification checking after the first code file extracted by the retrieving module 401 is subjected to type conversion to obtain a second code file.
A submitting module 403, configured to submit the target code file to the second device if the result of the code specification check of the checking module 401 is correct.
For example, the retrieving module 401 may add the target code file from the working area of the first device to the cache area of the first device according to the git add command; and extracting the modified first code file in the target code file from the cache region according to the gitdiff command.
For example, the checking module 402 may perform a file type conversion on a first code file to obtain a second code file, where a data type of the first code file is a character string type, and a data type of the second code file is an array type; a code specification check is performed on the second code file using the code specification check command. The name of the second code file can be spliced with the code specification checking command, and the code specification checking command is executed after splicing to check the code specification of the second code file.
For example, the submitting module 403 may determine that the object code file is checked by the code specification on the first device side without error, and then send the object code file to the second device side, where the second device side is a remote server side and the remote server side has a remote repository.
In the embodiment of the application, before the code processing device performs code specification inspection on the code file, the cached target code file is retrieved according to a set command, and the modified first code file is extracted from the target code file, so that the code specification inspection is only performed on the modified code file, and all the code files of the target code file do not need to be subjected to traversal inspection when the code specification inspection is performed, thereby improving the efficiency of the code specification inspection, and facilitating subsequent command operation.
Fig. 5 is another schematic structural diagram of a code processing apparatus according to an embodiment of the present application.
Referring to fig. 4, a code processing apparatus shown in an embodiment of the present application includes: a retrieval module 401, a checking module 402, and a submission module 403.
The functions of the retrieving module 401, the checking module 402 and the submitting module 403 are described in fig. 4, and are not described herein again.
In one embodiment, the commit module 403 includes: a branch name obtaining sub-module 4031 and a command executing sub-module 4032.
And the branch name obtaining sub-module 4031 is configured to obtain a warehouse branch name of the first device side.
The command execution submodule 4032 is configured to splice the warehouse branch name of the first device side acquired by the branch name acquisition submodule 4031 with the code submission command, execute the code submission command after the splicing, and submit the target code file to the remote warehouse of the second device side.
In one embodiment, the retrieval module 401 includes: a first command submodule 4011 and a second command submodule 4012.
The first command submodule 4011 is configured to add the target code file from the working area of the first device to the cache area of the first device according to the git add command.
The second command submodule 4012 is configured to extract the modified first code file from the target code file from the cache according to the gitdiff command.
With regard to the apparatus in the above-described embodiment, the specific manner in which each module performs the operation has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 6 is a schematic structural diagram of an electronic device shown in an embodiment of the present application. The electronic device may be, for example, but is not limited to, a computer terminal device.
Referring to fig. 6, an electronic device 600 includes a memory 610 and a processor 620.
The Processor 620 may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 610 may include various types of memory modules, such as system memory, Read Only Memory (ROM), and permanent storage. Wherein the ROM may store static data or instructions that are required by the processor 620 or other modules of the computer. The persistent storage device may be a read-write storage device. The persistent storage may be a non-volatile storage device that does not lose stored instructions and data even after the computer is powered off. In some embodiments, the persistent storage device employs a mass storage device (e.g., magnetic or optical disk, flash memory) as the persistent storage device. In other embodiments, the permanent storage may be a removable storage device (e.g., floppy disk, optical drive). The system memory may be a read-write memory device or a volatile read-write memory device, such as a dynamic random access memory. The system memory may store instructions and data that some or all of the processors require at runtime. In addition, the memory 610 may include any combination of computer-readable storage media, including various types of semiconductor memory chips (DRAM, SRAM, SDRAM, flash memory, programmable read-only memory), magnetic and/or optical disks, may also be employed. In some embodiments, memory 1010 may include a removable storage device that is readable and/or writable, such as a Compact Disc (CD), a read-only digital versatile disc (e.g., DVD-ROM, dual layer DVD-ROM), a read-only Blu-ray disc, an ultra-density optical disc, a flash memory card (e.g., SD card, min SD card, Micro-SD card, etc.), a magnetic floppy disc, or the like. Computer-readable storage media do not contain carrier waves or transitory electronic signals transmitted by wireless or wired means.
The memory 610 has stored thereon executable code that, when processed by the processor 620, may cause the processor 620 to perform some or all of the methods described above.
The aspects of the present application have been described in detail hereinabove with reference to the accompanying drawings. In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and for parts that are not described in detail in a certain embodiment, reference may be made to related descriptions of other embodiments. Those skilled in the art should also appreciate that the acts and modules referred to in the specification are not necessarily required in the present application. In addition, it can be understood that the steps in the method of the embodiment of the present application may be sequentially adjusted, combined, and deleted according to actual needs, and the modules in the device of the embodiment of the present application may be combined, divided, and deleted according to actual needs.
Furthermore, the method according to the present application may also be implemented as a computer program or computer program product comprising computer program code instructions for performing some or all of the steps of the above-described method of the present application.
Alternatively, the present application may also be embodied as a non-transitory machine-readable storage medium (or computer-readable storage medium, or machine-readable storage medium) having stored thereon executable code (or a computer program, or computer instruction code) which, when executed by a processor of an electronic device (or electronic device, server, etc.), causes the processor to perform part or all of the steps of the above-described method according to the present application.
Those of skill would further appreciate that the various illustrative logical blocks, modules, circuits, and algorithm steps described in connection with the applications disclosed herein may be implemented as electronic hardware, computer software, or combinations of both.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems and methods according to various embodiments of the present application. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
Having described embodiments of the present application, the foregoing description is intended to be exemplary, not exhaustive, and not limited to the disclosed embodiments. Many modifications and variations will be apparent to those of ordinary skill in the art without departing from the scope and spirit of the described embodiments. The terminology used herein is chosen in order to best explain the principles of the embodiments, the practical application, or improvements made to the technology in the marketplace, or to enable others of ordinary skill in the art to understand the embodiments disclosed herein.

Claims (13)

1. A code processing method, comprising:
retrieving a target code file cached in a first equipment terminal according to a set command, and extracting a modified first code file from the target code file;
after the first code file is subjected to type conversion to obtain a second code file, code specification inspection is carried out;
and if the code specification check result is correct, submitting the target code file to a second equipment terminal.
2. The method of claim 1, wherein the submitting the object code file to a second device comprises:
acquiring a warehouse branch name of the first equipment end;
and splicing the warehouse branch name of the first equipment end with a code submitting command, executing the code submitting command after splicing, and submitting the target code file to a remote warehouse arranged at the second equipment end, wherein the remote warehouse arranged at the second equipment end comprises the warehouse branch of the first equipment end.
3. The method according to claim 1, wherein the retrieving the target code file cached in the first device side according to the setting command, and extracting the modified first code file from the target code file comprises:
adding the target code file from the working area of the first equipment end to the cache area of the first equipment end according to a git add command;
and extracting the modified first code file in the target code file from the cache region according to a gitdiff command.
4. The method of claim 3, wherein the extracting the modified first one of the target code files from the cache according to the gitdiff command comprises:
and if the file name containing the. vue suffix or the.js suffix exists in the target code file, extracting the file corresponding to the file name containing the. vue suffix or the.js suffix as the modified first code file.
5. The method according to claim 2, wherein the obtaining of the warehouse branch name of the first device side comprises:
and acquiring the current modification information of the target code file according to the git status command, and matching the warehouse branch name of the first equipment end from the acquired modification information in a regular mode.
6. The method of claim 1, wherein performing a code specification check after type-converting the first code file into a second code file comprises:
performing file type conversion on the first code file to obtain a second code file, wherein the data type of the first code file is a character string type, and the data type of the second code file is an array type;
code specification checking is performed on the second code file using a code specification checking command.
7. The method of claim 6, wherein the code specification checking the second code file using a code specification check command comprises:
and splicing the name of the second code file with a code specification checking command, executing the code specification checking command after splicing, and checking the code specification of the second code file.
8. The method according to any one of claims 2 to 7,
the code specification checking command is an es-linet command or a linet command;
the code submission command is a Git command.
9. A code processing apparatus, comprising:
the retrieval module is used for retrieving the target code file cached in the first equipment terminal according to the set command and extracting the modified first code file from the target code file;
the checking module is used for carrying out code specification checking after the first code file extracted by the retrieval module is subjected to type conversion to obtain a second code file;
and the submitting module is used for submitting the target code file to a second equipment terminal if the code specification checking result of the checking module is correct.
10. The apparatus of claim 9, wherein the commit module comprises:
the branch name acquisition submodule is used for acquiring the warehouse branch name of the first equipment end;
and the command execution submodule is used for splicing the warehouse branch name of the first equipment end acquired by the branch name acquisition submodule with the code submission command, executing the code submission command after splicing, and submitting the target code file to a remote warehouse arranged at a second equipment end, wherein the remote warehouse arranged at the second equipment end comprises the warehouse branch of the first equipment end.
11. The apparatus of claim 9, wherein the retrieving module comprises:
the first command submodule is used for adding the target code file from the working area of the first equipment end to the cache area of the first equipment end according to a git add command;
and the second command submodule is used for extracting the modified first code file in the target code file from the cache region according to a gitdiff command.
12. An electronic device, comprising:
a processor; and
a memory having executable code stored thereon, which when executed by the processor, causes the processor to perform the method of any one of claims 1-8.
13. A non-transitory machine-readable storage medium having stored thereon executable code, which when executed by a processor of an electronic device, causes the processor to perform the method of any one of claims 1-8.
CN202011439775.0A 2020-12-11 2020-12-11 Code processing method and device and electronic equipment Pending CN113448838A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202011439775.0A CN113448838A (en) 2020-12-11 2020-12-11 Code processing method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202011439775.0A CN113448838A (en) 2020-12-11 2020-12-11 Code processing method and device and electronic equipment

Publications (1)

Publication Number Publication Date
CN113448838A true CN113448838A (en) 2021-09-28

Family

ID=77808527

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202011439775.0A Pending CN113448838A (en) 2020-12-11 2020-12-11 Code processing method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN113448838A (en)

Similar Documents

Publication Publication Date Title
US10824404B2 (en) Methods and systems for uploading a program based on a target network platform
RU2731327C1 (en) Protected logical load and shift command
US20160171104A1 (en) Detecting multistep operations when interacting with web applications
JP2022091685A (en) Generation of programming language corpus
CN112035443A (en) Big data execution method, system, equipment and storage medium based on Linux platform
CN110659210A (en) Information acquisition method and device, electronic equipment and storage medium
JP6925433B2 (en) Data validation device, data validation method and data validation program
US9779014B2 (en) Resilient mock object creation for unit testing
CN109388568B (en) Code testing method and device
CN111258905A (en) Defect positioning method and device, electronic equipment and computer readable storage medium
CN111475150B (en) Cross-language binding method, device, equipment and storage medium
CN111506904B (en) Method and device for online bug repair
CN110196952B (en) Program code search processing method, device, equipment and storage medium
CN107077365B (en) Selectively loading precompiled headers and/or portions thereof
CN113448838A (en) Code processing method and device and electronic equipment
US6854109B2 (en) Tool for converting .MAP file formats
CN115080114A (en) Application program transplanting processing method, device and medium
CN113672465A (en) Method, system, medium, terminal and unmanned aerial vehicle for generating process log system by process name
US20120174078A1 (en) Smart cache for a server test environment in an application development tool
CN112114811A (en) Compiling method, device and equipment
CN113504904A (en) User-defined function implementation method and device, computer equipment and storage medium
CN113448576A (en) File conversion method, device and related equipment
WO2023123019A1 (en) Cloud resource management method and device, and storage medium
CN113704020B (en) Method and device for analyzing error field data of solid state disk
CN111273940B (en) Method and device for uploading program file to code warehouse

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