CN115509938A - Code viewing method, device and computer readable storage medium - Google Patents

Code viewing method, device and computer readable storage medium Download PDF

Info

Publication number
CN115509938A
CN115509938A CN202211305913.5A CN202211305913A CN115509938A CN 115509938 A CN115509938 A CN 115509938A CN 202211305913 A CN202211305913 A CN 202211305913A CN 115509938 A CN115509938 A CN 115509938A
Authority
CN
China
Prior art keywords
code
viewing
software
viewed
submission
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN202211305913.5A
Other languages
Chinese (zh)
Inventor
周勇
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Ping An Bank Co Ltd
Original Assignee
Ping An Bank 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 Bank Co Ltd filed Critical Ping An Bank Co Ltd
Priority to CN202211305913.5A priority Critical patent/CN115509938A/en
Publication of CN115509938A publication Critical patent/CN115509938A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/60Software deployment
    • G06F8/65Updates
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F8/00Arrangements for software engineering
    • G06F8/70Software maintenance or management
    • G06F8/71Version control; Configuration management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Software Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Security & Cryptography (AREA)
  • Computer Hardware Design (AREA)
  • Quality & Reliability (AREA)
  • Stored Programmes (AREA)

Abstract

The embodiment of the application discloses a code viewing method, a code viewing device and a computer readable storage medium, wherein a software code is obtained in an integrated development environment platform, and a version update code of the software code in a current version is identified in the software code; determining a code to be viewed based on the version update code, acquiring a file path of a software code and code submission information of a code to be viewed; identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code; generating a code viewing page based on the code submission object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result; and storing the code viewing result into a code viewing list, wherein the code viewing list realizes that the code viewing list jumps to the code to be viewed on the basis of the position information. Therefore, the code inspection process is simplified, and the code inspection efficiency is improved.

Description

