Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure have been shown in the accompanying drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but are provided to provide a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the present disclosure are for illustration purposes only and are not intended to limit the scope of the present disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order and/or performed in parallel. Furthermore, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "including" and variations thereof as used herein are intended to be open-ended, i.e., including, but not limited to. The term "based on" is based at least in part on. The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments. Related definitions of other terms will be given in the description below.
It should be noted that the terms "first," "second," and the like in this disclosure are used merely to distinguish one device, module, or unit from another device, module, or unit, and are not intended to limit the order or interdependence of the functions performed by the devices, modules, or units.
It should be noted that references to "one", "a plurality" and "a plurality" in this disclosure are intended to be illustrative rather than limiting, and those of ordinary skill in the art will appreciate that "one or more" is intended to be understood as "one or more" unless the context clearly indicates otherwise.
The names of messages or information interacted between the various devices in the embodiments of the present disclosure are for illustrative purposes only and are not intended to limit the scope of such messages or information.
Example 1
An embodiment of the present disclosure provides a method for asserting, where a flow chart of the method is shown in fig. 1, and the method includes:
s101, acquiring original assertion.
In the disclosed embodiments, assent assertions are some assumptions made by a concerned person when writing code, assertions are a high-level form of program exception handling, and assertions are expressed as boolean expressions.
In an embodiment of the present disclosure, obtaining an original assertion includes:
the source code is scanned through a hook comprised by the distributed version control system Git, and the original assertion comprised by the source code is obtained.
In the disclosed embodiment, git is an open-source distributed version control system for agilely and efficiently processing items. Hook is a custom script that is triggered when an action occurs.
S102, determining the context information of the original assertion according to the original assertion.
In an embodiment of the present disclosure, the context information of the original assertion includes at least one of:
the occurrence time of the original assertion trigger, the occurrence times of the original assertion trigger, the code line, the function name, the file position and the stack information.
It should be noted that, the stack is a data structure in which data items are arranged in sequence, and the data items are inserted or deleted at the top of the stack.
S103, according to the context information of the original assertion, determining the modification history of the original assertion.
S104, according to the modification history of the original assertion, determining information of a first attention person corresponding to the original assertion.
In an embodiment of the present disclosure, determining information of a first attention person corresponding to an original assertion includes:
information of a first watcher is determined by the distributed version control system Git, the information of the first watcher including author information of an original asserted initial version.
S105, updating the original assertion according to the context information of the original assertion and the information of the first attention person to obtain the updated assertion.
In the embodiment of the disclosure, an original assertion is obtained; determining the context information of the original assertion according to the original assertion; determining the modification history of the original assertion according to the context information of the original assertion; determining information of a first attention person corresponding to the original assertion according to the modification history of the original assertion; and updating the original assertion according to the context information of the original assertion and the information of the first attention person to obtain the updated assertion. Therefore, the information of the first attention person corresponding to the original assertion is automatically determined, the labor cost is reduced, errors caused by manually increasing the information of the first attention person are reduced, the original assertion is quickly and automatically replaced by the updated assertion, and the labor cost is greatly reduced.
In the embodiment of the disclosure, when it is determined that the original assertion does not have a modification history, designating a current author as a second attention person, wherein the current author comprises a user corresponding to a server for updating the original assertion;
and updating the original assertion according to the context information of the original assertion and the information of the second attention person to obtain the updated assertion.
Another method for asserting is provided in an embodiment of the present disclosure, a flow chart of which is shown in fig. 2, and the method includes:
s201, inquiring the original assertion.
In the disclosed embodiment, the original assertion is nsaser (); the NSAssert () is a macro and is used for debugging the defect Bug in the program in the development stage, whether the Bug belongs to the Bug is judged by transmitting a conditional expression for the NSAssert (), the condition is met, the true value is returned, the program continues to run, and if the false value is returned, the exception is thrown out.
S202, acquiring the context information of the original assertion.
S203, judging whether the original assertion has a modification history, and when the original assertion is determined to have the modification history, turning to step S204 for processing; when it is determined that the original assertion has not modified the history, the flow goes to the processing of step S206.
S204, according to the modification history of the original assertion, determining information of a first attention person corresponding to the original assertion.
In the disclosed embodiments, the first attention is the author of the original assertion's initial version.
S205, designate the first attention as the attention person.
S206, designating the second attention as the attention device.
In an embodiment of the present disclosure, the second attention is the current author.
S207, updating the original assertion to obtain the updated assertion.
In the embodiment of the disclosure, the original assertion is updated according to the context information of the original assertion and the information of the first attention person, and the updated assertion is obtained.
Yet another method for asserting is provided in an embodiment of the present disclosure, a flow diagram of which is shown in fig. 3, the method comprising:
s301, submitting program codes.
S302, obtaining the modified and newly added files.
S303, inquiring the code of the original assertion or the updated assertion which is currently used.
In the embodiment of the disclosure, the original assertion is updated to obtain the updated assertion.
S304, acquiring the context information of the original assertion.
S305, judging whether the currently used original assertion or updated assertion has a focus, and when the currently used original assertion or updated assertion is determined to have a focus, turning to step S306 for processing; when it is determined that the original assertion or the updated assertion currently used has no attention, the flow goes to the processing of step S307.
S306, continuing to submit the program codes, and after completing the program code submission, turning to step S313 for processing.
S307, judging whether the original assertion or the updated assertion used currently has a modification history, and when the original assertion or the updated assertion used currently is determined to have the modification history, turning to step S308 for processing; when it is determined that the original assertion or the updated assertion that is currently used has not modified the history, the flow goes to the processing of step S310.
S308, according to the modification history of the original assertion or the updated assertion, determining the information of the first attention person corresponding to the original assertion or the updated assertion.
S309, the first attention is designated as the attention, and the process proceeds to step S311.
S310, designating the second attention as the attention person.
In an embodiment of the present disclosure, the second attention is the current author.
S311, updating the original assertion or updated assertion used currently to the updated assertion carrying the attention person.
S312, submitting the updated asserted code carrying the attention person.
S313, ending the flow.
The application of the embodiment of the disclosure has at least the following beneficial effects:
the information of the first attention person corresponding to the original assertion is automatically determined, so that the labor cost is reduced, errors caused by manually increasing the information of the first attention person are reduced, the original assertion is quickly and automatically replaced by the updated assertion, and the labor cost is greatly reduced.
Example two
Based on the same inventive concept, the embodiment of the present disclosure further provides a device for asserting, where a schematic structural diagram of the device is shown in fig. 4, and the device 40 for asserting includes a first processing module 401, a second processing module 402, a third processing module 403, a fourth processing module 404, and a fifth processing module 405.
A first processing module 401, configured to obtain an original assertion;
a second processing module 402, configured to determine context information of the original assertion according to the original assertion;
a third processing module 403 for determining a modification history of the original assertion based on the context information of the original assertion;
a fourth processing module 404, configured to determine, according to the modification history of the original assertion, information of a first attention person corresponding to the original assertion;
and a fifth processing module 405, configured to update the original assertion according to the context information of the original assertion and the information of the first attention device, so as to obtain an updated assertion.
In an embodiment of the present disclosure, the context information of the original assertion includes at least one of:
the occurrence time of the original assertion trigger, the occurrence times of the original assertion trigger, the code line, the function name, the file position and the stack information.
In the embodiment of the disclosure, when it is determined that the original assertion does not have a modification history, designating a current author as a second attention person, wherein the current author comprises a user corresponding to a server for updating the original assertion;
and updating the original assertion according to the context information of the original assertion and the information of the second attention person to obtain the updated assertion.
In the embodiment of the present disclosure, the first processing module 401 is specifically configured to scan the source code through a hook included in the distributed version control system Git, and obtain an original assertion included in the source code.
In the embodiment of the present disclosure, the fourth processing module 404 is specifically configured to determine, by using the distributed version control system Git, information of a first attention person, where the information of the first attention person includes information of an author of an initial version of the original assertion.
The application of the embodiment of the disclosure has at least the following beneficial effects:
acquiring an original assertion; determining the context information of the original assertion according to the original assertion; determining the modification history of the original assertion according to the context information of the original assertion; determining information of a first attention person corresponding to the original assertion according to the modification history of the original assertion; and updating the original assertion according to the context information of the original assertion and the information of the first attention person to obtain the updated assertion. Therefore, the information of the first attention person corresponding to the original assertion is automatically determined, the labor cost is reduced, errors caused by manually increasing the information of the first attention person are reduced, the original assertion is quickly and automatically replaced by the updated assertion, and the labor cost is greatly reduced.
In the device for asserting the assertion provided in the embodiment of the present disclosure, which is not described in detail, reference may be made to the method for asserting the first embodiment, and the beneficial effects that the device for asserting the assertion provided in the embodiment of the present disclosure can achieve are the same as the method for asserting the first embodiment, which is not described in detail herein.
Example III
Referring now to fig. 5, a schematic diagram of an electronic device 800 suitable for use in implementing embodiments of the present disclosure is shown. The terminal devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., in-vehicle navigation terminals), and the like, and stationary terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 5 is merely an example and should not be construed to limit the functionality and scope of use of the disclosed embodiments.
An electronic device includes: a memory and a processor, where the processor may be referred to as a processing device 801 described below, the memory may include at least one of a Read Only Memory (ROM) 802, a Random Access Memory (RAM) 803, and a storage device 808 described below, as shown in fig. 5 in particular:
the electronic device 800 may include a processing means (e.g., a central processor, a graphics processor, etc.) 801 that may perform various appropriate actions and processes in accordance with programs stored in a Read Only Memory (ROM) 802 or loaded from a storage 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data required for the operation of the electronic device 800 are also stored. The processing device 801, the ROM 802, and the RAM 803 are connected to each other by a bus 804. An input/output (I/O) interface 805 is also connected to the bus 804.
In general, the following devices may be connected to the I/O interface 805: input devices 806 including, for example, a touch screen, touchpad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, and the like; an output device 807 including, for example, a Liquid Crystal Display (LCD), speakers, vibrators, etc.; storage 808 including, for example, magnetic tape, hard disk, etc.; communication means 809. The communication means 809 may allow the electronic device 800 to communicate wirelessly or by wire with other devices to exchange data. While fig. 5 shows an electronic device 800 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may be implemented or provided instead.
In particular, according to embodiments of the present disclosure, the processes described above with reference to flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a non-transitory computer readable medium, the computer program comprising program code for performing the method shown in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network via communication device 809, or installed from storage device 808, or installed from ROM 802. The above-described functions defined in the methods of the embodiments of the present disclosure are performed when the computer program is executed by the processing device 801.
It should be noted that the computer readable medium described in the present disclosure may be a computer readable signal medium or a computer readable storage medium, or any combination of the two. The computer readable storage medium can be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or a combination of any of the foregoing. More specific examples of the computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the context of this disclosure, a computer-readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In the present disclosure, however, the computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, with the computer-readable program code embodied therein. Such a propagated data signal may take any of a variety of forms, including, but not limited to, electro-magnetic, optical, or any suitable combination of the foregoing. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, fiber optic cables, RF (radio frequency), and the like, or any suitable combination of the foregoing.
In some implementations, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText Transfer Protocol ), and may be interconnected with any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the internet (e.g., the internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed networks.
The computer readable medium may be contained in the electronic device; or may exist alone without being incorporated into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to: acquiring an original assertion; determining the context information of the original assertion according to the original assertion; determining the modification history of the original assertion according to the context information of the original assertion; determining information of a first attention person corresponding to the original assertion according to the modification history of the original assertion; and updating the original assertion according to the context information of the original assertion and the information of the first attention person to obtain the updated assertion.
Computer program code for carrying out operations of the present disclosure may be written in one or more programming languages, including, but not limited to, an object oriented programming language such as Java, smalltalk, C ++ and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computer (for example, through the Internet using an Internet service provider).
The flowcharts and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units involved in the embodiments of the present disclosure may be implemented by means of software, or may be implemented by means of hardware. Where the name of a module or unit does not in some cases constitute a limitation of the unit itself.
The functions described above herein may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: a Field Programmable Gate Array (FPGA), an Application Specific Integrated Circuit (ASIC), an Application Specific Standard Product (ASSP), a system on a chip (SOC), a Complex Programmable Logic Device (CPLD), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. The machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
In accordance with one or more embodiments of the present disclosure, embodiment one provides a method of asserting, comprising:
acquiring an original assertion;
determining the context information of the original assertion according to the original assertion;
determining the modification history of the original assertion according to the context information of the original assertion;
determining information of a first attention person corresponding to the original assertion according to the modification history of the original assertion;
and updating the original assertion according to the context information of the original assertion and the information of the first attention person to obtain the updated assertion.
In an embodiment of the present disclosure, the context information of the original assertion includes at least one of:
the occurrence time of the original assertion trigger, the occurrence times of the original assertion trigger, the code line, the function name, the file position and the stack information.
In the embodiment of the disclosure, when it is determined that the original assertion does not have a modification history, designating a current author as a second attention person, wherein the current author comprises a user corresponding to a server for updating the original assertion;
and updating the original assertion according to the context information of the original assertion and the information of the second attention person to obtain the updated assertion.
In an embodiment of the present disclosure, obtaining an original assertion includes:
the source code is scanned through a hook comprised by the distributed version control system Git, and the original assertion comprised by the source code is obtained.
In an embodiment of the present disclosure, determining information of a first attention person corresponding to an original assertion includes:
information of a first watcher is determined by the distributed version control system Git, the information of the first watcher including author information of an original asserted initial version.
In accordance with one or more embodiments of the present disclosure, embodiment two provides an apparatus for asserting, comprising:
the first processing module is used for acquiring original assertion;
the second processing module is used for determining the context information of the original assertion according to the original assertion;
a third processing module for determining a modification history of the original assertion based on the context information of the original assertion;
the fourth processing module is used for determining information of a first attention person corresponding to the original assertion according to the modification history of the original assertion;
and the fifth processing module is used for updating the original assertion according to the context information of the original assertion and the information of the first attention person to obtain the updated assertion.
In an embodiment of the present disclosure, the context information of the original assertion includes at least one of:
the occurrence time of the original assertion trigger, the occurrence times of the original assertion trigger, the code line, the function name, the file position and the stack information.
In the embodiment of the disclosure, when it is determined that the original assertion does not have a modification history, designating a current author as a second attention person, wherein the current author comprises a user corresponding to a server for updating the original assertion;
and updating the original assertion according to the context information of the original assertion and the information of the second attention person to obtain the updated assertion.
In the embodiment of the disclosure, the first processing module is specifically configured to scan the source code through a hook included in the distributed version control system Git, and obtain an original assertion included in the source code.
In an embodiment of the disclosure, the fourth processing module is specifically configured to determine, by using the distributed version control system Git, information of a first attention, where the information of the first attention includes author information of an initial version of the original assertion.
The foregoing description is only of the preferred embodiments of the present disclosure and description of the principles of the technology being employed. It will be appreciated by persons skilled in the art that the scope of the disclosure referred to in this disclosure is not limited to the specific combinations of features described above, but also covers other embodiments which may be formed by any combination of features described above or equivalents thereof without departing from the spirit of the disclosure. Such as those described above, are mutually substituted with the technical features having similar functions disclosed in the present disclosure (but not limited thereto).
Moreover, although operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. In certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limiting the scope of the present disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are example forms of implementing the claims.