CN109144517A - A kind of method and apparatus checking coding - Google Patents

A kind of method and apparatus checking coding Download PDF

Info

Publication number
CN109144517A
CN109144517A CN201810866286.XA CN201810866286A CN109144517A CN 109144517 A CN109144517 A CN 109144517A CN 201810866286 A CN201810866286 A CN 201810866286A CN 109144517 A CN109144517 A CN 109144517A
Authority
CN
China
Prior art keywords
coding
information
encoded information
target plug
query tree
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
CN201810866286.XA
Other languages
Chinese (zh)
Other versions
CN109144517B (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.)
JD Digital Technology Holdings Co Ltd
Jingdong Technology Holding Co Ltd
Original Assignee
Beijing Jingdong Financial Technology Holding 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 Beijing Jingdong Financial Technology Holding Co Ltd filed Critical Beijing Jingdong Financial Technology Holding Co Ltd
Priority to CN201810866286.XA priority Critical patent/CN109144517B/en
Publication of CN109144517A publication Critical patent/CN109144517A/en
Application granted granted Critical
Publication of CN109144517B publication Critical patent/CN109144517B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/40Transformation of program code
    • G06F8/41Compilation
    • G06F8/43Checking; Contextual analysis

Landscapes

  • Engineering & Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Stored Programmes (AREA)

Abstract

The invention discloses a kind of method and apparatus for checking coding, are related to field of computer technology.One specific embodiment of this method includes: the coded command received to target plug-in, obtains the encoded information of target plug-in in an encoding process;It determines the type of coding of encoded information, obtains coding check specification corresponding with target plug-in and type of coding;When encoded information meets coding check specification, the information query tree of target plug-in is updated based on encoded information.The embodiment checks coding during coding, enhances the timeliness of coded treatment, is convenient for subsequent time update, improves the validity of binary encoding;It is less that overall process manually participates in part, the case where reducing cost of labor and reduce erroneous judgement;According to specification masks edit specification, specification can be effectively reduced and write cost, while improving the communication convenience of operating personnel, easily extends, easily writes.

Description