Code viewing method, device and computer readable storage medium
Technical Field
The present application relates to the field of computer technologies, and in particular, to a code viewing method, apparatus, and computer-readable storage medium.
Background
With the development of computer technology, various kinds of software are widely used. Most software is developed cooperatively, technical levels and encoding habits of different developers are different, and thus problems such as code confusion easily occur in the software development process, and the overall quality of a software system is further affected.
In the research and practice process of the prior art, it is found that in the prior code inspection method, the code inspection process is complicated and time consuming is long due to the long code space and frequent change, so that the code inspection efficiency is low.
Disclosure of Invention
The embodiment of the application provides a code inspection method, a code inspection device and a computer readable storage medium, which can simplify a code inspection process and further improve code inspection efficiency.
An embodiment of the present application provides a code viewing method, including:
acquiring a software code in an integrated development environment platform, and identifying a version update code of the software code in a current version in the software code;
determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed;
identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code;
generating a code viewing page based on the code submitting object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result;
and storing the code viewing result to a code viewing list, wherein the code viewing list realizes jumping to the code to be viewed from the code viewing list based on the position information.
Accordingly, an embodiment of the present application provides a code viewing apparatus, including:
the system comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring a software code in an integrated development environment platform and identifying a version update code of the software code in a current version in the software code;
the determining unit is used for determining the code to be viewed based on the version updating code and acquiring a file path of the software code and code submission information corresponding to the code to be viewed;
the identification unit is used for identifying a code submission object corresponding to the code to be inspected according to the code submission information and determining the position information of the code to be inspected in the software code;
the inspection unit is used for generating a code inspection page based on the code submission object, the file path and the code to be inspected, and receiving code inspection information based on the code inspection page to obtain a code inspection result;
and the storage unit is used for storing the code viewing result to a code viewing list, and the code viewing list realizes that the code viewing list jumps to the code to be viewed on the basis of the position information.
In one embodiment, the determining unit includes:
the grammar recognition subunit is used for carrying out grammar recognition on the software codes to obtain the code calling relation of the software codes;
an association code identification subunit, configured to identify, based on the code call relationship, an association code associated with the version update code in the software code;
and the code to be inspected determining subunit is used for determining the version updating code and the associated code as the code to be inspected.
In one embodiment, the association code identifying subunit includes:
a candidate associated code identification module, configured to identify, based on the code call relation, a candidate associated code associated with the version update code in the software code;
and the associated code screening module is used for screening the associated codes from the candidate associated codes according to the position information of the version updating codes in the software codes.
In one embodiment, the identification unit includes:
the object type information acquisition subunit is used for displaying the code submission object type selection box and receiving the code submission object type information based on the code submission object type selection box;
the candidate associated object identification subunit is used for identifying a candidate associated object corresponding to the code to be inspected in the code submission information;
and the code submission object screening subunit is used for screening the code submission object corresponding to the code to be inspected from the candidate associated objects according to the code submission object type information.
In one embodiment, the identification unit includes:
a line number identification subunit, configured to identify, in the software code, a folded start line number and a folded end line number that correspond to the code to be viewed;
a folding line number counting subunit, configured to count the number of folding lines in the software code based on the folded starting line number;
a line number adjusting subunit, configured to perform adjustment processing on the folded start line number and the folded end line number according to the number of folded lines, so as to obtain a target start line number and a target end line number corresponding to the code to be viewed;
and the position information determining subunit is used for determining the position information of the code to be inspected in the software code based on the target starting line number and the target ending line number.
In one embodiment, the code viewing apparatus further comprises:
the information acquisition unit is used for acquiring target position information and a target file path of a target code to be viewed corresponding to the target code viewing result when receiving a selection operation aiming at the target code viewing result in the code viewing list;
the file skipping unit is used for searching a code file where the target code to be viewed is located based on the target file path and skipping to the code file;
and the code positioning unit is used for positioning the position of the target code to be inspected in the code file according to the target position information.
In one embodiment, the code viewing apparatus further comprises:
a derived format information acquisition unit configured to acquire derived format information corresponding to a list deriving operation when the list deriving operation for the code viewing list is received;
and the file export unit is used for packaging the code viewing list based on the export format information to obtain an export file corresponding to the code viewing list.
In addition, a computer-readable storage medium is provided, where the computer-readable storage medium stores a plurality of instructions, and the instructions are suitable for being loaded by a processor to perform the steps in any one of the code viewing methods provided in the embodiments of the present application.
In addition, the embodiment of the present application further provides a computer device, which includes a processor and a memory, where the memory stores an application program, and the processor is configured to run the application program in the memory to implement the code viewing method provided in the embodiment of the present application.
Embodiments of the present application also provide a computer program product or a computer program, which includes computer instructions stored in a computer-readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and executes the computer instructions, so that the computer device executes the steps in the code viewing method provided by the embodiment of the application.
According to the method and the device, the software codes are obtained from the integrated development environment platform, and the version updating codes of the software codes in the current version are identified in the software codes; determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed; identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code; generating a code viewing page based on the code submission object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result; and storing the code viewing result into a code viewing list, wherein the code viewing list realizes that the code viewing list jumps to the code to be viewed on the basis of the position information. Therefore, the version updating code of the software code in the current version is identified in the software code, the code to be inspected is determined based on the version updating code, the file path of the software code, the code submission information corresponding to the code to be inspected, the code submission object and the position information of the code to be inspected in the software code are obtained, and then a code inspection page is generated to receive the code inspection information based on the code submission object, the file path and the code to be inspected.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
FIG. 1 is a schematic view illustrating an implementation scenario of a code inspection method according to an embodiment of the present application;
FIG. 2 is a flowchart illustrating a code inspection method according to an embodiment of the present application;
FIG. 3a is a flowchart illustrating a code inspection method according to an embodiment of the present application;
FIG. 3b is a schematic structural diagram illustrating a code inspection method according to an embodiment of the present application;
FIG. 4 is a schematic flow chart illustrating a code viewing method according to an embodiment of the present application;
FIG. 5 is a schematic structural diagram of a code viewing apparatus according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a computer device provided in an embodiment of the present application.
Detailed Description
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
The embodiment of the application provides a code viewing method, a code viewing device and a computer readable storage medium. The code viewing device may be integrated in a computer device, and the computer device may be a server or a terminal.
The server may be an independent physical server, a server cluster or a distributed system formed by a plurality of physical servers, or a cloud server providing basic cloud computing services such as cloud service, a cloud database, cloud computing, a cloud function, cloud storage, network service, cloud communication, middleware service, domain name service, security service, network acceleration service (CDN), big data and an artificial intelligence platform. The terminal may be, but is not limited to, a smart television, a tablet computer, a notebook computer, a desktop computer, a smart speaker, a smart phone, and the like. The terminal and the server may be directly or indirectly connected through wired or wireless communication, and the application is not limited herein.
Referring to fig. 1, an example is a code viewing apparatus integrated in a terminal, and fig. 1 is a schematic view of an implementation scenario of a code viewing method according to an embodiment of the present application, where the terminal may be, but is not limited to, a smart television, a smart phone, a tablet computer, a notebook computer, a desktop computer, and other computer devices. The terminal can acquire the software codes in the integrated development environment platform and identify the version update codes of the software codes in the current version in the software codes; determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed; identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code; generating a code viewing page based on the code submission object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result; and storing the code viewing result into a code viewing list, wherein the code viewing list realizes that the code viewing list jumps to the code to be viewed on the basis of the position information.
It should be noted that the schematic diagram of the implementation environment scenario of the code inspection method shown in fig. 1 is only an example, and the implementation environment scenario of the code inspection method described in the embodiment of the present application is for more clearly illustrating the technical solution of the embodiment of the present application, and does not constitute a limitation to the technical solution provided by the embodiment of the present application. As can be appreciated by those skilled in the art, with the evolution of code viewing and the emergence of new business scenarios, the technical solution provided by the present application is also applicable to similar technical problems.
The following are detailed below. It should be noted that the following description of the embodiments is not intended to limit the preferred order of the embodiments.
The present embodiment will be described in terms of a code viewing apparatus, which may be integrated in a computer device, and the computer device may be a terminal, and the present application is not limited thereto.
Referring to fig. 2, fig. 2 is a flowchart illustrating a code inspection method according to an embodiment of the present disclosure. The code viewing method comprises the following steps:
in step 101, software code is obtained in an integrated development environment platform, and version update code of the software code in a current version is identified in the software code.
The integrated development environment platform may be a platform of an integrated development environment for software development, for example, an Integrated Development Environment (IDEA) platform of java (an object-oriented programming language) programming language. The software code may be a source code of the software, the current version may be a current version of the software code, and the version update code may be an updated code in the software code, for example, a code that may be changed by the current version of the software code relative to a previous version of the software code.
The manner of identifying the version update code of the software code in the current version in the software code may be various, for example, a version comparison component in an integrated development environment platform may be used to identify the version update code of the software code in the current version.
In step 102, a code to be checked is determined based on the version update code, and a file path of the software code and code submission information corresponding to the code to be checked are obtained.
The code to be viewed may be a code for performing a code viewing operation, the file path may be a storage path of a file corresponding to the software code, and the code submission information may be submission information corresponding to the code to be viewed, for example, the submission information may include information such as a name of a submitter, a submission time, and a submission port number. Optionally, the method for obtaining the code submission information corresponding to the code to be checked may be various, for example, the code submission information corresponding to the code to be checked may be obtained through a file annotation (file annotation) function of the integrated development environment platform, or the code submission information corresponding to the code to be checked may be obtained by using a code submission record of the distributed version control system (git), for example, a code submission information obtaining interface (git frame) may be called to obtain the code submission information (commit) corresponding to the code to be checked, and the like.
For example, the version update code may be directly determined as the code to be viewed, that is, after the version update code in the software code is identified, the version update code may be determined as the code to be viewed and automatically jumps to a code viewing page, so that the code viewing process is simplified, and the speed of the code viewing process is increased. Optionally, the version update codes may be displayed in a differentiated manner after the version update codes in the software codes are identified, so that a user such as a developer may quickly determine the version update codes and select the codes to be viewed in the software codes based on the version update codes. Furthermore, after the version update code in the software code is identified, the code in the software code associated with the version update code is acquired, so that the associated code and the version update code can be determined as the code to be viewed.
After the code to be viewed is determined based on the version update code, a file path of the software code and code submission information corresponding to the code to be viewed can be obtained. For example, file information may be acquired through a virtual file (VirtualFile) interface provided by an integrated development environment platform, and a file path of the software code is extracted according to the acquired file information, where two protocols may exist in the file information of the virtual file: "file://" and "mock://", by which it is possible to distinguish whether software code is open from a version comparison window in the integrated development environment platform or in the main edit window. If the software code is opened through the main editing window (the "file://" protocol), the file path of the software code can be acquired according to the file information, and if the software code is opened through the file comparison window (the "mock://" protocol), it indicates that the current software code may be a code in a virtual file, and for this reason, the real file path of the software code needs to be acquired further according to the attribute of the virtual file.
In step 103, a code submission object corresponding to the code to be inspected is identified according to the code submission information, and the position information of the code to be inspected in the software code is determined.
The code submitting object may be an object responsible for processing the code viewing opinion of the code to be viewed, for example, the code submitting object may be a person who submits or writes the code to be viewed, and when the code is viewed, the code submitting person who acquires the current viewing code is often required, so that the viewing opinion can be transmitted to the submitting person who inputs the viewing code, so that the reviewing opinion can be modified by the submitting person, and the quality of the code can be improved.
Optionally, because there may be a delay when the code submission information is obtained by calling the code submission information obtaining interface, in order to improve the interface fluency, a code submission object corresponding to the code to be checked may be obtained in an asynchronous thread manner, specifically, the code submission information corresponding to the code to be checked may be obtained in an asynchronous thread manner, and the code submission information is analyzed, so that the code submission object may be obtained according to an analysis result.
Optionally, when the to-be-inspected code has multiple lines of codes, multiple modifying and submitting may be involved, for this reason, a code submitter corresponding to the to-be-inspected code may be counted by using a behavior dimension according to the line number of the to-be-inspected code, so that a submitter with the latest submission time may be selected from the code submitters as a code submission object corresponding to the to-be-inspected code, and in addition, a submitter with the largest submission times or the largest number of line numbers of codes for modifying the to-be-inspected code may be selected from the code submitters as a code submission object corresponding to the to-be-inspected code, and the like.
For example, a start/stop line number of the code to be inspected in the software code may be obtained, and because the code is folded in the software code, a number of lines folded before a start line of the code to be inspected may be obtained, so that the start/stop line number of the code to be inspected in the software code may be added to the folding function, thereby obtaining an actual start/stop line number of the code to be inspected in the software code, that is, obtaining the position information of the code to be inspected in the software code. Optionally, an Application Program Interface (API) provided by a main edit window (Editor) in the integrated development environment platform may be used to obtain the content of the code to be inspected and the position information of the code to be inspected in the software code.
In step 104, a code viewing page is generated based on the code submission object, the file path, and the code to be viewed, and code viewing information is received based on the code viewing page to obtain a code viewing result.
The code viewing page may be a page for code viewing, a code viewing person may enter a code viewing opinion based on information indicated in the code viewing page, and the code viewing information may be a code viewing opinion input by the code viewing person according to the code viewing page. Therefore, when the code inspection operation is generated, the code to be inspected, the code submission object of the code to be inspected and the file path can be automatically acquired, so that the acquired information is automatically filled into the code inspection page, a code inspection worker can conveniently inspect the code according to the information in the code inspection page, the code inspection step is simplified, and the code inspection efficiency is improved.
For example, referring to fig. 3a, fig. 3a is a schematic flow chart of a code inspection method provided in an embodiment of the present application, and the information may be filled into a corresponding form field in a preset code inspection page according to an acquired code submission object, a file path, and an to-be-inspected code, so as to obtain a code inspection page, and further, the code inspection information may be received according to the code inspection page, so as to obtain a code inspection result.
In step 105, the code view result is stored in the code view list.
The code viewing list may be a list for storing a code viewing result, and the code viewing list may be configured to implement skipping from the code viewing list to the code to be viewed based on the location information, that is, when the user selects the code viewing result in the code viewing list, the user may trigger skipping from the code viewing list to the file in which the software code is located and locating the current page to the location of the code to be viewed according to the file path of the software code corresponding to the code viewing result and the location information of the code to be viewed in the software code, for example, skipping to the file in which the software code is located in a hyperlink manner and locating the current page to the location of the code to be viewed according to the location information of the code to be viewed in the software code.
Alternatively, referring to fig. 3a again, after the user fills in the viewing comments, the user may click to confirm saving, and the code viewing results are automatically saved in the code viewing list, and the main functions of the code viewing list may include viewing, editing and deleting the code viewing comments, hyperlink jump positioning of the code file, and exporting the code viewing list, for example, the code viewing list may be exported as a form file (excel format file) or a markup language file (markdown format file). In addition, the code view list may be persisted to a local disk, from which it may be automatically loaded later when the integrated development environment platform is reopened.
For example, referring to fig. 3b, fig. 3b is a schematic structural diagram of a code viewing method provided in this embodiment, the code viewing method provided in this embodiment may be inserted into the integrated development environment platform by using a code viewing plug-in, where the code viewing plug-in may include an action component, a data module, a user interface component, and a tool kit, where the action component may be responsible for performing component initialization and an interactive interface between the code viewing plug-in and the integrated development environment platform, the data module may be responsible for listing data models (e.g., a code viewing page and a data model corresponding to the code viewing list), data persistence, data export (i.e., export of the code viewing list), the User Interface (UI) component may be responsible for generating the code viewing page and the code viewing list page, and the tool kit may include tools such as a version management tool (git) executor, a message prompt component, and a file information acquisition tool. Therefore, when the integrated development environment platform is started, the code viewing plug-in can be respectively initialized in the context menus of the main editor component and the version comparison component in the integrated development environment platform, so that the code can be viewed in the code comparison window. The user can use the code viewing plug-in the main editing window or the version comparison window, for example, in the file version comparison window, the version updating code corresponding to the software code can be identified, so that the user can select the code to be viewed based on the version updating code, and can click a right-click 'code viewing' menu, so that a code viewing page is opened, the user can enter code viewing opinions according to information such as the code to be viewed, a file path, a code submission object and the like displayed in the code viewing page, and further, the code viewing result can be stored in a code viewing list. In the subsequent process, the user can click the code inspection result in the code inspection list, so that the user can jump to the file where the software code corresponding to the code inspection result is located and locate the position of the code to be inspected. Therefore, by combining version comparison and identification, the code difference between different versions can be quickly and accurately found, the problems of code tracking, code recording and the like in the code inspection process are facilitated, meanwhile, skipping and positioning of codes to be inspected can be performed through a code inspection list, a user can conveniently recheck the codes to be inspected, the code inspection convenience is greatly improved, and the code inspection efficiency is further improved.
According to the method, the software codes are obtained in the integrated development environment platform, and the version updating codes of the software codes in the current version are identified in the software codes; determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed; identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code; generating a code viewing page based on the code submission object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result; and storing the code viewing result into a code viewing list, wherein the code viewing list realizes that the code viewing list jumps to the code to be viewed on the basis of the position information. Therefore, the version updating code of the software code in the current version is identified in the software code, the code to be inspected is determined based on the version updating code, the file path of the software code, the code submission information corresponding to the code to be inspected, the code submission object and the position information of the code to be inspected in the software code are obtained, and then a code inspection page is generated to receive the code inspection information based on the code submission object, the file path and the code to be inspected.
The method described in the above examples is further illustrated in detail below by way of example.
In this embodiment, the code viewing apparatus is specifically described by taking an example in which the code viewing apparatus is specifically integrated in a terminal.
For a better description of the embodiments of the present application, please refer to fig. 4. FIG. 4 is another flow chart illustrating a code inspection method according to an embodiment of the present application, as shown in FIG. 4. The specific process is as follows:
in step 201, the terminal acquires the software code in the integrated development environment platform, and identifies the version update code of the software code in the current version in the software code.
For example, with continued reference to fig. 3a, the terminal may obtain the software code in the integrated development environment platform and identify version update code of the software code in the current version in the software code. For example, the terminal may identify the version update code of the software code in the current version by using a version comparison component in the integrated development environment platform.
In step 202, the terminal performs syntax recognition on the software code to obtain a code calling relationship of the software code, identifies an associated code associated with the version update code in the software code based on the code calling relationship, and determines the version update code and the associated code as a code to be viewed.
The code call relation may be a call relation between codes in the software code, the call relation may include a call relation and a called relation, or both of the call relation and the called relation may be collectively referred to as a call relation, optionally, the code call relation may be a function call relation in a characterization software code, and each code may include at least one function. The associated code may be a code associated with the version update code in the software code, for example, a code having a calling relationship with the version update code.
The terminal may identify, based on the code call relationship, an association code associated with the version update code in the software code in various ways, for example, may identify, based on the code call relationship, a candidate association code associated with the version update code in the software code, and screen out the association code from the candidate association code according to the location information of the version update code in the software code.
The candidate associated code may be a code in the software code having a calling relationship with the version update code, and the location information may be information describing a location of the version update code in the software code.
For example, the terminal may search for a candidate associated code located at an adjacent position (i.e., a context position) of the version update code in the software code according to the location information of the version update code in the software code, and use the candidate associated code as the associated code.
In step 203, the terminal obtains a file path of the software code and code submission information corresponding to the code to be viewed, displays a code submission object type selection box, and receives the code submission object type information based on the code submission object type selection box.
The code submission object type selection box can be a selection box for providing a user to select a code submission object type, and at least two candidate code submission object types can be provided in the code submission object type selection box for the user to select, so that the user can select a code submission object type meeting requirements based on the candidate code submission object types displayed in the code submission object type selection box. The code submitting object type may be a type of the code submitting object, for example, during code inspection, different teams or different businesses may have different requirements on the code submitting object responsible for the code to be inspected, may only need to find a submitter for modifying the part of the code, may also need to find a supervisor, a responsible person, and the like corresponding to the submitter as the code submitting object, may also need to use the submitter involved in the code to be inspected as the code submitting object, may only need to use the submitter last submitted therein as the code submitting object, or use the submitter with the largest number of submissions as the code submitting object, or may pre-designate the code submitting object, so that the code submitting object type may include all submitters of the code to be inspected, the latest submitter of the code to be inspected, the submitter with the largest number of submissions, and the corresponding superior responsible person, and thus the code submitting object type information may be further determined through the code submitting object type selection box, providing the determination efficiency of the code submitting object, and further improving the code inspection efficiency.
In step 204, the terminal identifies candidate associated objects corresponding to the codes to be checked in the code submission information, and screens out the code submission objects corresponding to the codes to be checked from the candidate associated objects according to the type information of the code submission objects.
The candidate associated object may be a submitter of the code in the code to be viewed.
For example, if the type of the code submission object is the candidate association object with the largest submission times and the superior responsible person thereof, the terminal may count the submission times of each candidate association object in the candidate association objects, screen out the candidate association object with the largest submission times according to the submission times, and obtain the superior responsible person corresponding to the candidate association object with the largest submission times, so that the candidate association object with the largest submission times and the superior responsible person thereof may be used as the code submission object corresponding to the code to be reviewed.
In step 205, the terminal determines the position information of the code to be viewed in the software code, generates a code viewing page based on the code submission object, the file path and the code to be viewed, and receives the code viewing information based on the code viewing page to obtain a code viewing result.
The position information may be a position of the code to be viewed in the software code, and optionally, a number of lines of the code to be viewed in the software code may be used to describe the position of the code to be viewed in the software code.
The method for determining the position information of the code to be inspected in the software code by the terminal may be various, for example, a folded start line number and a folded end line number corresponding to the code to be inspected may be identified in the software code, the number of folded lines in the software code may be counted based on the folded start line number, the number of folded start lines and the number of folded end lines may be adjusted according to the number of folded lines to obtain a target start line number and a target end line number corresponding to the code to be inspected, and the position information of the code to be inspected in the software code may be determined based on the target start line number and the target end line number.
The software code may be a multi-line code, and the start line number after folding may be a line number of the to-be-inspected code starting in the software code when the number of code lines folded in the software code is ignored, the end line number after folding may be a line number of the to-be-inspected code ending in the software code when the number of code lines folded in the software code is ignored, the number of folding lines may be a number of code lines folded between the start line numbers after folding of the to-be-inspected code, the target start line number may be a line number of the to-be-inspected code starting in the software code when the number of code lines folded in the software code is considered, and the target end line number may be a line number of the to-be-inspected code ending in the software code when the number of code lines folded in the software code is considered.
Optionally, a start/stop line number obtaining interface (section model) may be called to obtain a folded start line number and a folded end line number corresponding to the code to be viewed, and a folded region end offset obtaining interface (foldregion. Getendoffset ()) may also be called, and the number of folded regions and the number of folded lines in the software code are counted by combining the number of folded regions, and the like, where the number of folded lines = the number of folded code lines accumulated in all folded regions before the folded start line number, the target start line number = the start line number (start line, i.e., folded start line number) + the number of folded lines returned by the section model interface, and the target end line number = the end line number (end line, i.e., folded end line number) + the number of folded lines returned by the section model interface.
In step 206, the terminal stores the code inspection result in the code inspection list, and when receiving a selection operation for a target code inspection result in the code inspection list, obtains target position information and a target file path of a target code to be inspected corresponding to the target code inspection result.
The target code inspection result may be a selected code inspection result in the code inspection list, the target code to be inspected may be a code to be inspected corresponding to the target code inspection result, the target position information may be position information corresponding to the target code to be inspected, and the target file path may be a file path of a file in which the software code corresponding to the target code to be inspected is located.
In step 207, the terminal searches for a code file where the target code to be inspected is located based on the target file path, skips to the code file, and locates the position where the target code to be inspected is located in the code file according to the target position information.
The code file can be a file where a software code corresponding to a target code to be inspected is located, so that after the code inspection result is stored in a code inspection list, skipping and positioning of the code to be inspected can be achieved through the code inspection list in the modes of hyperlinks and the like, a user can conveniently review and check the result to be inspected, and code inspection efficiency is improved.
Optionally, after the code viewing result is stored in the code viewing list, the terminal may export the code viewing list in different file formats, specifically, when receiving a list export operation for the code viewing list, obtain export format information corresponding to the list export operation, and package the code viewing list based on the export format information to obtain an export file corresponding to the code viewing list.
The list export operation may be an operation of triggering export of the code viewing list, the export format information may be information including an export format corresponding to the code viewing list, for example, the export format may be a file in a table format (excel format) or a markup language format (markdown format), and the export file may be a file obtained by exporting the code viewing list.
As can be seen from the above, in the embodiment of the application, the software code is acquired in the integrated development environment platform through the terminal, and the version update code of the software code in the current version is identified in the software code; the terminal performs syntax recognition on the software code to obtain a code calling relation of the software code, recognizes an associated code associated with the version updating code in the software code based on the code calling relation, and determines the version updating code and the associated code as a code to be viewed; the method comprises the steps that a terminal obtains a file path of a software code and code submission information corresponding to the code to be viewed, displays a code submission object type selection frame and receives the code submission object type information based on the code submission object type selection frame; the terminal identifies candidate associated objects corresponding to the codes to be checked in the code submitting information, and screens out the code submitting objects corresponding to the codes to be checked in the candidate associated objects according to the type information of the code submitting objects; the terminal determines the position information of the code to be viewed in the software code, generates a code viewing page based on the code submission object, the file path and the code to be viewed, and receives code viewing information based on the code viewing page to obtain a code viewing result; the terminal stores the code inspection result into a code inspection list, and when receiving selection operation aiming at the target code inspection result in the code inspection list, the terminal acquires target position information and a target file path of a target code to be inspected corresponding to the target code inspection result; and the terminal searches a code file where the target code to be inspected is located based on the target file path, skips to the code file, and positions the position where the target code to be inspected is located in the code file according to the target position information. Therefore, the version updating code of the software code in the current version is identified in the software code, the code to be inspected is determined based on the version updating code, the file path of the software code, the code submission information corresponding to the code to be inspected, the code submission object and the position information of the code to be inspected in the software code are obtained, and then a code inspection page is generated to receive the code inspection information based on the code submission object, the file path and the code to be inspected.
In order to better implement the above method, the embodiment of the present invention further provides a code viewing apparatus, which may be integrated in a terminal.
For example, as shown in fig. 5, the code viewing apparatus provided in the embodiment of the present application may include an obtaining unit 301, a determining unit 302, an identifying unit 303, a viewing unit 304, and a storing unit 305, as follows:
an obtaining unit 301, configured to obtain a software code in an integrated development environment platform, and identify, in the software code, a version update code of the software code in a current version;
a determining unit 302, configured to determine a code to be viewed based on the version update code, and obtain a file path of the software code and code submission information corresponding to the code to be viewed;
the identifying unit 303 is configured to identify a code submission object corresponding to the code to be checked according to the code submission information, and determine location information of the code to be checked in the software code;
the inspection unit 304 is configured to generate a code inspection page based on the code submission object, the file path, and the to-be-inspected code, and receive code inspection information based on the code inspection page to obtain a code inspection result;
a storage unit 305, configured to store the code viewing result in a code viewing list, where the code viewing list enables jumping from the code viewing list to the code to be viewed based on the location information.
In an embodiment, the determining unit 302 includes:
the grammar recognition subunit is used for carrying out grammar recognition on the software code to obtain a code calling relation of the software code;
the associated code identification subunit is used for identifying the associated code associated with the version updating code in the software code based on the code calling relationship;
and the code to be inspected determining subunit is used for determining the version updating code and the associated code as the code to be inspected.
In one embodiment, the association code identifying subunit includes:
a candidate associated code identification module, configured to identify, based on the code call relationship, a candidate associated code associated with the version update code in the software code;
and the associated code screening module is used for screening the associated codes from the candidate associated codes according to the position information of the version updating codes in the software codes.
In one embodiment, the identifying unit 303 includes:
the object type information acquisition subunit is used for displaying the code submission object type selection box and receiving the code submission object type information based on the code submission object type selection box;
the candidate associated object identification subunit is used for identifying a candidate associated object corresponding to the code to be inspected in the code submission information;
and the code submission object screening subunit is used for screening the code submission object corresponding to the code to be inspected from the candidate associated objects according to the code submission object type information.
In one embodiment, the identifying unit 303 includes:
a line number identification subunit, configured to identify, in the software code, a folded start line number and a folded end line number corresponding to the code to be viewed;
a folding line number counting subunit, configured to count the number of folding lines in the software code based on the folded starting line number;
a line number adjusting subunit, configured to perform adjustment processing on the folded start line number and the folded end line number according to the number of the folded lines, so as to obtain a target start line number and a target end line number corresponding to the code to be inspected;
and the position information determining subunit is used for determining the position information of the code to be viewed in the software code based on the target starting line number and the target ending line number.
In one embodiment, the code viewing apparatus further comprises:
the information acquisition unit is used for acquiring target position information and a target file path of a target code to be inspected corresponding to the target code inspection result when receiving the selection operation aiming at the target code inspection result in the code inspection list;
the file skipping unit is used for searching the code file where the target code to be inspected is located based on the target file path and skipping to the code file;
and the code positioning unit is used for positioning the position of the target code to be inspected in the code file according to the target position information.
In one embodiment, the code viewing apparatus further comprises:
a derived format information acquisition unit configured to acquire derived format information corresponding to a list deriving operation when the list deriving operation for the code viewing list is received;
and the file export unit is used for packaging the code viewing list based on the export format information to obtain an export file corresponding to the code viewing list.
In a specific implementation, the above units may be implemented as independent entities, or may be combined arbitrarily to be implemented as the same or several entities, and the specific implementation of the above units may refer to the foregoing method embodiments, which are not described herein again.
As can be seen from the above, in the embodiment of the application, the obtaining unit 301 obtains the software code in the integrated development environment platform, and identifies the version update code of the software code in the current version in the software code; the determining unit 302 determines the code to be checked based on the version update code, and obtains a file path of the software code and code submission information corresponding to the code to be checked; the identifying unit 303 identifies a code submission object corresponding to the code to be inspected according to the code submission information, and determines the position information of the code to be inspected in the software code; the inspection unit 304 generates a code inspection page based on the code submission object, the file path and the code to be inspected, and receives code inspection information based on the code inspection page to obtain a code inspection result; the storage unit 305 stores the code viewing result in a code viewing list that enables jumping from the code viewing list to the code to be viewed based on the position information. Therefore, the version updating code of the software code in the current version is identified in the software code, the code to be inspected is determined based on the version updating code, the file path of the software code, the code submission information corresponding to the code to be inspected, the code submission object and the position information of the code to be inspected in the software code are obtained, and then a code inspection page is generated based on the code submission object, the file path and the code to be inspected to receive the code inspection information.
An embodiment of the present application further provides a computer device, as shown in fig. 6, which shows a schematic structural diagram of a computer device according to an embodiment of the present application, where the computer device may be a terminal, and specifically:
the computer device may include components such as a processor 401 of one or more processing cores, memory 402 of one or more computer-readable storage media, a power supply 403, and an input unit 404. Those skilled in the art will appreciate that the computer device configuration illustrated in FIG. 6 does not constitute a limitation of computer devices, and may include more or fewer components than those illustrated, or some components may be combined, or a different arrangement of components. Wherein:
the processor 401 is the control center of the computer device, connects the various parts of the overall computer device using various interfaces and lines, and, by running or executing software programs and/or modules stored in the memory 402, and calls the data stored in the memory 402 to perform various functions of the computer device and process the data, thereby performing overall detection of the computer device. Optionally, processor 401 may include one or more processing cores; preferably, the processor 401 may integrate an application processor, which mainly handles operating systems, user interfaces, application programs, etc., and a modem processor, which mainly handles wireless communications. It will be appreciated that the modem processor described above may not be integrated into the processor 401.
The memory 402 may be used to store software programs and modules, and the processor 401 may execute various functional applications and code viewing by running the software programs and modules stored in the memory 402. The memory 402 may mainly include a program storage area and a data storage area, wherein the program storage area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data created according to use of the computer device, and the like. Further, the memory 402 may include high speed random access memory, and may also include non-volatile memory, such as at least one magnetic disk storage device, flash memory device, or other volatile solid state storage device. Accordingly, the memory 402 may also include a memory controller to provide the processor 401 access to the memory 402.
The computer device further comprises a power supply 403 for supplying power to the various components, and preferably, the power supply 403 is logically connected to the processor 401 via a power management system, so that functions of managing charging, discharging, and power consumption are implemented via the power management system. The power supply 403 may also include any component of one or more dc or ac power sources, recharging systems, power failure detection circuitry, power converters or inverters, power status indicators, and the like.
The computer device may also include an input unit 404, the input unit 404 being operable to receive input numeric or character information and to generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
Although not shown, the computer device may further include a display unit and the like, which are not described in detail herein. Specifically, in this embodiment, the processor 401 in the computer device loads the executable file corresponding to the process of one or more application programs into the memory 402 according to the following instructions, and the processor 401 runs the application programs stored in the memory 402, thereby implementing various functions as follows:
acquiring a software code in an integrated development environment platform, and identifying a version update code of the software code in a current version in the software code; determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed; identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code; generating a code viewing page based on the code submission object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result; and storing the code viewing result to a code viewing list.
The above operations can be implemented in the foregoing embodiments, and are not described in detail herein. It should be noted that the computer device provided in the embodiment of the present application and the code viewing method in the foregoing embodiment belong to the same concept, and specific implementation processes thereof are described in the foregoing method embodiment, and are not described herein again.
It will be understood by those skilled in the art that all or part of the steps of the methods of the above embodiments may be performed by instructions or by associated hardware controlled by the instructions, which may be stored in a computer readable storage medium and loaded and executed by a processor.
To this end, embodiments of the present application provide a computer-readable storage medium, in which a plurality of instructions are stored, and the instructions can be loaded by a processor to perform the steps of any of the code viewing methods provided in the embodiments of the present application. For example, the instructions may perform the steps of:
acquiring a software code in an integrated development environment platform, and identifying a version update code of the software code in a current version in the software code; determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed; identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code; generating a code inspection page based on the code submission object, the file path and the code to be inspected, and receiving code inspection information based on the code inspection page to obtain a code inspection result; and storing the code viewing result to a code viewing list.
Wherein the computer-readable storage medium may include: read Only Memory (ROM), random Access Memory (RAM), magnetic or optical disks, and the like.
Since the instructions stored in the computer-readable storage medium can execute the steps in any of the code inspection methods provided in the embodiments of the present application, the advantageous effects that can be achieved by any of the code inspection methods provided in the embodiments of the present application can be achieved, which are detailed in the foregoing embodiments and will not be described herein again.
According to an aspect of the application, there is provided, among other things, a computer program product or computer program comprising computer instructions stored in a computer readable storage medium. The processor of the computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions to cause the computer device to perform the method provided in the various alternative implementations provided by the embodiments described above.
The code viewing method, apparatus and computer-readable storage medium provided in the embodiments of the present application are described in detail above, and specific examples are applied herein to explain the principles and implementations of the present application, and the description of the embodiments is only used to help understand the method and its core idea of the present application; meanwhile, for those skilled in the art, according to the idea of the present application, there may be variations in the specific embodiments and the application scope, and in summary, the content of the present specification should not be construed as a limitation to the present application.

