CN108459962A - Code specification detection method, device, terminal device and storage medium - Google Patents

Code specification detection method, device, terminal device and storage medium Download PDF

Info

Publication number
CN108459962A
CN108459962A CN201810063331.8A CN201810063331A CN108459962A CN 108459962 A CN108459962 A CN 108459962A CN 201810063331 A CN201810063331 A CN 201810063331A CN 108459962 A CN108459962 A CN 108459962A
Authority
CN
China
Prior art keywords
code
packaged
detection
testing result
script
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
CN201810063331.8A
Other languages
Chinese (zh)
Other versions
CN108459962B (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 Puhui Enterprise Management Co Ltd
Original Assignee
Ping An Puhui Enterprise Management 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 Puhui Enterprise Management Co Ltd filed Critical Ping An Puhui Enterprise Management Co Ltd
Priority to CN201810063331.8A priority Critical patent/CN108459962B/en
Publication of CN108459962A publication Critical patent/CN108459962A/en
Application granted granted Critical
Publication of CN108459962B publication Critical patent/CN108459962B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

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/3616Software analysis for verifying properties of programs using software metrics

Abstract

The invention discloses a kind of code specification detection method, device, terminal device and storage mediums.This method includes the following steps for being packaged construction platform and executing:It obtains the code that client is sent and is packaged request, it includes code to be packaged that code, which is packaged request,;It is packaged and is asked based on code, the code specification that acquisition access in advance is packaged construction platform detects script;It is treated using code specification detection script and is packaged the normative detection of code progress, obtain testing result;If testing result is when detecting to pass through, treats packing code and be packaged, obtain targeted software programs.This method is treated using code specification detection script is packaged the normative automatic detection of code progress so that code to be packaged uniformly writes specification, improves the efficiency and accuracy of code detection.The targeted software programs got effectively prevent the code incompatibility problem caused by code specification disunity so that targeted software programs can be with normal operation.

Description

Code specification detection method, device, terminal device and storage medium
Technical field
The present invention relates to field of computer technology more particularly to a kind of code specification detection method, device, terminal devices And storage medium.
Background technology
In Current software project (especially Large-Scale Projects) development process, it need to assist to complete by different developers soft The code of the code of the different phase of part project development either different function is by the code in all stages or institute's functional generation Code carries out Software package by unified packing construction platform, to obtain software program.The code in all stages or institute are active The code of energy need to be detected by tester, be beaten detecting the errorless packing construction platform progress software that can just be submitted to later Packet.Since what each developer had oneself writes custom, be submitted to be packaged construction platform code it is more random, and It tends not to indicate the function that code is realized, i.e., the ununified code specification of the code that each developer submits so that Code detection process efficiency is relatively low, need to expend a large amount of detection time of tester.Moreover, this manually examined using tester The code that different developers submit is surveyed, can not ensure the accuracy rate of detection so that the code for writing different developers closes And when being packaged, may there is a situation where to occur between the code that different developers write incompatible so that its code merges The software program of packing is not normally functioning.
Invention content
A kind of code specification detection method of offer of the embodiment of the present invention, device, terminal device and storage medium, to solve Existing efficiency is low and the problem of accuracy rate can not ensure when currently employed manual detection mode detection different code.
In a first aspect, the embodiment of the present invention provides a kind of code specification detection method, including it is packaged construction platform and executes Following steps:
It obtains the code that client is sent and is packaged request, it includes code to be packaged that the code, which is packaged request,;
It is packaged and is asked based on the code, obtained and access the code specification detection foot for being packaged construction platform in advance This;
Script is detected using the code specification, normative detection is carried out to the code to be packaged, obtains detection knot Fruit;
If the testing result is when detecting to pass through, to be packaged to the code to be packaged, obtain targeted software programs.
Second aspect, the embodiment of the present invention provide a kind of code specification detection device, including:
Code is packaged acquisition request module, and the code for obtaining client transmission is packaged request, and the code packing is asked It asks including code to be packaged;
Code specification detects script acquisition module, for being packaged request based on the code, obtains described in access in advance The code specification for being packaged construction platform detects script;
Testing result acquisition module, for using code specification detection script to the code to be packaged into professional etiquette Plasticity detects, and obtains testing result;
Targeted software programs acquisition module, for the testing result be detection pass through when, by the code to be packaged It is packaged, obtains targeted software programs.
The third aspect, the embodiment of the present invention provide a kind of terminal device, including memory, processor and are stored in described In memory and the computer program that can run on the processor, the processor are realized when executing the computer program The step of code specification detection method.
Fourth aspect, the embodiment of the present invention provide a kind of computer readable storage medium, the computer-readable storage medium Matter is stored with computer program, and the computer program realizes the step of the code specification detection method when being executed by processor Suddenly.
Code specification detection method, device, terminal device and storage medium provided in an embodiment of the present invention are based on code It is packaged acquisition request and accesses the code specification detection script for being packaged construction platform in advance, script is detected using the code specification Code to be packaged in request is packaged to code and carries out normative detection so that code to be packaged uniformly writes specification, realizes generation The automatic detection of the normative detection of code, need not manually be detected, improve the efficiency and accuracy of code detection.Detection is tied Fruit is that the code to be packaged that detection passes through carries out packing processing so that the targeted software programs got were effectively prevented due to generation Code incompatibility problem caused by the normative disunity of code so that targeted software programs can be with normal operation.
Description of the drawings
In order to illustrate the technical solution of the embodiments of the present invention more clearly, below by institute in the description to the embodiment of the present invention Attached drawing to be used is needed to be briefly described, it should be apparent that, the accompanying drawings in the following description is only some implementations of the present invention Example, for those of ordinary skill in the art, without having to pay creative labor, can also be according to these attached drawings Obtain other attached drawings.
Fig. 1 is a flow chart of code specification detection method in the embodiment of the present invention 1.
Fig. 2 is a specific schematic diagram of step S30 in Fig. 1.
Fig. 3 is a specific schematic diagram of step S40 in Fig. 1.
Fig. 4 is a functional block diagram of code specification detection device in the embodiment of the present invention 2.
Fig. 5 is a schematic diagram of terminal device in the embodiment of the present invention 4.
Specific implementation mode
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation describes, it is clear that described embodiments are some of the embodiments of the present invention, instead of all the embodiments.Based on this hair Embodiment in bright, the every other implementation that those of ordinary skill in the art are obtained without creative efforts Example, shall fall within the protection scope of the present invention.
Embodiment 1
Fig. 1 shows the flow chart of code specification detection method in the present embodiment.The code specification detection method application In being packaged construction platform, carry out being packaged the detection of advance line code normalization for treating packing code, and detection is passed through Code to be packaged is packaged, to generate targeted software programs.So that program to be packaged has normalization, reaches item code specification and want It asks, packing code progress code detection, to provide the efficiency or accuracy rate of code detection, section is treated without passing through tester Less manpower cost and development time.Wherein, it refers to being packaged for treating packing code to form software to be packaged construction platform The platform of program.In the present embodiment, it can be that the integrated packing based on Jenkins configurations and structure script is flat to be packaged construction platform Platform is generally both needed to by the operating procedures such as compressing, obscuring and merge, finally when being packaged construction platform and being packaged to code Form software program.As shown in Figure 1, the code specification detection method includes the following steps for being packaged construction platform and executing:
S10:It obtains the code that client is sent and is packaged request, it includes code to be packaged that code, which is packaged request,.
Wherein, code be packaged request refer to will write completion code to be packaged be sent to packing construction platform be packaged The request of processing.After generally writing the different phase of one software project of completion or the code of different function in developer, need All codes involved by the software project are packaged, to form software program.Code to be packaged refer to the needs that write into Row is packaged the code of processing.Client is that the terminal of information exchange is carried out with user, including but not limited in the present embodiment Computer.After developer is write by client completion code, code to be packaged is obtained, and built to packing by client Platform improves code and is packaged request.
Specifically, it is packaged construction platform and obtains the code packing request that client is sent, which is packaged request and carries Carry out the code to be packaged for being packaged processing.The code to be packaged can be the code for realizing a certain function, can also be reality The code of existing at least two functions.
S20:It is packaged and is asked based on code, the code specification that acquisition access in advance is packaged construction platform detects script.
Wherein, code specification detection script refers to being submitted to the written in code to be packaged for being packaged construction platform for detecting Normative script.It includes but not limited to " dev ", " bug " and " note " these three codes that the code specification, which detects script, The code specification of type detects script, wherein " dev " refers to detecting the generation to be packaged that code function is " demand development types " Code, " bug " refer to detecting the code to be packaged that code function is " defect repair type ", and " note " refers to that detection code function is The code to be packaged of " resource file type ".
Specifically, after the code that packing construction platform gets client transmission is packaged request, packing can be triggered and built The call instruction for calling code specification detection script in platform.The call instruction refers to being packaged the tune being arranged in construction platform The instruction of script is detected with code specification, which triggers after getting code and being packaged request.
The code specification detection script of three kinds of type of codes can be called individually and can also be called simultaneously, be beaten for treating Packet code carries out normative detection.Ought only occur in " dev ", " bug " and " note " three kinds of type of codes in code to be packaged It is a kind of when, then only need to call corresponding code specification detection script to treat and be packaged code and carry out normative detection. When wait be packaged in code occur " dev ", " bug " and " note " three kinds of type of codes at least two when, then simultaneously calling pair At least two code specifications detection script answered, which is treated, is packaged the normative detection of code progress.It can be based on code to be packaged Actual conditions, which are treated, is packaged the corresponding code specification detection script of code progress flexible configuration.
S30:It is treated using code specification detection script and is packaged the normative detection of code progress, obtain testing result.
Specifically, foot is detected based on the corresponding code specification of the corresponding Code obtaining to be packaged of different code type This, detects script using code specification and carries out normative detection to the code to be packaged of respective code type, acquisition pair respectively The testing result answered.Wherein, the corresponding codes and standards of the code specification detection script of three kinds of type of codes are as follows:Demand is opened The codes and standards for sending out type are " #wizard number+[dev]+desired contents ", and the codes and standards of defect repair type are " # Wizard number+[bug]+bug change content ";The codes and standards of resource file type are that " #wizard numbers+[note]+and carries Hand over content ".
Specifically, it when being packaged the character strings such as appearance " dev ", " bug ", " note " in code, then obtains and the character Corresponding code specification detection script of going here and there, which is treated, is packaged the normative detection of code progress.Code specification detects script and uses Node.js language realizes that Node.js is the running environment of a JavaScript, which is substantially for file The resource of system, database etc provides interface.Node.js language is a generation based on JavaScript running environment editors Code language, user can give Node.js language with the Javascript codes of system for writing and compiling grade or server end and be held to explain Row, the class libraries of each Node.js contain each class function of very abundant, are needed according to certainly using the user of Node.js Oneself service logic registers corresponding call back function.Here call back function refers to the use write in code normalization detection script To detect the function of code specification to be packaged.These call back functions are all asynchronous executions, it means that in code structure, The sequence for being not rely on itself appearance of call back function executes corresponding operation, but waits for corresponding event triggering that can hold The corresponding operation of row.
Code specification detection script is realized using Node.js language, can accomplish that asynchronous execution operates accordingly.Specifically For:When wait be packaged occur at least two in code and need to carry out the type of code of normative detection when, first in code to be packaged The type of code of a normative detection of need progress calls corresponding code specification detection script to treat and is packaged code progress specification Property detection when, without waiting for code specification detection script and execute completions, so that it may to call second need progress normalization The corresponding code specification detection script of type of code of detection, which is treated, is packaged the corresponding normative detection of code progress.It such as waits beating When occurring " dev " and " bug " two kinds of normative type of codes detected in packet code, need to call respectively corresponding " dev " and " bug " code specification is detected script and carries out normative detection, the code write using Node.js language to the code to be packaged Normalization detection script can accomplish that the normative detection of two type of codes is performed simultaneously, and need not wait " dev " type of code Normative detection after the completion of, then execute the normative detection of " bug " type of code, improve the efficiency of normative detection, section The execution time of code specification detection script is saved.
S40:If testing result is when detecting to pass through, treats packing code and be packaged, obtain targeted software programs.
Specifically, targeted software programs refer to treating to be packaged the normative detection of code progress, and testing result is to pass through Need be packaged code composition computer program.It is packaged code progress specification when being treated based on code specification detection script Property detection, when being packaged code and meeting the codes and standards in corresponding code specification detection script, corresponding testing result is Detection passes through.It is the code to be packaged that detection passes through for testing result, packing construction platform can treat packing code and be beaten Packet processing, obtains targeted software programs.The targeted software programs are stored in code storage, which refers to being pre-created For storing the databases of all targeted software programs, which is connected with construction platform is packaged, and packing construction platform exists It treats after being packaged code packing, obtained targeted software programs is sent to connected code storage and are stored.
Code storage is managed using gitlab, and gitlab is a code management tools, can browse through source code, pipe Manage aacode defect and annotation.Gitlab code management tools can manage the access information to code storage, and user is facilitated to browse The code release submitted simultaneously can provide a file history library and carry out the code stored in record code warehouse record.Gitlab generations Code management tool also provides a code snippet collecting function, can easily realize that the duplication of code uses.
S50:If testing result is to detect obstructed out-of-date, generation code revision information, and code revision information is sent to Client.
Code revision information refers to the codes and standards that code to be packaged does not meet code specification detection script, needs to treat It is packaged the corresponding code information in part that code is modified.Wherein, code revision information includes at least one code to be modified Information, code information to be modified include code position and code revision specification.Wherein, code position refers to not meeting code specification Property detection script codes and standards code to be packaged where position, code revision specification refer to do not meet code specification examine The corresponding code specification of code to be packaged for surveying the codes and standards of script, to remind corresponding developer to be repaiied based on the code Change specification and changes code to be packaged.
In the present embodiment, it further includes sending the corresponding contact method of code to be packaged, the contact method that code, which is packaged request, The including but not limited to E-mail address of developer and/or tester.When the testing result of code normalization detection is obstructed It is out-of-date, it is packaged construction platform and sends code revision information to corresponding E-mail address, remind the developer and/or tester Based in code revision information code position and code revision specification to detect not by code to be packaged modify.
Step S10-S50 is packaged request by obtaining the code that client is sent, obtains code to be packaged.Based on code It is packaged acquisition request and accesses the code specification detection script for being packaged construction platform in advance, script pair is detected based on code specification Code to be packaged carries out normative detection so that code to be packaged uniformly writes specification, realizes the automatic of code specification detection Detection, improves the efficiency and accuracy of code detection, need not manually be detected, and avoids and detects not comprehensive or carelessness something lost Leakage.Moreover, being that the code to be packaged that detection passes through carries out packing processing to testing result so that the targeted software programs got It can be with normal operation.Testing result is that detection is obstructed out-of-date, generates code revision information and is simultaneously sent to client so that client Corresponding developer changes code to be packaged based on the code revision specification so that code to be packaged meets code specification detection The corresponding codes and standards of script.
In a specific embodiment, code to be packaged includes at least one code module, and each code module has one Corresponding type of code, as shown in Fig. 2, step S30, is treated using code specification detection script and be packaged code progress normalization Detection obtains testing result, specifically comprises the following steps:
S31:The corresponding type of code of each code module, acquisition and code word are read using code specification detection script The corresponding codes and standards of type.
Type of code refers to type determined by the function realized based on code module, and code module refers to a certain by realizing The module of the corresponding one section of complete code composition of class function.Type of code includes but not limited to that demand development types, defect are repaiied Multiple type and resource file type these three types.Wherein, the code module of demand development types is using " dev " character as code The annotation of module, the codes and standards for corresponding to code specification detection script are " #wizard number+[dev]+desired contents ". Annotation of the code module of defect repair type using " bug " character as code module corresponds to code specification and detects script Codes and standards be " #wizard number+[bug]+bug modification content ".The code module of resource file type is with note " characters As the annotation of code module, the codes and standards for corresponding to code specification detection script are that " #wizard numbers+[note]+and carries Hand over content ".
One code to be packaged includes at least one function of needing to realize, each function corresponds to a code module, because This, a code to be packaged includes at least one code module.Script is detected to each code module based on code specification Code confirms into line code type, after confirmation code module corresponding type of code, obtains in code specification detection script The codes and standards of corresponding type of code.The codes and standards are write for detecting each code module in code to be packaged Normalization.
S32:Code module is detected based on codes and standards, obtains testing result.
Based on codes and standards corresponding with type of code are got, treat be packaged code in each code module into Row detection, obtains testing result respectively.When the written in code in code module meets corresponding " #wizard number+[dev]+need Seek content ", " #wizard number+[bug]+bug modification content " or " #wizard is numbered, and+[note]+submits content " specification mark On time, then it is that detection passes through to obtain testing result, executes step S40.If the written in code in code module does not meet above-mentioned rule When any one of model standard, then it is not pass through to obtain testing result, needs to execute step S50.The testing result is used for anti- Whether the code module reflected in code to be packaged is write meets codes and standards, helps to detect each code mould in code to be packaged The normalization that block is write.
In a specific embodiment, step S32 is detected code module based on codes and standards, obtains detection knot Fruit specifically comprises the following steps:To, per line code, comparison inspection being carried out using regular expression in codes and standards and code module It surveys, obtains testing result.
Wherein, regular expression is also known as regular expression (Regular Expression, is often abbreviated as in code Regex, regexp or RE).Regular expression is a kind of logical formula to string operation, which is to character A kind of filter logic of string.Character string includes general character (letter between such as a to z) and spcial character (also known as " first word Symbol ", such as " $, *, &, # ,+,”).In the present embodiment, every line code in codes and standards and code module is using common The character string that character and specific character are formed.
Regular expression in the present embodiment is write according to three kinds of codes and standards, which is encapsulated in Code specification detects in script, and the corresponding regular expression of code specification detection script of different code type is different. The regular expression of " dev, demand exploitation " is " #wizard number+[dev]+character strings ";The canonical table of " bug defect repairs " It is " #wizard number+[bug]+character strings " up to formula;The regular expression of " submission of note resource files " is that " #wizard is numbered + [note]+character string ".It is treated based on the corresponding regular expression of each codes and standards and is packaged code progress contrasting detection, acquisition pair Compare testing result.If the every line code detected in code to be packaged is consistent with the regular expression of codes and standards, knot is detected Fruit is that detection passes through;If the regular expression for detecting the code and codes and standards in code to be packaged is inconsistent, testing result Do not pass through for detection.Packing code is treated using regular expression and is detected the automatic inspection, it can be achieved that code specification detection It surveys, improves the efficiency and accuracy of code detection, need not manually be detected, avoid and detect not comprehensive or carelessness omission.
In a specific embodiment, it as shown in figure 3, in step S40, that is, treats packing code and is packaged, obtain mesh Software program is marked, is specifically comprised the following steps:
S41:Obtain packing perform script of the configuration in being packaged construction platform.
It refers to that the perform script of automatic packaging is carried out to meeting the code to be packaged of code specification to be packaged perform script.When It gets when it is that detection passes through to be packaged the testing result of code, the timed task on Jenkins can be passed through by being packaged construction platform Trigger pre-configured packing perform script.Jenkins is an open source software project, is that the one kind developed based on Java is held Continuous integration tool, for monitoring the work for continuing to repeat.
Further, clocked flip packing perform script, which is timed the code to be packaged being packaged on construction platform, beats Packet can carry out being packaged construction platform operation caused by being packaged in real time to avoid construction platform is packaged to the code to be packaged got Frequently, there is the case where data congestion so that packaging operation can smoothly be executed by being packaged construction platform.
S42:Packing code is treated using packing perform script to be packaged, and targeted software programs are obtained.
It is packaged code using being packaged perform script and treating to be packaged code and be packaged specifically including to treat and is compressed, obscures With merge etc. operations.
It refers to treating the code being packaged in code be retracted automatically, shorten variable to treat and be packaged code progress squeeze operation Name deletes block bracket { } and goes the operations such as space, it is possible to reduce data package size.
Packing code is treated to carry out obscuring operation referring to treating packing code in the case where not destroying code implementing result Grammer merging is carried out, long character string is replaced with special character string, the code write can be simplified, is realized excellent Change the purpose of scripted code.
It refers to all codes being merged into a function, and offer one can match to treat packing code and merge operation The parameter list set.This is treated packing code and merges the number of requests that operates and can reduce when being packaged code and executing.
It treats and is packaged code and carries out packing processing, the targeted software programs of acquisition, can be with when user needs using downloading Download time is saved, speed of download is improved so that the targeted software programs of acquisition need to save using when downloading in user Download time, without voluntarily configuring, in order to which user uses.Packing processing is carried out moreover, treating and being packaged code, it is soft to obtain target Part program may make when being evaluated to destination application in the later stage, be not in because code specification does not meet code Standard criterion and influence review result.
Code specification detection method, device, terminal device and storage medium provided by the invention, by obtaining client The code of transmission is packaged request, obtains code to be packaged;Then, packing structure is accessed in advance based on code packing acquisition request to put down The code specification of platform detects script, detects the regular expression in script based on code specification and waits for different code type It is packaged code and carries out normative detection so that code to be packaged uniformly writes specification, realizes the automatic inspection of code specification detection It surveys, improves the efficiency and accuracy of code detection, need not manually be detected, avoid and detect not comprehensive or carelessness omission. Finally, be that the code to be packaged that passes through of detection carries out packing processing to testing result so that the targeted software programs of acquisition with Family needs to save download time using when downloading, and improves speed of download so that the targeted software programs got are effectively kept away The code incompatibility problem caused by code specification disunity is exempted from so that targeted software programs can be with normal operation.
It should be understood that the size of the serial number of each step is not meant that the order of the execution order in above-described embodiment, each process Execution sequence should be determined by its function and internal logic, the implementation process without coping with the embodiment of the present invention constitutes any limit It is fixed.
Embodiment 2
Fig. 4 shows the original with the one-to-one code specification detection device of code specification detection method in embodiment 1 Manage block diagram.It is packaged acquisition request module 10, code specification inspection as shown in figure 4, the code specification detection device includes code Survey script acquisition module 20, testing result acquisition module 30, targeted software programs acquisition module 40 and code revision acquisition of information Module 50.Wherein, code is packaged acquisition request module 10, code specification detection script acquisition module 20, testing result and obtains Code in the realization function and embodiment of module 30, targeted software programs acquisition module 40 and code revision data obtaining module 50 The corresponding step of normative detection method corresponds, and to avoid repeating, the present embodiment is not described in detail one by one.
Code is packaged acquisition request module 10, and the code for obtaining client transmission is packaged request, and code is packaged request Including code to be packaged.
Code specification detects script acquisition module 20, for being packaged request based on code, obtains access in advance and is packaged structure The code specification of Jianping platform detects script.
Testing result acquisition module 30 is packaged the normative inspection of code progress for being treated using code specification detection script It surveys, obtains testing result.
Targeted software programs acquisition module 40, for when testing result is that detection passes through, code to be packaged to be beaten Packet obtains targeted software programs.
Code revision data obtaining module 50, for being to detect obstructed out-of-date, generation code revision information in testing result, And code revision information is sent to client.
Preferably, testing result acquisition module 30 includes codes and standards acquiring unit 31 and testing result acquiring unit 32.
Codes and standards acquiring unit 31, for reading each code module corresponding generation using code specification detection script Code type obtains codes and standards corresponding with type of code.
Testing result acquiring unit 32 is detected code module for being based on codes and standards, obtains testing result.
Preferably, testing result acquiring unit 32 includes:To every line code in codes and standards and code module, using just Then expression formula carries out contrasting detection, obtains testing result.
Preferably, targeted software programs acquisition module 40 includes being packaged perform script acquiring unit 41 and targeted software programs Acquiring unit 42.
It is packaged perform script acquiring unit 41, for obtaining packing perform script of the configuration in being packaged construction platform.
Targeted software programs acquiring unit 42 is packaged for treating packing code using packing perform script, is obtained Targeted software programs.
Embodiment 3
The present embodiment provides a computer readable storage medium, computer journey is stored on the computer readable storage medium Sequence realizes code specification detection method in embodiment 1, to avoid repeating, here when the computer program is executed by processor It repeats no more.Alternatively, realizing in embodiment 2 each mould in code specification detection device when the computer program is executed by processor The function of block/unit, to avoid repeating, which is not described herein again.
Embodiment 4
Fig. 5 is the schematic diagram for the terminal device that one embodiment of the invention provides.As shown in figure 5, the terminal of the embodiment is set Standby 60 include:Processor 61, memory 62 and it is stored in the computer journey that can be run in memory 62 and on processor 61 Sequence 63, such as code specification detect program.Processor 61 realizes above-mentioned each code specification when executing computer program 63 Step in detection method embodiment, such as step S10 to S50 shown in FIG. 1.Alternatively, processor 61 executes computer program Realize that the function of each module/unit in above-mentioned each device embodiment, such as code shown in Fig. 4 are packaged acquisition request module when 63 10, code specification detection script acquisition module 20, testing result acquisition module 30, targeted software programs acquisition module 40 and generation The function of code modification information acquisition module 50.
Illustratively, computer program 63 can be divided into one or more module/units, one or more mould Block/unit is stored in memory 62, and is executed by processor 61, to complete the present invention.One or more module/units can To be the series of computation machine program instruction section that can complete specific function, the instruction segment is for describing computer program 63 at end Implementation procedure in end equipment 60.For example, code is packaged acquisition request module 10, code specification detects script acquisition module 20, testing result acquisition module 30, targeted software programs acquisition module 40 and code revision data obtaining module 50.
Terminal device 60 can be the computing devices such as desktop PC, notebook, palm PC and cloud server.Eventually End equipment may include, but be not limited only to, processor 61, memory 62.It will be understood by those skilled in the art that Fig. 5 is only eventually The example of end equipment 60 does not constitute the restriction to terminal device 60, may include components more more or fewer than diagram, or Combine certain components or different components, for example, terminal device can also include input-output equipment, network access equipment, Bus etc..
Alleged processor 61 can be central processing unit (Central Processing Unit, CPU), can also be Other general processors, digital signal processor (Digital Signal Processor, DSP), application-specific integrated circuit (Application Specific Integrated Circuit, ASIC), field programmable gate array (Field- Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic, Discrete hardware components etc..General processor can be microprocessor or the processor can also be any conventional processor Deng.
Memory 62 can be the internal storage unit of terminal device 60, such as the hard disk or memory of terminal device 60.It deposits Reservoir 62 can also be the plug-in type hard disk being equipped on the External memory equipment of terminal device 60, such as terminal device 60, intelligence Storage card (Smart Media Card, SMC), secure digital (Secure Digital, SD) card, flash card (Flash Card) Deng.Further, memory 62 can also both include terminal device 60 internal storage unit and also including External memory equipment.It deposits Reservoir 62 is used to store other programs and the data needed for computer program and terminal device.Memory 62 can be also used for temporarily When store the data that has exported or will export.
It is apparent to those skilled in the art that for convenience of description and succinctly, only with above-mentioned each work( Can unit, module division progress for example, in practical application, can be as needed and by above-mentioned function distribution by different Functional unit, module are completed, i.e., the internal structure of described device are divided into different functional units or module, more than completion The all or part of function of description.
In addition, each functional unit in each embodiment of the present invention can be integrated in a processing unit, it can also It is that each unit physically exists alone, it can also be during two or more units be integrated in one unit.Above-mentioned integrated list The form that hardware had both may be used in member is realized, can also be realized in the form of SFU software functional unit.
If the integrated module/unit be realized in the form of SFU software functional unit and as independent product sale or In use, can be stored in a computer read/write memory medium.Based on this understanding, the present invention realizes above-mentioned implementation All or part of flow in example method, can also instruct relevant hardware to complete, the meter by computer program Calculation machine program can be stored in a computer readable storage medium, the computer program when being executed by processor, it can be achieved that on The step of stating each embodiment of the method.Wherein, the computer program includes computer program code, the computer program generation Code can be source code form, object identification code form, executable file or certain intermediate forms etc..The computer-readable medium May include:Any entity or device, recording medium, USB flash disk, mobile hard disk, magnetic of the computer program code can be carried Dish, CD, computer storage, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium etc..It should be noted that described The content that computer-readable medium includes can carry out increasing appropriate according to legislation in jurisdiction and the requirement of patent practice Subtract, such as in certain jurisdictions, according to legislation and patent practice, computer-readable medium do not include be electric carrier signal and Telecommunication signal.
Embodiment described above is merely illustrative of the technical solution of the present invention, rather than its limitations;Although with reference to aforementioned reality Applying example, invention is explained in detail, it will be understood by those of ordinary skill in the art that:It still can be to aforementioned each Technical solution recorded in embodiment is modified or equivalent replacement of some of the technical features;And these are changed Or replace, the spirit and scope for various embodiments of the present invention technical solution that it does not separate the essence of the corresponding technical solution should all It is included within protection scope of the present invention.

Claims (10)

1. a kind of code specification detection method, which is characterized in that the following steps executed including being packaged construction platform:
It obtains the code that client is sent and is packaged request, it includes code to be packaged that the code, which is packaged request,;
It is packaged and is asked based on the code, obtained and access the code specification detection script for being packaged construction platform in advance;
Script is detected using the code specification, normative detection is carried out to the code to be packaged, obtains testing result;
If the testing result is when detecting to pass through, to be packaged to the code to be packaged, obtain targeted software programs.
2. code specification detection method as described in claim 1, which is characterized in that the acquisition testing result the step of Later, the code specification detection method further includes:
If the testing result is to detect obstructed out-of-date, generation code revision information, and the code revision information is sent to The client;
Wherein, the code revision information includes at least one code information to be modified, and the code information to be modified includes generation Code position and code revision specification.
3. code specification detection method as described in claim 1, which is characterized in that the code to be packaged includes at least one A code module, each code module have a corresponding type of code;
It is described that normative detection is carried out to the code to be packaged using code specification detection script, obtain testing result Including:
The corresponding type of code of each code module is read using code specification detection script, is obtained and the generation The corresponding codes and standards of code type;
The code module is detected based on the codes and standards, obtains testing result.
4. code specification detection method as claimed in claim 3, which is characterized in that described to be based on the codes and standards to institute It states code module to be detected, obtains testing result, including:
To, per line code, carrying out contrasting detection in the codes and standards and the code module using regular expression, obtaining Testing result.
5. code specification detection method as described in claim 1, which is characterized in that described to be carried out to the code to be packaged It is packaged, obtains targeted software programs, including:
Obtain packing perform script of the configuration in the packing construction platform;
The code to be packaged is packaged using the packing perform script, obtains targeted software programs.
6. a kind of code specification detection device, which is characterized in that including:
Code is packaged acquisition request module, and the code for obtaining client transmission is packaged request, and the code is packaged request bag Include code to be packaged;
Code specification detects script acquisition module, and for being packaged request based on the code, acquisition accesses the packing in advance The code specification of construction platform detects script;
Testing result acquisition module, it is normative for being carried out to the code to be packaged using code specification detection script Detection obtains testing result;
Targeted software programs acquisition module, for when the testing result is that detection passes through, the code to be packaged to be carried out It is packaged, obtains targeted software programs.
7. code specification detection device as claimed in claim 6, which is characterized in that the acquisition testing result the step of Later, the code specification detection device further includes:
Code revision data obtaining module, for being that detection is obstructed out-of-date in the testing result, generation code revision information, and The code revision information is sent to the client;
Wherein, the code revision information includes at least one code information to be modified, and the code information to be modified includes generation Code position and code revision specification.
8. code specification detection device as claimed in claim 6, which is characterized in that the code to be packaged includes at least one A code module, each code module have a corresponding type of code;
The testing result acquisition module includes:
Codes and standards acquiring unit, it is corresponding for reading each code module using code specification detection script Type of code obtains codes and standards corresponding with the type of code;
Testing result acquiring unit is detected the code module for being based on the codes and standards, obtains testing result.
9. a kind of terminal device, including memory, processor and it is stored in the memory and can be on the processor The computer program of operation, which is characterized in that the processor realizes such as claim 1 to 5 when executing the computer program The step of any one code specification detection method.
10. a kind of computer readable storage medium, the computer-readable recording medium storage has computer program, feature to exist In realization code specification detection method as described in any one of claim 1 to 5 when the computer program is executed by processor The step of.
CN201810063331.8A 2018-01-23 2018-01-23 Code normalization detection method and device, terminal equipment and storage medium Active CN108459962B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810063331.8A CN108459962B (en) 2018-01-23 2018-01-23 Code normalization detection method and device, terminal equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810063331.8A CN108459962B (en) 2018-01-23 2018-01-23 Code normalization detection method and device, terminal equipment and storage medium

Publications (2)

Publication Number Publication Date
CN108459962A true CN108459962A (en) 2018-08-28
CN108459962B CN108459962B (en) 2021-09-03

Family

ID=63238583

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810063331.8A Active CN108459962B (en) 2018-01-23 2018-01-23 Code normalization detection method and device, terminal equipment and storage medium

Country Status (1)

Country Link
CN (1) CN108459962B (en)

Cited By (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491924A (en) * 2018-12-21 2019-03-19 北京达佳互联信息技术有限公司 Code detection method, device, terminal and storage medium
CN109901831A (en) * 2019-01-22 2019-06-18 成都随安保网络技术有限公司 The multi-platform compatibility operation method and compatibility operation device of software
CN110069279A (en) * 2019-04-29 2019-07-30 南方电网科学研究院有限责任公司 A kind of method of calibration, device and the storage medium of DC control protective program
CN110704025A (en) * 2019-08-29 2020-01-17 贝壳技术有限公司 Method and device for generating coding specification tool, storage medium and electronic equipment
CN110704298A (en) * 2019-08-23 2020-01-17 北京奇艺世纪科技有限公司 Code verification method and device, terminal equipment and storage medium
CN110704297A (en) * 2019-08-15 2020-01-17 平安普惠企业管理有限公司 Code evaluation method and device, computer equipment and storage medium
CN110806980A (en) * 2019-11-04 2020-02-18 深信服科技股份有限公司 Detection method, device, equipment and storage medium
CN110866730A (en) * 2018-12-29 2020-03-06 北京安妮全版权科技发展有限公司 Code assessment system and method
CN111078568A (en) * 2019-12-20 2020-04-28 广州华多网络科技有限公司 Code specification method and device, computer equipment and storage medium
CN111427786A (en) * 2020-03-25 2020-07-17 中国建设银行股份有限公司 Abnormal Full GC problem detection method and device
CN113609004A (en) * 2021-07-17 2021-11-05 深圳开源互联网安全技术有限公司 Static code detection method and system
CN113672838A (en) * 2021-08-30 2021-11-19 挂号网(杭州)科技有限公司 Code repairing method and device, electronic equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140189641A1 (en) * 2011-09-26 2014-07-03 Amazon Technologies, Inc. Continuous deployment system for software development
CN104484172A (en) * 2014-12-11 2015-04-01 上海天脉聚源文化传媒有限公司 Method and device for packaging files
CN106095681A (en) * 2016-06-14 2016-11-09 深圳市彬讯科技有限公司 A kind of SVN integrated JSHint code detection method and system thereof
CN106293811A (en) * 2016-07-28 2017-01-04 北京中电普华信息技术有限公司 A kind of packing and issuing method and device automatically
CN107341399A (en) * 2016-04-29 2017-11-10 阿里巴巴集团控股有限公司 Assess the method and device of code file security

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20140189641A1 (en) * 2011-09-26 2014-07-03 Amazon Technologies, Inc. Continuous deployment system for software development
CN104484172A (en) * 2014-12-11 2015-04-01 上海天脉聚源文化传媒有限公司 Method and device for packaging files
CN107341399A (en) * 2016-04-29 2017-11-10 阿里巴巴集团控股有限公司 Assess the method and device of code file security
CN106095681A (en) * 2016-06-14 2016-11-09 深圳市彬讯科技有限公司 A kind of SVN integrated JSHint code detection method and system thereof
CN106293811A (en) * 2016-07-28 2017-01-04 北京中电普华信息技术有限公司 A kind of packing and issuing method and device automatically

Cited By (18)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109491924A (en) * 2018-12-21 2019-03-19 北京达佳互联信息技术有限公司 Code detection method, device, terminal and storage medium
CN110866730B (en) * 2018-12-29 2023-11-21 北京安妮全版权科技发展有限公司 Code checking system and method
CN110866730A (en) * 2018-12-29 2020-03-06 北京安妮全版权科技发展有限公司 Code assessment system and method
CN109901831B (en) * 2019-01-22 2022-06-21 成都随安保网络技术有限公司 Multi-platform compatible operation method and compatible operation device of software
CN109901831A (en) * 2019-01-22 2019-06-18 成都随安保网络技术有限公司 The multi-platform compatibility operation method and compatibility operation device of software
CN110069279A (en) * 2019-04-29 2019-07-30 南方电网科学研究院有限责任公司 A kind of method of calibration, device and the storage medium of DC control protective program
CN110069279B (en) * 2019-04-29 2023-08-08 南方电网科学研究院有限责任公司 Method, device and storage medium for checking direct current control protection program
CN110704297B (en) * 2019-08-15 2024-02-06 天翼安全科技有限公司 Code review method, device, computer equipment and storage medium
CN110704297A (en) * 2019-08-15 2020-01-17 平安普惠企业管理有限公司 Code evaluation method and device, computer equipment and storage medium
CN110704298A (en) * 2019-08-23 2020-01-17 北京奇艺世纪科技有限公司 Code verification method and device, terminal equipment and storage medium
CN110704025A (en) * 2019-08-29 2020-01-17 贝壳技术有限公司 Method and device for generating coding specification tool, storage medium and electronic equipment
CN110806980A (en) * 2019-11-04 2020-02-18 深信服科技股份有限公司 Detection method, device, equipment and storage medium
CN111078568A (en) * 2019-12-20 2020-04-28 广州华多网络科技有限公司 Code specification method and device, computer equipment and storage medium
CN111078568B (en) * 2019-12-20 2023-10-31 广州华多网络科技有限公司 Code specification method, apparatus, computer device and storage medium
CN111427786A (en) * 2020-03-25 2020-07-17 中国建设银行股份有限公司 Abnormal Full GC problem detection method and device
CN113609004A (en) * 2021-07-17 2021-11-05 深圳开源互联网安全技术有限公司 Static code detection method and system
CN113609004B (en) * 2021-07-17 2023-11-03 深圳开源互联网安全技术有限公司 Static code detection method and system
CN113672838A (en) * 2021-08-30 2021-11-19 挂号网(杭州)科技有限公司 Code repairing method and device, electronic equipment and storage medium

Also Published As

Publication number Publication date
CN108459962B (en) 2021-09-03

Similar Documents

Publication Publication Date Title
CN108459962A (en) Code specification detection method, device, terminal device and storage medium
US8336032B2 (en) Implementing enhanced template debug
US11645340B2 (en) Data store interface including application configurable format constraints for use in accessing or visualization of values stored an in-memory cache
US20080115116A1 (en) Method and apparatus for dynamically binding service component implementations for specific unit test cases
US9652353B2 (en) Monitoring business transaction failures involving database procedure calls
US9588872B2 (en) Discovery of code paths
CN108363564A (en) Entry modularization implementation method, device, terminal device and storage medium
US10078579B1 (en) Metrics-based analysis for testing a service
CN109358975A (en) A kind of analysis method, device, electronic equipment and storage medium that software is operating abnormally
CN108427731A (en) Processing method, device, terminal device and the medium of page code
CN109918435A (en) A kind of processing method and system of business interface
CN109284225A (en) A kind of quality determining method and electronic equipment of multi-person synergy exploitation programming code
CN110321275A (en) Program monitoring method, calculates equipment and storage medium at device
CN107025167A (en) The method and apparatus for carrying out data-flow analysis using compiler type information in processor trace log
US10127136B2 (en) Identifying and visualizing suboptimal memory layouts in software programs
US20070150866A1 (en) Displaying parameters associated with call statements
US11263115B2 (en) Problem diagnosis technique of memory corruption based on regular expression generated during application compiling
CN107506299B (en) Code analysis method and terminal equipment
CN114116509A (en) Program analysis method, program analysis device, electronic device, and storage medium
US10514969B2 (en) Bit-accurate-tracing analysis with applied memory region lifetimes
CN112000386A (en) Application implementation method and device
Shadab et al. Automatic Inference of Resource Leak Specifications
CN117236423A (en) Nuclear function calling method, device, equipment, storage medium and program product
CN116679912A (en) Code generation method, apparatus, device, storage medium, and computer program
CN113986740A (en) Method and device for acquiring code execution record of application

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