CN117370175A - Method, system, equipment and storage medium for monitoring code library file - Google Patents

Method, system, equipment and storage medium for monitoring code library file Download PDF

Info

Publication number
CN117370175A
CN117370175A CN202311323738.7A CN202311323738A CN117370175A CN 117370175 A CN117370175 A CN 117370175A CN 202311323738 A CN202311323738 A CN 202311323738A CN 117370175 A CN117370175 A CN 117370175A
Authority
CN
China
Prior art keywords
code
file
library
name
white list
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
CN202311323738.7A
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 Life Insurance Company of China Ltd
Original Assignee
Ping An Life Insurance Company of China 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 Life Insurance Company of China Ltd filed Critical Ping An Life Insurance Company of China Ltd
Priority to CN202311323738.7A priority Critical patent/CN117370175A/en
Publication of CN117370175A publication Critical patent/CN117370175A/en
Pending legal-status Critical Current

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software
    • G06F11/3604Software analysis for verifying properties of programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/16File or folder operations, e.g. details of user interfaces specifically adapted to file systems
    • G06F16/164File meta data generation
    • G06F16/166File name conversion
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2358Change logging, detection, and notification
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/23Updating
    • G06F16/2365Ensuring data consistency and integrity
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Quality & Reliability (AREA)
  • Computer Hardware Design (AREA)
  • Human Computer Interaction (AREA)
  • Software Systems (AREA)
  • Computer Security & Cryptography (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a method, a system, equipment and a storage medium for monitoring a code library file, and relates to the field of financial science and technology. The method comprises the following steps: monitoring a code library-up request initiated by a target object; acquiring code submitting information according to a code library-up request, wherein the code submitting information comprises a code file name, a folder name and absolute paths corresponding to the code file name and the folder name one by one respectively; checking the names of the code files and the names of the folders according to a preset naming rule and a preset naming white list; and when the verification is not passed, interrupting the code submitting operation of the target object and displaying verification information which does not pass the verification, wherein the verification information comprises a code file name, a folder name and a corresponding absolute path. The code is intercepted when the code is put into the library, so that the codes after being put into the library all meet naming standards, more timely code tracking is achieved, and the problem of uniformity of names of code files and folders uploaded by the code library can be solved.

Description

Method, system, equipment and storage medium for monitoring code library file
Technical Field
The present disclosure relates to, but not limited to, the field of financial technology, and in particular, to a method, system, device, and storage medium for monitoring a code library file.
Background
In the field of finance and technology, development of multiple application platforms is often involved, and with external use of the application platforms, each application platform is continuously updated iteratively to solve problems of a target object using process or newly added functions, so that a code library is often required to be used for managing code files of projects corresponding to each platform, so that iterative management of versions of each application platform is realized. The operating systems operated by the same application platform during development and application execution may be the same or different, and the naming sensitivity of different operating systems to the code files is different, so it is very important to unify file naming of each code file and code directory under the same item, which not only can reduce the communication cost and understanding cost of developers, but also can reduce the errors which are difficult to be checked due to the difference of operating systems. However, in practical project development, the uniformity of file naming and folder naming is still realized in a manner of artificial constraint, so that the uniformity of naming is difficult to ensure, and therefore, a monitoring method for code library files is needed, which can solve the problem of uniformity of names of code files and folders uploaded by a code library.
Disclosure of Invention
The embodiment of the application mainly aims to provide a method, a system, equipment and a storage medium for monitoring a code library file, and aims to solve the problem of uniformity of names of the code library uploaded code file and folders.
In order to achieve the above object, a first aspect of an embodiment of the present application provides a method for monitoring a code library file, where the method includes:
monitoring a code library-up request initiated by a target object;
acquiring code submission information according to the code library-up request, wherein the code submission information comprises a code file name, a folder name and absolute paths corresponding to the code file name and the folder name one by one respectively;
checking the code file name and the folder name according to a preset naming rule and a preset naming white list;
and when the verification is not passed, interrupting the code submitting operation of the target object and displaying verification information which does not pass the verification, wherein the verification information comprises the code file name, the folder name and the corresponding absolute path.
In some embodiments, the obtaining code submission information according to the code-based request includes:
triggering a preset pre-submission hook function in response to the code library-loading request;
calling a difference comparison command of a code library corresponding to the code library loading request through the pre-submitted hook function to obtain a code file change list of the code files cached in a temporary storage area of the code library;
obtaining the code submitting information according to the code file change list;
correspondingly, the verifying the code file name and the folder name according to a preset naming rule and a preset naming white list includes:
and checking the code file name and the folder name according to a preset naming rule and a preset naming white list through the pre-submission hook function.
In some embodiments, the obtaining the code submission information according to the code file change list includes:
extracting the code file name of the changed code file from the code file change list and the relative path of the code file;
analyzing the relative path according to an absolute path function set in the pre-submitted hook function to obtain the folder name;
and carrying out combination processing on the relative path and the project root directory according to an absolute path function set in the pre-submitted hook function to obtain the absolute path.
In some embodiments, according to the code-based request, code submission information is obtained, further including:
calling a synchronous-to-asynchronous component through the pre-submitted hook function;
correspondingly, the step of calling the code library difference comparison command corresponding to the code library request through the pre-submitted hook function to obtain a code file change list comprises the following steps:
and calling a difference comparison command of the code library corresponding to the code library loading request through the synchronous-to-asynchronous component to obtain a code file change list.
In some embodiments, the verifying the code file name and the folder name according to a preset naming rule and a preset naming white list includes:
judging whether the code file name and the folder name exist in the named white list;
and carrying out letter lower case verification and connector verification on the code file names and the folder names which are not in the named white list respectively.
In some embodiments, the named white list includes a folder named white list and a file named white list, and the determining whether the code file name and the folder name exist in the named white list includes:
judging whether the code file name exists in the file naming white list or not, so as to carry out letter lower case verification and connector verification on the code file name which is not in the file naming white list;
and judging whether the folder names exist in the folder naming white list or not, and respectively carrying out letter lower case verification and connector verification on the folder names which are not in the folder naming white list.
In some embodiments, the named whitelist is obtained by:
determining a list path of the named white list from a preset configuration file catalog and a list file name;
and reading the content of the name of the list file in the list path to obtain the named white list.
To achieve the above object, a second aspect of the embodiments of the present application provides a monitoring system for a code library file, including:
a code base;
the target object terminal is in communication connection with the code base and is used for initiating a code base-up request to the code base;
the code supervision module is used for monitoring the code library loading request and executing the monitoring method of the code library file according to any one of the first aspect.
To achieve the above object, a third aspect of the embodiments of the present application provides an electronic device, where the electronic device includes a memory and a processor, where the memory stores a computer program, and the processor implements the method for monitoring a code library file according to any one of the first aspect when executing the computer program.
To achieve the above object, a fourth aspect of the embodiments of the present application proposes a storage medium, which is a computer-readable storage medium, storing a computer program, where the computer program is executed by a processor to implement the method for monitoring a code library file according to any one of the first aspect.
According to the method, the system, the equipment and the storage medium for monitoring the code library files, after the code library-up request initiated by the target object is monitored, the code submission information is acquired, and the code submission information is checked for the code file names and the folder names according to the preset naming rule and the naming white list, so that the code files which are not checked for pass can be checked among the code file libraries, and the check information is displayed, and therefore, a developer can conveniently and quickly find out the unmatched code files or the code folders. Compared with the related art, the method and the device can intercept the problems in a code development stage and when the codes are put into the library, so that the codes after being put into the library meet naming standards, and more timely code tracking is achieved, and therefore the method and the device can solve the problem of uniformity of names of code files and folders uploaded by the code library.
Drawings
FIG. 1 is a flowchart of a specific embodiment of a method for monitoring a code library file provided in the present application;
FIG. 2 is a schematic flow chart of a step S200 of the method for monitoring a code library file provided in the present application;
FIG. 3 is a schematic diagram of a usage flow of a method for monitoring a code library file provided in the present application;
FIG. 4 is a schematic diagram of the module composition of the monitoring system for a code library file provided by the present application;
fig. 5 is a schematic hardware structure corresponding to the method for monitoring a code library file according to the embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application.
It should be noted that although functional block division is performed in a device diagram and a logic sequence is shown in a flowchart, in some cases, the steps shown or described may be performed in a different order than the block division in the device, or in the flowchart. The terms first, second and the like in the description and in the claims and in the above-described figures, are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order.
Unless defined otherwise, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of the present application only and is not intended to be limiting of the present application.
The following terms in the examples of the present application are set forth below:
git is an open-source distributed version control system that can efficiently handle project version management from very small to very large at high speed.
Node. Js, simply called node. Js is JavaScript running on the server side. Js is a platform built based on Chrome JavaScript runtime. Js is an event-driven I/O server JavaScript environment, and the V8 engine based on Google has very high JavaScript executing speed and very good performance. Js is a very popular server technology stack whose asynchronous I/O operations make it particularly suitable for handling highly concurrent applications, but for those methods that call for synchronization (blocking) in asynchronous functions, this can cause the entire application to stall until the execution of these synchronous functions is completed before execution of the following code can continue.
Deasync is a tool provided by the node. Js module to help solve the problem of invoking synchronous (blocking) in asynchronous functions, which can cause the whole application program to stop waiting for the execution of the synchronous functions before continuing to execute the following codes, and can realize the conversion of synchronous blocking codes into asynchronous non-blocking codes, thereby improving the performance of node. Js application programs.
The task, a Git hook tool, can help trigger the phases of the Git commit: all of the Git hooks supported by pre-commit, commit-msg, pre-pushz can prevent some bad completions or push using Git hooks.
In the field of finance and technology, development of multiple application platforms is often involved, and with external use of the application platforms, each application platform is continuously updated iteratively to solve problems of a target object using process or newly added functions, so that a code library is often required to be used for managing code files of projects corresponding to each platform, so that iterative management of versions of each application platform is realized. The operating systems running on the same application platform during development and application execution may be the same or different, and the naming sensitivity of different operating systems to code files is different, so that due to the naming sensitivity difference of the files, the abnormality of the same program applied under different operating systems is easy to be difficult to locate. Therefore, it is very important to unify file names of the code files and code directories under the same item, which not only can reduce the communication cost and understanding cost of the developer, but also can reduce the errors which are difficult to check due to the difference of the running operating systems. However, in the development of practical projects, although formatting tools and grammar checking tools for languages such as JavaScript, typescript, css or vue are quite common, such tools can only detect the typesetting of letters, indents and the like of codes in files through specific grammar, highlight the code fragments which do not accord with rules by red wave underlining, remind a developer to modify, and realize uniformity of file naming and folder naming in a manner of artificial constraint in the related technology, so that uniformity of naming is difficult to be ensured.
It can be appreciated that fig. 1 is an optional flowchart of a method for monitoring a code library file according to an embodiment of the present application, where the method in fig. 1 may include, but is not limited to, the following steps:
step S100, monitoring a code library-up request initiated by a target object;
step 200, acquiring code submitting information according to a code library-up request, wherein the code submitting information comprises a code file name, a folder name and absolute paths corresponding to the code file name and the folder name one by one respectively;
step S300, checking the names of the code files and the names of the folders according to a preset naming rule and a preset naming white list;
and step 400, when the verification is not passed, interrupting the code submitting operation of the target object and displaying verification information of the verification is not passed, wherein the verification information comprises a code file name, a folder name and a corresponding absolute path.
According to the method for monitoring the code library file, after the code library loading request initiated by the target object is monitored, the code submitting information is obtained, and the code submitting information is checked for the code file name and the folder name according to the preset naming rule and the naming white list, so that the code files which are not checked can be checked among the code file libraries, and the check information is displayed, and therefore a developer can conveniently and quickly find the unmatched code files or the code folders. Compared with the related art, the method and the device can intercept the problems in a code development stage and when the codes are put into the library, so that the codes after being put into the library meet naming standards, and more timely code tracking is achieved, and therefore uniformity of names of code files and folders uploaded by the code library can be achieved.
It should be noted that in some embodiments, the unified kebab-case format, i.e. the letters in file naming are all lowercase, with a short bar-link, by which the automated file naming format is improved over manual review in that: the verification is uniformly carried out before the submission, and the reviewer does not need to pay attention repeatedly during the review, so that the mental burden of the reviewer is reduced, the situation of missing files and the like is avoided, and the degree of automation and the reliability are improved.
It should be noted that in other embodiments, other unified naming formats may be adopted, and verification before code submission is performed through steps S100 to S400, and preferably, in the present application, a sabab-case format is unified to provide a code audit with higher efficiency, so as to further improve code development efficiency.
It should be noted that, the file names are not sensitive to the case of different operating systems, for example, the windows/macos system is insensitive to the case of the file, the files with the same character case and different cases are regarded as the same file under the windows/macos system, and the linux is sensitive to the case, so that the files with the same character and different cases are regarded as two different files under the linux system, and therefore, by checking the names of the code files and the names of the folders before the code is submitted, the bug which is difficult to check due to the fact that the windows/macos system is insensitive to the case of the file of the operating system and the linux is sensitive to the case can be reduced, thereby improving the robustness of the code.
It should be noted that, when the monitoring in step S100 may implement that the development target object submits the code library request in the hook function manner, the verification of the submitted code is triggered, for example, taking the code library as the Git library, where the Git library provides the task, and may intercept in the pre-commit stage, so that the hook function may be executed first, and then, based on the execution structure of the hook function, whether to perform the subsequent code submitting operation is determined.
It should be noted that, unification of item file (folder) names is beneficial to improving code consistency, so that the items are easier to understand. Reducing developer communication cost and understanding cost.
It should be noted that, in some embodiments, for a project developed at the front end, a resource file, such as a picture, is uploaded, and the size of the picture affects performance in operation (for example, the picture is relatively large, and loading is relatively slow, so that the front end display speed is slow), so in some embodiments, the resource file is also checked, and, for example, the size of the picture file and the name of the picture are checked. It should be noted that, in some embodiments, the verification information further includes: and giving a corresponding prompt for the fact that the naming is not in accordance with the specification or the picture is overlarge, if the naming rule is defined as a kebab-case format and the actual code file has capitalization, prompting that the XXX file has capitalization and does not conform to the naming format of the kebab-case. It should be noted that, in the embodiment of the present application, the format of the prompted information is not too much restricted, and those skilled in the art may selectively set according to actual requirements. It should be noted that, in the embodiment of the present application, a display interface is further provided, so that when the verification fails, the display interface is popped up and verification information is displayed in the display interface. In other embodiments, the verification information may be displayed in the same display interface that originated the code-based up request. It should be noted that in some embodiments, the verification information is also stored in the log, so as to track the problems existing in the project process in time, and reduce the probability of the same problems occurring in the next project development. In this regard, the method for providing the prompted verification information is not limited in this embodiment, and those skilled in the art may selectively set the verification information according to actual needs.
It should be noted that, the absolute path in the present application refers to a path on a local terminal storing a file. If the development target object A uploads the code file A1 on the terminal, the code file A1 is stored under the condition that the D:/xxx/ccc/zzz of the terminal is stored, and the D:/xxx/ccc/zzz is the absolute path of the code file A1.
It should be noted that, the relative path is based on the root directory of the item, for example, the root directory of the whole item is D: and/xxxx, wherein the current position is located in the root directory, and the absolute path of the code file A1 located under the D:/xxx/ccc/zzz relative to the root directory is:/ccc/zzz.
It should be noted that, by setting the absolute path, the target object can be quickly assisted to find the position of the code file or the code folder that the corresponding check fails. The changed files in the code base can be conveniently searched by setting relative paths.
It should be noted that, the named white list is a collection of file names and folder names that allow the code files and folders that do not conform to the set uniform naming format to be uploaded to the code library, and by designing the named white list, flexibility of project development is higher, and files that are limited by a compiling tool and other names can be successfully uploaded, so that requirements of project development are met. Therefore, by setting the named white list, project development can be more flexible.
It should be noted that, in the embodiment of the present application, the code files include two configuration files and program files.
It can be understood that fig. 2 is a schematic sub-flowchart of step S200 of a specific embodiment of the monitoring method of a code library file of the present application, and in some embodiments, referring to fig. 2, step S200, obtaining code submission information according to a code library request includes:
step S210, responding to a code library-loading request, and triggering a preset pre-submission hook function;
step S220, a code file change list is obtained through pre-submitting a difference comparison command of a code library corresponding to a hook function call code library request;
step S230, code submitting information is obtained according to the code file change list;
correspondingly, step S300, checking the code file name and the folder name according to a preset naming rule and a preset naming white list, includes:
and checking the names of the code files and the names of the folders according to a preset naming rule and a preset naming white list through a pre-submitting hook function.
It should be noted that, in the embodiment of the present application, the code library is a Git library, the code file change list is a collection of code files cached in a temporary storage area of the Git library, and by checking only files in the temporary storage area of the Git library, the function of shortening the time required for checking is achieved, and the efficiency is improved, similar to the auxiliary library of eslin, namely, lin-staged.
It should be noted that, the submitting hook function may be implemented by using the task, and the steps S100 to S400 are executed by submitting the hook function, so that the implementation process is more flexible and the efficiency is higher.
In some embodiments, obtaining code commit information from the code file change list includes:
extracting the code file name of the changed code file and the relative path of the code file from the code file change list;
analyzing the relative path according to an absolute path function set in the pre-submitted hook function to obtain a folder name;
and combining the relative path and the project root directory according to an absolute path function set in the pre-submitted hook function to obtain an absolute path.
In some embodiments, the code submission information is obtained from a code library request, further comprising:
calling a synchronous-to-asynchronous component through a pre-submitted hook function;
correspondingly, a code file change list is obtained through pre-submitting a difference comparison command of a code library corresponding to a hook function call code library request, and the method comprises the following steps:
and calling a code library difference comparison command corresponding to the code library up-library request by the synchronous-to-asynchronous component to obtain a code file change list.
It should be noted that, the synchronous-to-asynchronous component such as desync can implement global blocking, so as to improve the verification efficiency, so that the whole process time of code submission is not too long compared with the process without adding verification, and the research and development experience is compatible while the problem of uniformity of names of code files and folders uploaded by a code library is solved.
In some embodiments, verifying the code file name and the folder name according to a preset naming rule and a preset naming white list includes:
judging whether a code file name and a folder name exist in the named white list;
and carrying out letter lower case verification and connector verification on the code file names and the folder names which do not exist in the named white list.
It should be noted that, the letter lower case check is used to determine whether all the names are lower cases, and the connector check is used to determine whether two vocabularies are connected through a unified connector, if the unified connector is set to "-", xx.yy cannot be checked.
In some embodiments, the named whitelist includes a folder named whitelist and a file named whitelist, and determining whether a code file name and a folder name exist in the named whitelist includes:
judging whether the code file name exists in a file naming white list or not, so as to carry out letter lower case verification and connector verification on the code file name which is not in the file naming white list;
and judging whether the folder names exist in the folder naming white list or not, and performing letter lower case verification and connector verification on the folder names which are not in the folder naming white list respectively.
In some embodiments, the named whitelist is obtained by:
determining a list path of a named white list from a preset configuration file directory;
and reading the content of the name of the list file in the list path to obtain a named white list.
Taking a resource file as an example, a method for monitoring a code library file according to a specific embodiment of the present application will be described with reference to fig. 3,
(1) a getAllDirectories method is realized and is used for acquiring all folders and absolute paths thereof in the project, and the acquired absolute paths are put into an array for standby.
(2) A checkNameFormat method is realized, which is used for checking the name format of the code file/folder, printing the names of the code file/folder which does not meet the specification and the paths thereof on a console, prompting a developer to modify, interrupting the submitting action, and not repairing and not allowing the developer to submit.
(3) Global blocking is performed using a third party library deasync.
(4) After global blocking is performed, performing 'gitdiff-name-only-staged' by exec method provided by child_process module of nodejs; the newly changed code file/folder/picture which has been moved into the git register and its relative path to the project root directory are obtained.
(5) And (5) checking the name format of the files in the folder and the git temporary storage area, and checking the size of the picture file. And giving a corresponding prompt for the fact that the naming is out of specification or the picture is too large, and stopping the submitting process. And a corresponding prompt is also given when the complete verification passes.
(6) Two configurable arrays, nociceckdirarr and nociceckfilearr, are provided externally as exempt whitelists of folders and code files, respectively, so that a profile folder like a vscode and a file like eslin.
(7) And (3) during actual application, the Git submits a pre-commit hook for triggering the task, so that a code library-up request initiated by a target object is monitored, and the actions of steps (1) - (5) are carried out.
In order to achieve the above object, referring to fig. 4, a second aspect of the embodiments of the present application proposes a monitoring system for a code library file, including:
a code library 100;
the target object terminal 200, the target object terminal 200 is in communication connection with the code library 100, and the target object terminal 200 is used for initiating a code library loading request to the code library 100;
the code supervision module 300, the code supervision module 300 is used for monitoring the code library request and executing the monitoring method of the code library file.
According to the monitoring system for the code library files, after the monitoring system monitors a code library loading request initiated to the code library through the target object terminal, code submitting information is obtained, and the code submitting information is checked for the code file names and the folder names according to the preset naming rule and the naming white list, so that code files which are not checked for pass can be checked among the code file libraries, and check information is displayed, and therefore a developer can conveniently and quickly find unmatched code files or code folders. Compared with the related art, the method and the device can intercept the problems in a code development stage and when the codes are put into the library, so that the codes after being put into the library meet naming standards, and more timely code tracking is achieved, and therefore uniformity of names of code files and folders uploaded by the code library can be achieved.
It should be noted that, the code supervision module 300 may be independent of the target object terminal 200 or may be applied to the target object terminal 200. In some embodiments, the code supervision module 300 includes a monitoring module 310, an obtaining module 320, a checking module 330, and a prompting module 340, where the monitoring module 310 is configured to monitor a code-based request initiated by a target object; the obtaining module 320 is configured to obtain code submission information according to the code database request, where the code submission information includes a code file name, a folder name, and absolute paths corresponding to the code file name and the folder name one by one; the verification module 330 is configured to verify the code file name and the folder name according to a preset naming rule and a preset naming white list; the prompting module 340 is configured to interrupt a code submitting operation of the target object and display verification information that the verification fails when the verification fails, where the verification information includes a code file name and/or a folder name, and a corresponding absolute path.
The embodiment of the application also provides electronic equipment, which comprises a memory and a processor, wherein the memory stores a computer program, and the processor realizes the monitoring method of the code library file when executing the computer program.
Referring to fig. 5, fig. 5 illustrates a hardware structure of an electronic device according to another embodiment, where the electronic device includes:
the processor 601 may be implemented by a general-purpose CPU (central processing unit), a microprocessor, an application-specific integrated circuit (ApplicationSpecificIntegratedCircuit, ASIC), or one or more integrated circuits, etc. for executing related programs to implement the technical solutions provided by the embodiments of the present application;
the memory 602 may be implemented in the form of read-only memory (ReadOnlyMemory, ROM), static storage, dynamic storage, or random access memory (RandomAccessMemory, RAM). The memory 602 may store an operating system and other application programs, and when the technical solutions provided in the embodiments of the present application are implemented by software or firmware, relevant program codes are stored in the memory 602, and the processor 601 invokes a monitoring method for executing the code library file of the embodiments of the present application;
an input/output interface 603 for implementing information input and output;
the communication interface 604 is configured to implement communication interaction between the device and other devices, and may implement communication in a wired manner (e.g. USB, network cable, etc.), or may implement communication in a wireless manner (e.g. mobile network, WIFI, bluetooth, etc.);
a bus 605 for transferring information between the various components of the device (e.g., the processor 601, memory 602, input/output interface 603, and communication interface 604);
wherein the processor 601, the memory 602, the input/output interface 603 and the communication interface 604 are communicatively coupled to each other within the device via a bus 605.
The embodiment of the application also provides a storage medium, which is a computer readable storage medium, and the storage medium stores a computer program, and the computer program realizes the monitoring method of the code library file when being executed by a processor.
The memory, as a non-transitory computer readable storage medium, may be used to store non-transitory software programs as well as non-transitory computer executable programs. In addition, the memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory optionally includes memory remotely located relative to the processor, the remote memory being connectable to the processor through a network. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The embodiments described in the embodiments of the present application are for more clearly describing the technical solutions of the embodiments of the present application, and do not constitute a limitation on the technical solutions provided by the embodiments of the present application, and as those skilled in the art can know that, with the evolution of technology and the appearance of new application scenarios, the technical solutions provided by the embodiments of the present application are equally applicable to similar technical problems.
It will be appreciated by those skilled in the art that the technical solutions shown in the figures do not constitute limitations of the embodiments of the present application, and may include more or fewer steps than shown, or may combine certain steps, or different steps.
The above described apparatus embodiments are merely illustrative, wherein the units illustrated as separate components may or may not be physically separate, i.e. may be located in one place, or may be distributed over a plurality of network elements. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
Those of ordinary skill in the art will appreciate that all or some of the steps of the methods, systems, functional modules/units in the devices disclosed above may be implemented as software, firmware, hardware, and suitable combinations thereof.
The terms "first," "second," "third," "fourth," and the like in the description of the present application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that embodiments of the present application described herein may be implemented in sequences other than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be understood that in this application, "at least one" means one or more, and "a plurality" means two or more. "and/or" for describing the association relationship of the association object, the representation may have three relationships, for example, "a and/or B" may represent: only a, only B and both a and B are present, wherein a, B may be singular or plural. The character "/" generally indicates that the context-dependent object is an "or" relationship. "at least one of" or the like means any combination of these items, including any combination of single item(s) or plural items(s). For example, at least one (one) of a, b or c may represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", wherein a, b, c may be single or plural.
In the several embodiments provided in this application, it should be understood that the disclosed apparatus and method may be implemented in other ways. For example, the above-described apparatus embodiments are merely illustrative, and for example, the above-described division of units is merely a logical function division, and there may be another division manner in actual implementation, for example, a plurality of units or components may be combined or may be integrated into another system, or some features may be omitted, or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described above as separate components may or may not be physically separate, and components shown as units may or may not be physical units, may be located in one place, or may be distributed over a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied essentially or in part or all of the technical solution contributing to the prior art or in the form of a software product stored in a storage medium, including multiple instructions to cause a computer device (which may be a personal computer, a file server, or a network device, etc.) to perform all or part of the steps of the methods of the various embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a magnetic disk, or an optical disk, or other various media capable of storing a program.
Preferred embodiments of the present application are described above with reference to the accompanying drawings, and thus do not limit the scope of the claims of the embodiments of the present application. Any modifications, equivalent substitutions and improvements made by those skilled in the art without departing from the scope and spirit of the embodiments of the present application shall fall within the scope of the claims of the embodiments of the present application.

Claims (10)

1. A method for monitoring a code library file, the method comprising:
monitoring a code library-up request initiated by a target object;
acquiring code submission information according to the code library-up request, wherein the code submission information comprises a code file name, a folder name and absolute paths corresponding to the code file name and the folder name one by one respectively;
checking the code file name and the folder name according to a preset naming rule and a preset naming white list;
and when the verification is not passed, interrupting the code submitting operation of the target object and displaying verification information which does not pass the verification, wherein the verification information comprises the code file name, the folder name and the corresponding absolute path.
2. The method for monitoring a code library file according to claim 1, wherein the acquiring code submission information according to the code library request comprises:
triggering a preset pre-submission hook function in response to the code library-loading request;
calling a difference comparison command of a code library corresponding to the code library loading request through the pre-submitted hook function to obtain a code file change list of the code files cached in a temporary storage area of the code library;
obtaining the code submitting information according to the code file change list;
correspondingly, the verifying the code file name and the folder name according to a preset naming rule and a preset naming white list includes:
and checking the code file name and the folder name according to a preset naming rule and a preset naming white list through the pre-submission hook function.
3. The method for monitoring a code library file according to claim 2, wherein the obtaining the code submission information according to the code file change list comprises:
extracting the code file name of the changed code file from the code file change list and the relative path of the code file;
analyzing the relative path according to an absolute path function set in the pre-submitted hook function to obtain the folder name;
and carrying out combination processing on the relative path and the project root directory according to an absolute path function set in the pre-submitted hook function to obtain the absolute path.
4. The method for monitoring a code library file according to claim 2, wherein the obtaining code submission information according to the code library request further comprises:
calling a synchronous-to-asynchronous component through the pre-submitted hook function;
correspondingly, the step of calling the code library difference comparison command corresponding to the code library request through the pre-submitted hook function to obtain a code file change list comprises the following steps:
and calling a difference comparison command of the code library corresponding to the code library loading request through the synchronous-to-asynchronous component to obtain a code file change list.
5. The method for monitoring a code library file according to claim 1, wherein verifying the code file name and the folder name according to a preset naming rule and a preset naming white list comprises:
judging whether the code file name and the folder name exist in the named white list;
and carrying out letter lower case verification and connector verification on the code file names and the folder names which are not in the named white list respectively.
6. The method for monitoring a code library file according to claim 5, wherein the named white list includes a folder named white list and a file named white list, and the determining whether the code file name and the folder name exist in the named white list includes:
judging whether the code file name exists in the file naming white list or not, so as to carry out letter lower case verification and connector verification on the code file name which is not in the file naming white list;
and judging whether the folder names exist in the folder naming white list or not, and respectively carrying out letter lower case verification and connector verification on the folder names which are not in the folder naming white list.
7. The method for monitoring a code library file according to claim 1, wherein the named white list is obtained by:
determining a list path of the named white list from a preset configuration file catalog and a list file name;
and reading the content of the name of the list file in the list path to obtain the named white list.
8. A system for monitoring a code library file, the system comprising:
a code base;
the target object terminal is in communication connection with the code base and is used for initiating a code base-up request to the code base;
a code supervision module, configured to monitor the code library request and execute the method for monitoring a code library file according to any one of claims 1 to 7.
9. An electronic device comprising a memory storing a computer program and a processor implementing the method of monitoring a code library file according to any one of claims 1 to 7 when the computer program is executed by the processor.
10. A computer-readable storage medium storing a computer program, characterized in that the computer program, when executed by a processor, implements the method of monitoring a code library file according to any one of claims 1 to 7.
CN202311323738.7A 2023-10-11 2023-10-11 Method, system, equipment and storage medium for monitoring code library file Pending CN117370175A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202311323738.7A CN117370175A (en) 2023-10-11 2023-10-11 Method, system, equipment and storage medium for monitoring code library file

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202311323738.7A CN117370175A (en) 2023-10-11 2023-10-11 Method, system, equipment and storage medium for monitoring code library file

Publications (1)

Publication Number Publication Date
CN117370175A true CN117370175A (en) 2024-01-09

Family

ID=89405346

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202311323738.7A Pending CN117370175A (en) 2023-10-11 2023-10-11 Method, system, equipment and storage medium for monitoring code library file

Country Status (1)

Country Link
CN (1) CN117370175A (en)

Similar Documents

Publication Publication Date Title
CN108459962B (en) Code normalization detection method and device, terminal equipment and storage medium
EP3265916B1 (en) A method for identifying a cause for a failure of a test
US9870223B2 (en) Efficient detection of architecture related issues during the porting process
CN111144839A (en) Project construction method, continuous integration system and terminal equipment
CN111538659B (en) Interface testing method, system, electronic equipment and storage medium of business scene
CN110955409B (en) Method and device for creating resources on cloud platform
US11422917B2 (en) Deriving software application dependency trees for white-box testing
US9395977B2 (en) Locating program code units after software refactoring
CN111367531A (en) Code processing method and device
US10698666B2 (en) Automatically building software projects
US8738755B2 (en) Providing external access to service versions via a bundle framework
CN111352631B (en) Interface compatibility detection method and device
CN111966630B (en) File type detection method, device, equipment and medium
CN112068874B (en) Continuous integration method and device for software items, terminal equipment and storage medium
US10467076B1 (en) System and method of input validation
CN117370175A (en) Method, system, equipment and storage medium for monitoring code library file
US20210349808A1 (en) Source quality check service
US11347533B2 (en) Enhanced virtual machine image management system
CN113220586A (en) Automatic interface pressure test execution method, device and system
CN111651195A (en) System dependency package conflict detection method and device
CN111694729A (en) Application testing method and device, electronic equipment and computer readable medium
US20130067500A1 (en) Legacy application integration within a bundle framework
US11334419B1 (en) Information handling system fault analysis with remote remediation file system
CN115421785B (en) Method, device and medium for transplanting application program
US20230305817A1 (en) Dynamic importation of external dependency information to support autocompletion in an interactive development environment

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