Claims (10)

1. A method for code inspection, comprising:
acquiring a software code in an integrated development environment platform, and identifying a version update code of the software code in a current version in the software code;
determining a code to be viewed based on the version updating code, and acquiring a file path of the software code and code submission information corresponding to the code to be viewed;
identifying a code submission object corresponding to the code to be inspected according to the code submission information, and determining the position information of the code to be inspected in the software code;
generating a code viewing page based on the code submitting object, the file path and the code to be viewed, and receiving code viewing information based on the code viewing page to obtain a code viewing result;
and storing the code viewing result to a code viewing list, wherein the code viewing list realizes jumping to the code to be viewed from the code viewing list based on the position information.
2. The code viewing method of claim 1, wherein said determining code to be viewed based on said version update code comprises:
performing grammar recognition on the software code to obtain a code calling relation of the software code;
identifying an associated code associated with the version update code in the software code based on the code call relationship;
determining the version update code and the association code as code to be viewed.
3. The code viewing method of claim 2, wherein the identifying, in the software code, an associated code associated with the version update code based on the code invocation relationship comprises:
identifying candidate association codes associated with the version update codes in the software codes based on the code calling relationship;
and screening out the associated codes from the candidate associated codes according to the position information of the version updating codes in the software codes.
4. The code viewing method of claim 1, wherein the identifying a code submission object corresponding to the code to be viewed according to the code submission information comprises:
displaying a code submission object type selection box, and receiving code submission object type information based on the code submission object type selection box;
identifying candidate associated objects corresponding to the codes to be inspected in the code submission information;
and screening out the code submission object corresponding to the code to be inspected from the candidate associated objects according to the code submission object type information.
5. The code viewing method of claim 1, wherein said determining, in the software code, location information of the code to be viewed in the software code comprises:
identifying a folded start line number and a folded end line number corresponding to the code to be viewed in the software code;
counting the number of folding lines in the software code based on the number of the folded initial lines;
adjusting the folded initial line number and the folded end line number according to the number of the folded lines to obtain a target initial line number and a target end line number corresponding to the code to be viewed;
and determining the position information of the code to be inspected in the software code based on the target starting line number and the target ending line number.
6. The code viewing method of any one of claims 1 to 5, wherein after storing the code viewing results to a code viewing list, further comprising:
when a selection operation aiming at a target code inspection result in the code inspection list is received, acquiring target position information and a target file path of a target code to be inspected, which correspond to the target code inspection result;
searching a code file where the target code to be viewed is located based on the target file path, and jumping to the code file;
and positioning the position of the target code to be viewed in the code file according to the target position information.
7. The code viewing method of any one of claims 1 to 5, wherein after storing the code viewing results to a code viewing list, further comprising:
when a list export operation aiming at the code viewing list is received, obtaining export format information corresponding to the list export operation;
and packaging the code viewing list based on the export format information to obtain an export file corresponding to the code viewing list.
8. A code viewing apparatus, comprising:
the system comprises an acquisition unit, a storage unit and a processing unit, wherein the acquisition unit is used for acquiring software codes in an integrated development environment platform and identifying version update codes of the software codes in a current version in the software codes;
the determining unit is used for determining the code to be viewed based on the version updating code and acquiring a file path of the software code and code submission information corresponding to the code to be viewed;
the identification unit is used for identifying a code submission object corresponding to the code to be inspected according to the code submission information and determining the position information of the code to be inspected in the software code;
the code submitting object is used for submitting a file to the code submitting object, the file path is used for receiving the code to be inspected, and the code to be inspected is used for being viewed;
and the storage unit is used for storing the code viewing result to a code viewing list, and the code viewing list realizes that the code viewing list jumps to the code to be viewed on the basis of the position information.
9. A computer-readable storage medium storing instructions for loading by a processor to perform the steps of the code viewing method of any one of claims 1 to 7.
10. A computer device comprising a memory and a processor; the memory stores an application program, and the processor is configured to run the application program in the memory to perform the steps of the code viewing method of any one of claims 1 to 7.
CN202211305913.5A 2022-10-24 2022-10-24 Code viewing method, device and computer readable storage medium Pending CN115509938A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211305913.5A CN115509938A (en) 2022-10-24 2022-10-24 Code viewing method, device and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211305913.5A CN115509938A (en) 2022-10-24 2022-10-24 Code viewing method, device and computer readable storage medium