A kind of method and apparatus checking coding
Technical field
The present invention relates to field of computer technology more particularly to a kind of method and apparatus for checking coding.
Background technique
IOS developing instrument is mainly XCode at present, during coding, can only prompt some simple morphological analyses As a result.But it for coding criterion, can only can just be found the problem by manual examination and verification.In addition to this, can lead to after end-of-encode The code analysis tool for crossing some professions is scanned analysis to entire engineering, finally obtains analysis result.
In the implementation of the present invention, at least there are the following problems for inventor's discovery prior art:
1) it needs to check code by manpower, cost of labor has been significantly greatly increased, can also exist and check omission, check mistake etc. Problem;
2) reuse tool after encoding and scan, real-time is poor, and issue handling has hysteresis quality, can not during coding and When find the problem and solve;
3) common static scanning tool only has some simple agreements, and tends not to meet actual development demand, but Some tools are unable to satisfy extension and require, even if extension, realization is also not easy.Therefore for using tool scans, rule is customized It is not strong, redaction rule higher cost, later maintenance difficulty.
Summary of the invention
In view of this, the embodiment of the present invention provides a kind of method and apparatus for checking coding, it is at least able to solve existing skill The problems such as high labor cost, processing lag, are difficult in maintenance in art.
To achieve the above object, according to an aspect of an embodiment of the present invention, a kind of method for checking coding, packet are provided It includes:
The coded command to target plug-in is received, the encoded information of the target plug-in in an encoding process is obtained;
It determines the type of coding of the encoded information, obtains and the target plug-in and type of coding is corresponding compiles Code checks specification;
When the encoded information meets the coding check specification, the target plug-in is updated based on the encoded information Information query tree.
Optionally, the type of coding of the determination encoded information obtains and the target plug-in and the coding The corresponding coding check specification of type, comprising:
Encoded information described in micronized analyzes the particle type of encoded information after micronized according to predetermined canonical mode, with Determine coding check specification corresponding with the target plug-in and the particle type;Wherein, the particle type is at least wrapped Include class, variable, method, function, attribute and macrodefinition.
Optionally, described when the encoded information meets the coding check specification, it is updated based on the encoded information The information query tree of the target plug-in, further includes:
The information query tree is traversed, tree node corresponding with the type of coding in the information query tree is obtained, when When the similarity of the encoded information and the tree node interior joint information is lower than predetermined threshold, updated based on the encoded information The information query tree.
Optionally, described when the similarity of the encoded information and the tree node interior joint information is lower than predetermined threshold When, the information query tree is updated based on the encoded information, comprising:
The relationship abstract for determining the encoded information, when the phase that the relationship of relationship abstract and the nodal information is made a summary When like degree lower than predetermined threshold, the information query tree is updated based on the encoded information.
Optionally, after the information query tree that the target plug-in is updated based on the encoded information, further includes: compile The encoded information is translated to generate compilation information, corresponding with the target plug-in compiles check gauge when the compilation information meets Fan Shi updates the information query tree based on the compilation information.
Optionally, before the reception is to the coded command of target plug-in, further includes: when detecting the target plug-in Start for the first time and there is no it is corresponding check specification when, according to the pre- of predetermined inspection specification masks and the target plug-in Determine parameter, generates corresponding check and standardize;Wherein, the inspection specification includes at least the coding check specification and the volume Translate inspection specification.
Optionally, the coding check specification include at least class specification, function specification, the specification of attribute, macrodefinition specification with And code block specification;The compiling checks that specification includes at least morphology specification, syntax gauge and meaning of one's words specification.
To achieve the above object, according to another aspect of an embodiment of the present invention, a kind of device for checking coding, packet are provided It includes:
Data obtaining module obtains the target plug-in in cataloged procedure for receiving the coded command to target plug-in In encoded information;
Specification obtains module, for determining the type of coding of the encoded information, obtains and the target plug-in and institute State the corresponding coding check specification of type of coding;
Query tree update module, for being based on the coding when the encoded information meets the coding check specification The information query tree of target plug-in described in information update.
Optionally, the specification obtains module, is used for: encoded information described in micronized, according to predetermined canonical mode, analysis The particle type of encoded information after micronized, to determine coding check corresponding with the target plug-in and the particle type Specification;Wherein, the particle type includes at least class, variable, device, function, attribute and macrodefinition.
Optionally, the query tree update module, is used for: traversing the information query tree, obtains the information query tree In tree node corresponding with the type of coding, when the similarity of the encoded information and the tree node interior joint information is lower than When predetermined threshold, the information query tree is updated based on the encoded information.
Optionally, the query tree update module, is used for: the relationship abstract of the encoded information is determined, when the relationship When the similarity that the relationship of abstract and the nodal information is made a summary is lower than predetermined threshold, the letter is updated based on the encoded information Cease query tree.
Optionally, the query tree update module, is also used to: compiling the encoded information to generate compilation information, works as institute When stating compilation information and meeting corresponding with target plug-in compiling and check specification, the information is updated based on the compilation information Query tree.
Optionally, further include specification generation module, be used for: when detecting that the target plug-in starts for the first time and do not deposit When checking specification accordingly, according to predetermined inspection specification masks and the predefined parameter of the target plug-in, generate corresponding Check specification;Wherein, the inspection specification includes at least the coding check specification and the compiling checks specification.
Optionally, the coding check specification include at least class specification, function specification, the specification of attribute, macrodefinition specification with And code block specification;
The compiling checks that specification includes at least morphology specification, syntax gauge and meaning of one's words specification.
To achieve the above object, according to an embodiment of the present invention in another aspect, provide it is a kind of check coding electronics set It is standby.
The electronic equipment of the embodiment of the present invention includes: one or more processors;Storage device, for storing one or more A program, when one or more of programs are executed by one or more of processors, so that one or more of processing The method that device realizes any of the above-described inspection coding.
To achieve the above object, according to an embodiment of the present invention in another aspect, provide a kind of computer-readable medium, On be stored with computer program, the method for any of the above-described inspection coding is realized when described program is executed by processor.
The scheme of the offer according to the present invention, one embodiment in foregoing invention have the following advantages that or beneficial to effects Fruit: checking coding during coding, enhances the timeliness of coded treatment, is convenient for subsequent time update, improves The validity of binary encoding;It is less that overall process manually participates in part, the case where reducing cost of labor and reduce erroneous judgement;Root According to specification masks editor's constituting criterion, specification can be effectively reduced and write cost, while the communication for improving operating personnel is convenient Property, it easily extends, easily write.
Further effect possessed by above-mentioned non-usual optional way adds hereinafter in conjunction with specific embodiment With explanation.
Detailed description of the invention
Attached drawing for a better understanding of the present invention, does not constitute an undue limitation on the present invention.Wherein:
Fig. 1 is a kind of main flow schematic diagram for checking coding method according to an embodiment of the present invention;
Fig. 2 is the schematic diagram of query tree of the present invention;
Fig. 3 is a kind of main modular schematic diagram for checking code device according to an embodiment of the present invention;
Fig. 4 is that the embodiment of the present invention can be applied to exemplary system architecture figure therein;
Fig. 5 is adapted for the structural representation for realizing the mobile device of the embodiment of the present invention or the computer system of server Figure.
Specific embodiment
Below in conjunction with attached drawing, an exemplary embodiment of the present invention will be described, including the various of the embodiment of the present invention Details should think them only exemplary to help understanding.Therefore, those of ordinary skill in the art should recognize It arrives, it can be with various changes and modifications are made to the embodiments described herein, without departing from scope and spirit of the present invention.Together Sample, for clarity and conciseness, descriptions of well-known functions and structures are omitted from the following description.
It should be noted that the embodiment of the present invention is only applicable to IOS system at present, for systems such as Android, Windows, The present invention is put aside.
Word according to the present invention is explained as follows:
IOS: the Mobile operating system that Apple Inc. is developed.
Xcode: the Integrated Development Environment (non-open source) that Apple Inc. provides to developer, for develop Mac OS X, The application program of iOS.
Morphological analysis result: being the first stage of compilation process, is the basis of compiling.The task in this stage is from a left side Source program is read in character by character to the right side, i.e., the character stream for constituting source program is scanned and list is then identified according to word-building rule Word (also referred to as word symbol or symbol).
Coding criterion: the agreement that only everybody reaches an agreement in program limit, everybody code in this way can be mutual Understand, maintenance gets up to be more easier, and the more happy exchange of thought, experience is propagated faster.
Tree: dendrogram is a kind of data structure, it form one with hierarchical relationship by a limited node of n (n >=1) Set, it appears that seem a projecting tree.Each node has zero or more child node in tree;There is no the node of father node Referred to as root node;Each non-root node has and only one father node.
Abstract syntax tree (Abstract Syntax Tree, AST) or syntax tree (syntax tree): being source code Abstract syntax structure the tree-shaped form of expression, in particular to the source code of programming language.Abstract syntax tree as program one Kind intermediate representation is widely used in numerous areas such as program analyses.It is realized with can be convenient using abstract syntax tree A variety of source program handling implements, such as source program browser, intelligent editing device, language translator etc.
Concrete syntax tree (concrete syntaxtree), commonly referred to as parsing tree (parse tree): and abstract syntax Tree is opposite.In general, syntax analyzer is created that parsing tree in the translation and compilation process of source code.
Referring to Fig. 1, thus it is shown that a kind of broad flow diagram for the method for checking coding provided in an embodiment of the present invention, including Following steps:
S101: the coded command to target plug-in is received, the encoded information of the target plug-in in an encoding process is obtained;
S102: determining the type of coding of the encoded information, obtains and the target plug-in and the type of coding phase The coding check specification answered;
S103: when the encoded information meets the coding check specification, the mesh is updated based on the encoded information Mark the information query tree of plug-in unit.
The present invention includes two parts: the formulation of code specification and the inspection of code specification.Coding is in code specification inspection Stage is checked mainly in coding and two stages of compiling, and the two is more it is important that coding check.
It is defeated for the coding after plug-in card program (back abbreviation plug-in unit) starting for step S101 in above embodiment Enter identification, the main MD5 (Message Digest Algorithm MD5, document) according to coding file is carried out.
Each coding file has oneself a MD5 digest, is similar to " digital finger-print ".When file content is modified When, corresponding MD5 digest, that is, corresponding " digital finger-print " can also be modified.
In addition, non real-time to solve the problems, such as to reexamine after end-of-encode in the prior art, the present invention is used when encoding The mode of inspection can solve abnormal coding during coding.
It, can automatic identification coding check specification when plug-in unit has recognized coding input for step S102.
For example, coding check specification obtained is method specification when type of coding is Method type.Specifically:
1) by the file content particle of encoded information at nodal information (or particle information);Wherein, nodal information refers to text Part is by the small units of micronized, for example, class, function, variable etc.;
2) according to canonical mode, judge current encoded content is which kind of particle belonged to.For example, as input@ Insterface xxxx:NSObject is at this moment it is known that xxxx is a class name.
Plug-in unit, can be in specified location, such as C PanprogramsChu when starting first time, and inquiry is with the presence or absence of corresponding Specification, for example, plug-in unit 1- specification 1.It is also possible to that a file is separately provided, to store the specification of each plug-in unit;Or In the installed position of each plug-in unit, such as file XX, the specification of the plug-in unit is only stored.
It should be noted that plug-in unit executes used specification, it can be different from the default specification present position of system.Its In, the specification that system is defaulted can be considered as source template (such as industry class standard), such as include 1~10 different type Specification, and the specification of plug-in unit 1 is generated according to the template, such as only needs wherein 5.
In addition, since coding check specification is the inspection to coding, standardize stored position can be buffered with coding/ The position of storage is different, the case where being tampered to avoid coding.
Under normal conditions, plug-in unit all customized specification and selected specification, can all be stored in corresponding specific bit Set place.If the position does not standardize, it was demonstrated that developer does not have configuration specification.Therefore, start for the first time in plug-in unit and do not standardize In the case where, need constituting criterion.
The formulation needs of traditional code analysis tool, specification are write by professional, and the present invention abandons this thought, builds Vertical specification masks.Any developer or tester, can be in such a way that interface selects, autonomous configuration specification.
It is directed to the coding pass and compilation process of plug-in unit, specification can be split as to two classes:
1) class specification, function specification, the specification of attribute, macrodefinition specification and code block coding check specification: are broadly divided into Specification etc.;
2) compiling checks specification: being broadly divided into morphology specification, syntax gauge, meaning of one's words specification etc..
It should be noted that for the parameter in each specification, setting format can be required according to being particularly shown, later shape again At specific specification, for example, class name limits 5~20 characters, function name is limited in 5~20 characters etc..Plug-in unit at runtime, It can go to check according to this specification and encode.
In addition, the problem incomplete for specification/template, can first be write specific with norm-setting thinking according to the present invention Template, then regeneration is specific standardizes.Have specification after, plug-in unit starting when, these specifications can be loaded automatically, so as to Pass through normalized checking code when subsequent coding and coding.
For step S103, after determining coding check specification, that is, the coding check stage is carried out.
For the coding check stage, all nodal informations in query tree are needed to be traversed for.Workload, needle are traversed to reduce To the traversal of property tree node corresponding with type of coding.For example, type of coding is class method, then need to determine type first For the tree node of class, then therefrom choose the tree node that type belongs to method again.
Later, for the inspection of encoded information, be by encoded information and the nodal information of tree node that is screened into Row similarity compares, to judge whether it is violation information.
1) when there is no a nodal information similar or similarity being below predetermined threshold (for example, 50%) to encoded information, It indicates do not have in the encoded information query tree, can add it in query tree;
2) when but the similarity of all nodal informations and encoded information exceeds predetermined threshold, the encoded information can be added extremely In query tree or replace origin node information etc., it can not also add;For example, similarly requiring the coding A in node can be real Existing, this coding coding B also may be implemented, then without replacement.
Query tree in the present invention is compared using OC, C Plus Plus, and similar python language also can be used and do text ratio It is right.
In order to accelerate search speed, the information such as All Files, class, function, variable can be with dictionary shape in plug-in unit starting Formula is organized into query tree, and later retrieval is mainly retrieved according to alphabetic mode, and the form of query tree is shown in Figure 2.
It should be noted that can also be the other forms such as keyword other than dictionary format constructs query tree.It is former Reason is similar with using dictionary enquiring Chinese character, first inquires according to the initial of phonetic transcriptions of Chinese characters, then searches secondary word in gained range Mother, and so on, it is eventually found the Chinese character of needs.
Coding checks all later can be carried out according to this query tree.It, can be according in current coding every time when inquiry Hold, find corresponding tree node, then compares specification, finally judge.
Further, before determining tree node, comparing specification, it is also necessary to carry out traversal queries to tree node.Because of specification It is according to the particle information of coding come specified, for example, judging whether two methods are same or similar, it is necessary in comparison project Related All Files, but judge that object is method, therefore only need to consider that method defines this part, without consider class, The other informations such as variable, macro.Therefore, in actually judgement, it is only necessary to will be in All Files and file designed in project This partial information of method extracts can.
In addition, the way of contrast of different particles (class, method, variable etc.) can be different.For encoded information whether The comparison for meeting specification needs to be embodied for different situations:
1) variable generally relates only in file, therefore the comparison of variable is only simply compared specification threshold value (method name, parameter etc. are similar with variable);For example, variable whether in 5~10 characters, whether with defined letter to open Whether head is specified uppercase/lowercase etc.;
2) comparison of method is complex, some specification threshold values are to need to realize to be calculated, and compares again later;
For example, the similarity of method, there is the node of code block in query tree, below method, this node is by code Micronized removes the irrelevant informations such as space, line feed with " { } " for block, leaves behind type, variable and its relationship etc., forms one Relationship abstract.
When each control methods, this relationship abstract is just compared, obtains a similarity.Then comparison specification is preset Similarity threshold, judge whether two methods identical.Such as:
Gained relationship abstract are as follows:-v m (s) if (==) do el do re
Gained relationship abstract are as follows:-i m (s) { if (>) re el re };Then the relationship abstract of both comparisons, to calculate two The similarity of person's code.
After user's input coding finishes, all inputted encoded informations, it will be automatically added in query tree, often Secondary modification content, the information of query tree also can accordingly change.
It should be noted that modification is the special occasion that file is saved, when each file is saved, a MD5 is had. After file is modified, this MD5 will change.Then according to the position modified and the content modified, to query tree It is updated.Here modification only influences whether the corresponding node of particle for newly adding content every time, other nodes are not need Modifications and variations, therefore, compares every time and the information of adjustment will not be very much.
It, can be automatically into compiling process after encoded information is added and is finished to tree node.Start to compile when plug-in unit recognizes When translating, compilation information can be collected automatically, after to be compiled, the information that normalized checking is compiled is checked according to compiling, is finally mentioned Show analysis result.
Compiler can generate compiling log in compiling, therefore can be according to whether there is compiling log to judge whether to start Compiling.The information such as time, the compiling mode of compiling are recorded in compiling log.
Template is compiled mainly according to abstract syntax tree, by compilation tool (such as XCode developing instrument) in compiled code When source code is parsed into abstract syntax tree, then traverse grammer tree node, analysis node information (for example, variable, method name etc.), Comparison rule, records violation information.
Method provided by above-described embodiment checks coding during coding, enhances coded treatment Timeliness is convenient for subsequent time update, improves the validity of binary encoding;It is less that overall process manually participates in part, reduces Cost of labor and the case where reduce erroneous judgement;According to specification masks edit specification, specification can be effectively reduced and write cost, simultaneously The communication convenience of operating personnel is improved, easily extends, easily write.
Referring to Fig. 3, a kind of main modular signal of device 200 for checking coding provided in an embodiment of the present invention is shown Figure, comprising:
Data obtaining module 301 obtains the target plug-in encoded for receiving the coded command to target plug-in Encoded information in journey;
Specification obtains module 302, for determining the type of coding of the encoded information, obtain with the target plug-in and The corresponding coding check specification of type of coding;
Query tree update module 303, for being based on the volume when the encoded information meets the coding check specification The information query tree of target plug-in described in code information update.
In implementing device of the present invention, the specification obtains module 302, is used for: encoded information described in micronized, according to predetermined Canonical mode analyzes the particle type of encoded information after micronized, with determining and the target plug-in and the particle type Corresponding coding check specification;Wherein, the particle type includes at least class, variable, device, function, attribute and macrodefinition.
In implementing device of the present invention, the query tree update module 303 is used for: being traversed the information query tree, is obtained institute Tree node corresponding with the type of coding in information query tree is stated, when the encoded information and the tree node interior joint information Similarity when being lower than predetermined threshold, the information query tree is updated based on the encoded information.
In implementing device of the present invention, the query tree update module 303 is used for: determining that the relationship of the encoded information is plucked It wants, when the similarity that the relationship of relationship abstract and the nodal information is made a summary is lower than predetermined threshold, is based on the coding Information query tree described in information update.
In implementing device of the present invention, the query tree update module 303 is also used to: compiling the encoded information to generate Compilation information is believed when the compilation information, which meets compiling corresponding with the target plug-in, checks specification based on the compiling Breath updates the information query tree.
Implementing device of the present invention further includes specification generation module 304 (not marking in figure), is used for:
When detecting that the target plug-in starts for the first time and corresponding inspection specification is not present, according to predetermined inspection The predefined parameter of specification masks and the target plug-in generates corresponding check and standardizes;Wherein, the inspection specification is at least wrapped It includes the coding check specification and the compiling checks specification.
In implementing device of the present invention, the coding check specification includes at least class specification, function specification, the specification of attribute, macro Definition standard and code block specification;The compiling checks that specification includes at least morphology specification, syntax gauge and meaning of one's words specification.
In addition, the specific implementation content of the inspection code device described in embodiments of the present invention, inspection described above It has been described in detail in coding method, therefore has no longer illustrated in this duplicate contents.
Fig. 4 is shown can be using the exemplary system for checking coding method or checking code device of the embodiment of the present invention Framework 400.
As shown in figure 4, system architecture 400 may include terminal device 401,402,403, network 404 and server 405 (only example).Network 404 between terminal device 401,402,403 and server 405 to provide Jie of communication link Matter.Network 404 may include various connection types, such as wired, wireless communication link or fiber optic cables etc..
User can be used terminal device 401,402,403 and be interacted by network 404 with server 405, to receive or send out Send message etc..Various telecommunication customer end applications, such as the application of shopping class, net can be installed on terminal device 401,402,403 (merely illustrative) such as the application of page browsing device, searching class application, instant messaging tools, mailbox client, social platform softwares.
Terminal device 401,402,403 can be the various electronic equipments with display screen and supported web page browsing, packet Include but be not limited to smart phone, tablet computer, pocket computer on knee and desktop computer etc..
Server 405 can be to provide the server of various services, such as utilize terminal device 401,402,403 to user The shopping class website browsed provides the back-stage management server (merely illustrative) supported.Back-stage management server can be to reception To the data such as information query request analyze etc. processing, and by processing result (such as target push information, product letter Breath -- merely illustrative) feed back to terminal device.
It should be noted that checking that coding method is generally executed by server 405 provided by the embodiment of the present invention, accordingly Ground checks that code device is generally positioned in server 405.
It should be understood that the number of terminal device, network and server in Fig. 4 is only schematical.According to realization need It wants, can have any number of terminal device, network and server.
Below with reference to Fig. 5, it illustrates the computer systems 500 for the terminal device for being suitable for being used to realize the embodiment of the present invention Structural schematic diagram.Terminal device shown in Fig. 5 is only an example, function to the embodiment of the present invention and should not use model Shroud carrys out any restrictions.
As shown in figure 5, computer system 500 includes central processing unit (CPU) 501, it can be read-only according to being stored in Program in memory (ROM) 502 or be loaded into the program in random access storage device (RAM) 503 from storage section 508 and Execute various movements appropriate and processing.In RAM 503, also it is stored with system 500 and operates required various programs and data. CPU 501, ROM 502 and RAM 503 are connected with each other by bus 504.Input/output (I/O) interface 505 is also connected to always Line 504.
I/O interface 505 is connected to lower component: the importation 506 including keyboard, mouse etc.;It is penetrated including such as cathode The output par, c 507 of spool (CRT), liquid crystal display (LCD) etc. and loudspeaker etc.;Storage section 508 including hard disk etc.; And the communications portion 509 of the network interface card including LAN card, modem etc..Communications portion 509 via such as because The network of spy's net executes communication process.Driver 510 is also connected to I/O interface 505 as needed.Detachable media 511, such as Disk, CD, magneto-optic disk, semiconductor memory etc. are mounted on as needed on driver 510, in order to read from thereon Computer program be mounted into storage section 508 as needed.
Particularly, disclosed embodiment, the process described above with reference to flow chart may be implemented as counting according to the present invention Calculation machine software program.For example, embodiment disclosed by the invention includes a kind of computer program product comprising be carried on computer Computer program on readable medium, the computer program include the program code for method shown in execution flow chart.? In such embodiment, which can be downloaded and installed from network by communications portion 509, and/or from can Medium 511 is dismantled to be mounted.When the computer program is executed by central processing unit (CPU) 501, system of the invention is executed The above-mentioned function of middle restriction.
It should be noted that computer-readable medium shown in the present invention can be computer-readable signal media or meter Calculation machine readable storage medium storing program for executing either the two any combination.Computer readable storage medium for example can be --- but not Be limited to --- electricity, magnetic, optical, electromagnetic, infrared ray or semiconductor system, device or device, or any above combination.Meter The more specific example of calculation machine readable storage medium storing program for executing can include but is not limited to: have the electrical connection, just of one or more conducting wires Taking formula computer disk, hard disk, random access storage device (RAM), read-only memory (ROM), erasable type may be programmed read-only storage Device (EPROM or flash memory), optical fiber, portable compact disc read-only memory (CD-ROM), light storage device, magnetic memory device, Or above-mentioned any appropriate combination.In the present invention, computer readable storage medium can be it is any include or storage journey The tangible medium of sequence, the program can be commanded execution system, device or device use or in connection.And at this In invention, computer-readable signal media may include in a base band or as carrier wave a part propagate data-signal, Wherein carry computer-readable program code.The data-signal of this propagation can take various forms, including but unlimited In electromagnetic signal, optical signal or above-mentioned any appropriate combination.Computer-readable signal media can also be that computer can Any computer-readable medium other than storage medium is read, which can send, propagates or transmit and be used for By the use of instruction execution system, device or device or program in connection.Include on computer-readable medium Program code can transmit with any suitable medium, including but not limited to: wireless, electric wire, optical cable, RF etc. are above-mentioned Any appropriate combination.
Flow chart and block diagram in attached drawing are illustrated according to the system of various embodiments of the invention, method and computer journey The architecture, function and operation in the cards of sequence product.In this regard, each box in flowchart or block diagram can generation A part of one module, program segment or code of table, a part of above-mentioned module, program segment or code include one or more Executable instruction for implementing the specified logical function.It should also be noted that in some implementations as replacements, institute in box The function of mark can also occur in a different order than that indicated in the drawings.For example, two boxes succeedingly indicated are practical On can be basically executed in parallel, they can also be executed in the opposite order sometimes, and this depends on the function involved.Also it wants It is noted that the combination of each box in block diagram or flow chart and the box in block diagram or flow chart, can use and execute rule The dedicated hardware based systems of fixed functions or operations is realized, or can use the group of specialized hardware and computer instruction It closes to realize.
Being described in module involved in the embodiment of the present invention can be realized by way of software, can also be by hard The mode of part is realized.Described module also can be set in the processor, for example, can be described as: a kind of processor packet Include data obtaining module, specification obtains module, query tree update module.Wherein, the title of these modules is under certain conditions simultaneously The restriction to the module itself is not constituted, for example, data obtaining module is also described as the " encoded information in cataloged procedure Obtain module ".
As on the other hand, the present invention also provides a kind of computer-readable medium, which be can be Included in equipment described in above-described embodiment;It is also possible to individualism, and without in the supplying equipment.Above-mentioned calculating Machine readable medium carries one or more program, when said one or multiple programs are executed by the equipment, makes Obtaining the equipment includes:
The coded command to target plug-in is received, the encoded information of the target plug-in in an encoding process is obtained;
It determines the type of coding of the encoded information, obtains and the target plug-in and type of coding is corresponding compiles Code checks specification;
When the encoded information meets the coding check specification, the target plug-in is updated based on the encoded information Information query tree.
Technical solution according to an embodiment of the present invention checks coding during coding, enhances at coding The timeliness of reason is convenient for subsequent time update, improves the validity of binary encoding;It is less that overall process manually participates in part, subtracts The case where having lacked cost of labor and having reduced erroneous judgement;According to specification masks edit specification, specification can be effectively reduced and write cost, The communication convenience of operating personnel is improved simultaneously, is easily extended, is easily write.
Above-mentioned specific embodiment, does not constitute a limitation on the scope of protection of the present invention.Those skilled in the art should be bright It is white, design requirement and other factors are depended on, various modifications, combination, sub-portfolio and substitution can occur.It is any Made modifications, equivalent substitutions and improvements etc. within the spirit and principles in the present invention, should be included in the scope of the present invention Within.

Claims (16)

1. a kind of method for checking coding characterized by comprising
The coded command to target plug-in is received, the encoded information of the target plug-in in an encoding process is obtained;
Determine the type of coding of the encoded information, acquisition is corresponding with the target plug-in and the type of coding to encode inspection Look into specification;
When the encoded information meets the coding check specification, the letter of the target plug-in is updated based on the encoded information Cease query tree.
2. the method according to claim 1, wherein the type of coding of the determination encoded information, obtains Coding check specification corresponding with the target plug-in and the type of coding, comprising:
Encoded information described in micronized analyzes the particle type of encoded information after micronized, according to predetermined canonical mode with determination Coding check specification corresponding with the target plug-in and the particle type;Wherein, the particle type include at least class, Variable, method, function, attribute and macrodefinition.
3. the method according to claim 1, wherein described when the encoded information meets the coding check rule Fan Shi updates the information query tree of the target plug-in based on the encoded information, further includes:
The information query tree is traversed, tree node corresponding with the type of coding in the information query tree is obtained, when described When the similarity of encoded information and the tree node interior joint information is lower than predetermined threshold, based on described in encoded information update Information query tree.
4. according to the method described in claim 3, it is characterized in that, described work as the encoded information and the tree node interior joint When the similarity of information is lower than predetermined threshold, the information query tree is updated based on the encoded information, comprising:
The relationship abstract for determining the encoded information, when the similarity that the relationship of relationship abstract and the nodal information is made a summary When lower than predetermined threshold, the information query tree is updated based on the encoded information.
5. the method according to claim 1, wherein described update the target plug-in based on the encoded information Information query tree after, further includes:
The encoded information is compiled to generate compilation information, when the compilation information meets compile corresponding with the target plug-in When checking specification, the information query tree is updated based on the compilation information.
6. method according to any one of claims 1-5, which is characterized in that in the coding received to target plug-in Before instruction, further includes:
When detecting that the target plug-in starts for the first time and corresponding inspection specification is not present, standardized according to predetermined inspection The predefined parameter of template and the target plug-in generates corresponding check and standardizes;Wherein, the inspection specification includes at least institute It states coding check specification and the compiling checks specification.
7. method according to any one of claims 1-5, which is characterized in that
The coding check specification includes at least class specification, function specification, the specification of attribute, macrodefinition specification and code slip gauge Model;
The compiling checks that specification includes at least morphology specification, syntax gauge and meaning of one's words specification.
8. a kind of device for checking coding characterized by comprising
Data obtaining module obtains the target plug-in in an encoding process for receiving the coded command to target plug-in Encoded information;
Specification obtains module, for determining the type of coding of the encoded information, obtains and the target plug-in and the volume The corresponding coding check specification of code type;
Query tree update module, for being based on the encoded information when the encoded information meets the coding check specification Update the information query tree of the target plug-in.
9. device according to claim 8, which is characterized in that the specification obtains module, is used for:
Encoded information described in micronized analyzes the particle type of encoded information after micronized, according to predetermined canonical mode with determination Coding check specification corresponding with the target plug-in and the particle type;Wherein, the particle type include at least class, Variable, device, function, attribute and macrodefinition.
10. device according to claim 8, which is characterized in that the query tree update module is used for:
The information query tree is traversed, tree node corresponding with the type of coding in the information query tree is obtained, when described When the similarity of encoded information and the tree node interior joint information is lower than predetermined threshold, based on described in encoded information update Information query tree.
11. device according to claim 10, which is characterized in that the query tree update module is used for:
The relationship abstract for determining the encoded information, when the similarity that the relationship of relationship abstract and the nodal information is made a summary When lower than predetermined threshold, the information query tree is updated based on the encoded information.
12. device according to claim 8, which is characterized in that the query tree update module is also used to:
The encoded information is compiled to generate compilation information, when the compilation information meets compile corresponding with the target plug-in When checking specification, the information query tree is updated based on the compilation information.
13. the device according to any one of claim 8-12, which is characterized in that further include specification generation module, be used for:
When detecting that the target plug-in starts for the first time and corresponding inspection specification is not present, standardized according to predetermined inspection The predefined parameter of template and the target plug-in generates corresponding check and standardizes;Wherein, the inspection specification includes at least institute It states coding check specification and the compiling checks specification.
14. the device according to any one of claim 8-12, which is characterized in that
The coding check specification includes at least class specification, function specification, the specification of attribute, macrodefinition specification and code slip gauge Model;
The compiling checks that specification includes at least morphology specification, syntax gauge and meaning of one's words specification.
15. a kind of electronic equipment characterized by comprising
One or more processors;
Storage device, for storing one or more programs,
When one or more of programs are executed by one or more of processors, so that one or more of processors are real The now method as described in any in claim 1-7.
16. a kind of computer-readable medium, is stored thereon with computer program, which is characterized in that described program is held by processor The method as described in any in claim 1-7 is realized when row.
CN201810866286.XA 2018-08-01 2018-08-01 Method and device for checking codes Active CN109144517B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810866286.XA CN109144517B (en) 2018-08-01 2018-08-01 Method and device for checking codes

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810866286.XA CN109144517B (en) 2018-08-01 2018-08-01 Method and device for checking codes