Publications (1)

Publication Number Publication Date
CN115509938A true CN115509938A (en) 2022-12-23

Family

ID=84513410

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211305913.5A Pending CN115509938A (en) 2022-10-24 2022-10-24 Code viewing method, device and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN115509938A (en)

Similar Documents

Publication Publication Date Title
US20210318866A1 (en) Auto-generation of api documentation via implementation-neutral analysis of api traffic
US9569346B2 (en) Asynchronous code testing
CN105511873B (en) User interface control display method and device
CN111722839B (en) Code generation method and device, electronic equipment and storage medium
US7321988B2 (en) Identifying a code library from the subset of base pointers that caused a failure generating instruction to be executed
CN111090641B (en) Data processing method and device, electronic equipment and storage medium
US20090150859A1 (en) Dynamic validation of models using constraint targets
CN112905441A (en) Test case generation method, test method, device and equipment
CN113971037A (en) Application processing method and device, electronic equipment and storage medium
CN115576600A (en) Code change-based difference processing method and device, terminal and storage medium
US20220028425A1 (en) System and Method to Customizing Video
CN111460235A (en) Atlas data processing method, device, equipment and storage medium
CN115509938A (en) Code viewing method, device and computer readable storage medium
CN115809065A (en) Low-code development platform, data storage method and electronic equipment
CN113495723B (en) Method, device and storage medium for calling functional component
US20050108426A1 (en) Identifying computer messages that should be revised
CN111459547B (en) Method and device for displaying function call link
CN112181407B (en) Service realization processing method, device, system, electronic equipment and storage medium
CN113778541A (en) Applet generation method and device, electronic equipment and storage medium
JP2018045619A (en) Analysis program, analysis method, and analysis device
CN111611173A (en) System and method applied to micro-service engineering interface document detection
CN115543323B (en) Page development method and device
US20080066005A1 (en) Systems and Methods of Interfacing with Enterprise Resource Planning Systems
CN111638903B (en) Method and device for generating difference information of different software versions
CN114238259A (en) Method and device for generating log

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