Publications (2)

Publication Number Publication Date
CN109144517A true CN109144517A (en) 2019-01-04
CN109144517B CN109144517B (en) 2021-05-04

Family

ID=64799617

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810866286.XA Active CN109144517B (en) 2018-08-01 2018-08-01 Method and device for checking codes

Country Status (1)

Country Link
CN (1) CN109144517B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6457065B1 (en) * 1999-01-05 2002-09-24 International Business Machines Corporation Transaction-scoped replication for distributed object systems
CN107015813A (en) * 2017-04-19 2017-08-04 网易(杭州)网络有限公司 Method, device and electronic equipment that code is repaired
CN107168872A (en) * 2017-05-11 2017-09-15 网易(杭州)网络有限公司 Method, device, storage medium and the processor of code check

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6457065B1 (en) * 1999-01-05 2002-09-24 International Business Machines Corporation Transaction-scoped replication for distributed object systems
CN107015813A (en) * 2017-04-19 2017-08-04 网易(杭州)网络有限公司 Method, device and electronic equipment that code is repaired
CN107168872A (en) * 2017-05-11 2017-09-15 网易(杭州)网络有限公司 Method, device, storage medium and the processor of code check

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
毛金玉: "软件编程规则及自动检查技术研究", 《中国优秀硕士学位论文全文数据库信息科技辑》 *

Also Published As

Publication number Publication date
CN109144517B (en) 2021-05-04

Similar Documents

Publication Publication Date Title
CN111522816B (en) Data processing method, device, terminal and medium based on database engine
US9122540B2 (en) Transformation of computer programs and eliminating errors
US11321421B2 (en) Method, apparatus and device for generating entity relationship data, and storage medium
EP4322009A1 (en) Test case generation method, apparatus and device
US9311058B2 (en) Jabba language
CN112860727B (en) Data query method, device, equipment and medium based on big data query engine
US10474435B2 (en) Configuration model parsing for constraint-based systems
CN115016793A (en) Code generation method and device based on syntax tree, electronic equipment and storage medium
CN112445775A (en) Fault analysis method, device, equipment and storage medium of photoetching machine
CN108255837A (en) A kind of SQL resolvers and method
CN117407414A (en) Method, device, equipment and medium for processing structured query statement
CN106570095B (en) XML data operation method and equipment
US20090204889A1 (en) Adaptive sampling of web pages for extraction
US10460044B2 (en) Methods and systems for translating natural language requirements to a semantic modeling language statement
CN108694172B (en) Information output method and device
CN117435189A (en) Test case analysis method, device, equipment and medium of financial system interface
CN109144517A (en) A kind of method and apparatus checking coding
CN115146070A (en) Key value generation method, knowledge graph generation method, device, equipment and medium
CN108614821B (en) Geological data interconnection and mutual-checking system
CN110489127B (en) Error code determination method, apparatus, computer-readable storage medium and device
CN111563178A (en) Rule logic diagram comparison method, device, medium and electronic equipment
CN111214831A (en) Special effect editing method based on game engine
CN117632241A (en) Method and device for generating flow chart
CN118916377A (en) Non-verification-based heterogeneous database data blood-margin analysis method
CN118626363A (en) AST-based auxiliary generation method and system for software unit function description

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
CB02 Change of applicant information

Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant after: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Applicant before: BEIJING JINGDONG FINANCIAL TECHNOLOGY HOLDING Co.,Ltd.

CB02 Change of applicant information
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Patentee after: Jingdong Technology Holding Co.,Ltd.

Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Patentee before: Jingdong Digital Technology Holding Co.,Ltd.

Address after: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Patentee after: Jingdong Digital Technology Holding Co.,Ltd.

Address before: 101111 Room 221, 2nd Floor, Block C, 18 Kechuang 11th Street, Beijing Economic and Technological Development Zone

Patentee before: JINGDONG DIGITAL TECHNOLOGY HOLDINGS Co.,Ltd.

CP01 Change in the name or title of a patent holder