Barrier-free problem detection method, device, equipment and computer program product
By obtaining source code files in the code writing scenario and detecting accessibility problems, the problem of untimely detection in the existing technology is solved, and the ability to discover accessibility problems in the source code stage is realized, reducing costs and improving the rapidity of detection and accuracy.
Patent Information
- Application Number
- CN202411472381.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-21
- Publication Date
- 2025-02-18
- Estimated Expiration
- Not applicable · inactive patent
AI Technical Summary
The existing methods for detecting barrier-free problems cannot be detected in time, resulting in high cost of discovery and repair.
By obtaining the source code file to be detected, the detection operation is carried out based on the information in the source code file to obtain the detection results. This method realizes the detection of barrier-free problems in the application scenario of code writing, eliminating the steps of code compilation.
It realizes the ability to discover potential barrier-free problems during the source code development stage, reduces the cost of discovery and repair, and improves the speed and accuracy of detection.
Smart Images

Figure CN119473876A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of detection technology, and in particular to a method, device, equipment and computer program product for detecting accessibility issues. Background Art
[0002] Information accessibility refers to the use of information technology to make up for differences in physical functions, environments, etc., so that anyone (whether healthy or disabled, young or old) can obtain, interact and use information equally, conveniently and safely. In order to ensure a good barrier-free experience, developers need to adapt and develop problems by adding code attributes, rewriting code, etc. If developers do not write code in the correct way, it may cause barrier-free problems such as controls not being interactive, which affects the experience.
[0003] Currently, the detection of accessibility issues is often achieved in the following way: obtain the application product to be tested, determine the actual performance of the application product, and then test the actual performance to find out whether there are accessibility issues. When accessibility issues are found, they can be distributed to the corresponding developers of the application product for repair.
[0004] However, the above-mentioned accessibility problem detection operation cannot discover the problem in time, so that the accessibility problem is discovered late, thereby increasing the cost of discovering and repairing the accessibility problem. Summary of the invention
[0005] The embodiments of the present invention provide a method, apparatus, device and computer program product for detecting accessibility problems, which can detect whether accessibility problems exist as early as possible, thereby reducing the cost of discovering and repairing accessibility problems.
[0006] In a first aspect, an embodiment of the present invention provides a method for detecting accessibility issues, including:
[0007] In a code writing scenario, a source code file to be detected is obtained, wherein the source code file includes source code information for realizing a preset function;
[0008] An accessibility problem detection operation is performed based on the source code file to obtain a detection result.
[0009] In a second aspect, an embodiment of the present invention provides a device for detecting accessibility issues, including:
[0010] A first acquisition module is used to acquire a source code file to be detected in a code writing scenario, wherein the source code file includes source code information for realizing a preset function;
[0011] The first processing module is used to perform an accessibility problem detection operation based on the source code file to obtain a detection result.
[0012] In a third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory, and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method for detecting accessibility issues in the first aspect mentioned above.
[0013] In a fourth aspect, an embodiment of the present invention provides a computer storage medium for storing a computer program, wherein the computer program enables a computer to implement the accessibility problem detection method in the first aspect when executed.
[0014] In a fifth aspect, an embodiment of the present invention provides a computer program product, comprising: a computer-readable storage medium storing computer instructions, which, when executed by one or more processors, causes the one or more processors to execute the steps in the method for detecting accessibility issues shown in the first aspect above.
[0015] The accessibility problem detection method, apparatus, device and computer program product provided by the embodiments of the present invention, in the application scenario of code writing, can obtain the source code file to be detected, and then perform the accessibility problem detection operation based on the source code information in the source code file to obtain the detection result, thereby effectively realizing the accessibility problem detection operation that does not rely on the executable code compilation product. Specifically, the accessibility problem detection operation can be implemented in the source code development stage to discover possible and potential accessibility problems. For code developers, the detection operation in the source code stage has the advantage of discovering accessibility problems faster and omits the code compilation step. This not only enables the accessibility problem detection operation to be implemented as early as possible, but also helps to reduce the cost of discovering and repairing accessibility problems, further improving the practicality of the method. BRIEF DESCRIPTION OF THE DRAWINGS
[0016] In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0017] Figure 1 A schematic diagram of a scenario of a method for detecting accessibility issues provided by an embodiment of the present invention;
[0018] Figure 2 A flowchart of a method for detecting accessibility issues provided by an embodiment of the present invention;
[0019] Figure 3 A schematic diagram of a flow chart of performing an accessibility problem detection operation based on the source code file and obtaining a detection result provided by an embodiment of the present invention;
[0020] Figure 4 A flowchart of another method for detecting accessibility issues provided by an embodiment of the present invention;
[0021] Figure 5 A schematic diagram of the principle of a method for detecting accessibility issues provided by an application embodiment of the present invention;
[0022] Figure 6 A schematic diagram of the structure of a device for detecting accessibility issues provided by an embodiment of the present invention;
[0023] Figure 7 For Figure 6 A schematic diagram of the structure of an electronic device corresponding to the accessibility problem detection device provided in the embodiment is shown. DETAILED DESCRIPTION
[0024] In order to make the purpose, technical solution and advantages of the embodiments of the present invention clearer, the technical solution in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.
[0025] The terms used in the embodiments of the present invention are only for the purpose of describing specific embodiments, and are not intended to limit the present invention. The singular forms "a", "an", and "the" used in the embodiments of the present invention and the appended claims are also intended to include plural forms, unless the context clearly indicates other meanings, and "multiple" generally includes at least two, but does not exclude the situation of including at least one.
[0026] It should be understood that the term "and / or" used in this article is only a way to describe the association relationship of associated devices, indicating that there can be three relationships. For example, A and / or B can represent: A exists alone, A and B exist at the same time, and B exists alone. In addition, the character " / " in this article generally indicates that the associated devices before and after are in an "or" relationship.
[0027] As used herein, the words "if" and "if" may be interpreted as "at the time of" or "when" or "in response to determining" or "in response to detecting", depending on the context. Similarly, the phrases "if it is determined" or "if (stated condition or event) is detected" may be interpreted as "when it is determined" or "in response to determining" or "when detecting (stated condition or event)" or "in response to detecting (stated condition or event)", depending on the context.
[0028] It should also be noted that the terms "include", "comprises" or any other variations thereof are intended to cover non-exclusive inclusion, so that a product or system including a series of elements includes not only those elements, but also other elements not explicitly listed, or also includes elements inherent to such a product or system. In the absence of more restrictions, the elements defined by the sentence "comprises a ..." do not exclude the existence of other identical elements in the product or system including the elements.
[0029] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with the relevant laws, regulations and standards of the relevant countries and regions, and provide corresponding operation entrances for users to choose to authorize or refuse.
[0030] In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0031] Terminology explanation:
[0032] Information accessibility: refers to the use of information technology to compensate for differences in physical functions, environmental conditions, etc., so that anyone (whether healthy or disabled, young or old) can obtain, interact and use information equally, conveniently and safely.
[0033] Accessibility issues: In order to ensure a good barrier-free experience for a product, developers need to adapt and develop accessibility issues by adding code attributes, rewriting code, etc. If developers do not write code in the correct way, it may cause problems that affect the experience, such as the controls in the product not being interactive. The above problems can be called accessibility issues.
[0034] Compilation product / compilation product: Different from source code, compilation product refers to the executable product obtained after processing by a programming language compiler.
[0035] In order to facilitate understanding of the specific implementation process and implementation effect of the accessibility problem detection method, device, equipment and computer program product in this embodiment, the relevant technology is briefly described below:
[0036] In order to solve the problem that the detection operation of accessibility problems provided in the related art is late in discovering problems, and the problems cannot be discovered in time, thereby increasing the cost of discovering and repairing accessibility problems, the embodiments of the present invention provide a method, device, equipment and computer program product for detecting accessibility problems, and refer to the attached Figure 1 As shown, the executor of the accessibility problem detection method is an accessibility problem detection device 200, and the accessibility problem detection device 200 can be communicatively connected to the client 100 to provide accessibility problem detection services to the user through the client 100. When the user has a need to detect an accessibility problem, the accessibility problem detection device 200 can obtain the accessibility problem detection need and implement the corresponding accessibility problem detection operation through the accessibility problem detection need.
[0037] The accessibility problem detection device 200 refers to a device that can provide accessibility problem detection operations in a network virtual environment, and usually refers to a device that uses the network to perform information planning and accessibility problem detection operations. In terms of physical implementation, the accessibility problem detection device 200 can be any device that can provide computing services, respond to accessibility problem detection requirements, and perform accessibility problem detection operations, for example: it can be a cluster server, a conventional server, a cloud server, a cloud host, a virtual center, etc. The accessibility problem detection device 200 mainly includes a processor, a hard disk, a memory, a system bus, etc., which is similar to a general computer architecture.
[0038] When the accessibility problem detection device 200 is implemented as a cloud server, the accessibility problem detection method can be executed in the cloud, and several computing nodes (cloud servers) can be deployed in the cloud, each computing node has computing, storage and other processing resources. In the cloud, multiple computing nodes can be organized to provide a certain service. Of course, a computing node can also provide one or more services. The cloud can provide the service by providing a service interface to the outside world, and the user calls the service interface to use the corresponding service. The service interface includes software development kits (Software Development Kit, referred to as SDK), application programming interfaces (Application Programming Interface, referred to as API), and other forms.
[0039] Specifically, the client 100 that is communicatively connected to the accessibility detection device 200 can be implemented as a mobile phone, a personal computer PC, a tablet computer, a setting application, a wearable device, etc. In addition, the basic structure of the client 100 may include: at least one processor. The number of processors depends on the configuration and type of the client 100. The client 100 may also include a memory, which may be volatile, such as: random access memory (Random Access Memory, referred to as RAM), or non-volatile, such as: read-only memory (Read-Only Memory, referred to as ROM), flash memory, etc., or may also include both types. The memory usually stores an operating system (Operating System, referred to as OS), one or more application programs, and may also store program data, etc. In addition to the processing unit and the memory, the client 100 also includes some basic configurations, such as: a network card chip, an IO bus, a display component, and some peripheral devices, etc. Optionally, some peripheral devices may include, for example: a keyboard, a mouse, an input pen, a printer, etc. Other peripheral devices are well known in the art and will not be described in detail here.
[0040] In the above embodiment, a network connection is established between the client 100 and the detection device 200 for accessibility problems, and the network connection can be a wireless or wired network connection. If the client 100 and the detection device 200 for accessibility problems are connected by communication, the network standard of the mobile network can be any one of 2G (Global System for Mobile Communications GSM), 2.5G (General Packet Radio Service GPRS), 3G (Wideband Code Division Multiple Access WCDMA, Time Division Synchronous Code Division Multiple Access TD-SCDMA, Code Division Multiple Access 2000 CDMA2000, Universal Mobile Telecommunications System UTMS), 4G (Long Term Evolution LTE), 4G+ (Enhanced Long Term Evolution LTE+), Worldwide Interoperability for Microwave Access WiMax, 5G, 6G, etc.
[0041] Specifically, the client 100 is an application program interface for providing a detection service for accessibility issues. In a code writing scenario, when a user has a detection requirement for accessibility issues with respect to source code information used to implement a preset function, the source code file to be detected can be obtained through the application program interface. Specifically, the client 100 can display a code writing interface including a code writing interface; the user can perform code writing operations through the code writing interface, and through the code writing interface, the user's interactive operations input to the code writing interface can be obtained. The interactive operations can be interface interactive operations (for example, click operations, sliding operations, etc.), voice interactive operations, etc., and then the source code file to be detected can be obtained based on the interactive operations, wherein the source code file includes source code information used to implement the preset function. In order to be able to perform accessibility problem detection operations based on the source code files, the source code file to be detected can be sent to the accessibility problem detection device 200.
[0042] The accessibility problem detection device 200 is used to obtain the source code file to be detected through the client 100, wherein the source code file includes source code information for realizing preset functions. In order to realize the accessibility problem detection operation in the code writing scenario, after obtaining the source code file, the accessibility problem detection operation can be performed based on the source code file, so as to obtain the detection result for identifying whether there is an accessibility problem in the source code file.
[0043] In this embodiment, it is effectively implemented that the detection operation of accessibility problems can be performed without relying on executable code compilation products. Specifically, the detection operation of accessibility problems can be implemented in the source code development stage to discover possible and potential accessibility problems. For code developers, the detection operation in the source code stage has the advantage of discovering accessibility problems faster and omits the code compilation step. This not only enables the detection operation of accessibility problems to be implemented as early as possible, but also helps to reduce the cost of discovering and repairing accessibility problems.
[0044] Some embodiments of the present invention are described in detail below in conjunction with the accompanying drawings. In the case where there is no conflict between the embodiments, the following embodiments and the features in the embodiments can be combined with each other. In addition, the step sequence in the following method embodiments is only an example and not a strict limitation.
[0045] Figure 2 A flowchart of a method for detecting accessibility issues provided by an embodiment of the present invention; see Attachment Figure 2As shown, this embodiment provides a method for detecting accessibility issues. The execution subject of the method is a detection device for accessibility issues. The detection device for accessibility issues can be implemented as software, or a combination of software and hardware. When the detection device for accessibility issues is implemented as hardware, it can be various electronic devices with accessibility issue detection capabilities, including but not limited to personal computers, servers, etc. When the detection device for accessibility issues is implemented as software, it can be installed in the electronic devices listed above. Specifically, based on the above-mentioned detection device for accessibility issues, the detection method for accessibility issues in this embodiment may include:
[0046] Step S201: in a code writing scenario, a source code file to be detected is obtained, wherein the source code file includes source code information for realizing a preset function.
[0047] Step S202: Perform accessibility problem detection operations based on the source code file to obtain detection results.
[0048] The specific implementation process and effects of each of the above steps are described in detail below:
[0049] Step S201: in a code writing scenario, a source code file to be detected is obtained, wherein the source code file includes source code information for realizing a preset function.
[0050] In the code writing scenario, developers can perform code writing operations, code modification operations, code deletion operations, or code checking operations, etc. In order to realize the detection operation of accessibility issues as early as possible, the source code file to be detected can be obtained in the code writing application scenario, wherein the source code file includes source code information for realizing preset functions, and the number of the above preset functions can be one or more. When the number of preset functions is one, the source code file includes a section of source code information corresponding to one preset function; when the number of preset functions is multiple, the source code file may include multiple sections of source code information corresponding to multiple preset functions.
[0051] Specifically, this embodiment does not limit the method for obtaining source code files. In some instances, source code files can be obtained by performing a full scan on a code container in a code writing scenario. At this time, obtaining the source code file to be detected may include: obtaining a code container in a code writing scenario, the code container provides an application service interface, so that a user can implement a code writing operation, a code modification operation, a code deletion operation, or a code inspection operation through the application service interface; performing a full scan operation on the code container to obtain source code files. At this time, the obtained source code files may include source code information corresponding to the full amount of preset functions. In some instances, the number of the obtained source code files may be multiple, and different preset functions may correspond to different source code files.
[0052] In other instances, the source code file can be obtained not only by performing a full scan on the code container in the code writing scenario, but also by performing an incremental scan on the code container in the code writing scenario. In this case, obtaining the source code file to be detected may include: obtaining the code container in the code writing scenario; performing an incremental scanning operation on the source code information of the code container to obtain the source code file, and the obtained source code file may include the source code information corresponding to the incremental preset function. When the number of the incremental preset functions is multiple, the number of the obtained source code files is also multiple, and different preset functions may correspond to different source code files.
[0053] Step S202: Perform accessibility problem detection operations based on the source code file to obtain detection results.
[0054] After the source code file is obtained, in order to implement the accessibility problem detection operation as soon as possible, the accessibility problem detection operation can be performed based on the source code file to obtain a detection result. The obtained detection result can be implemented as a first detection result for identifying the existence of an accessibility problem; or the obtained detection result can be implemented as a second detection result for identifying the absence of an accessibility problem.
[0055] Specifically, this embodiment does not limit the specific implementation method of accessibility problem detection. In some instances, the accessibility problem detection operation can be implemented through a pre-trained neural network model or a large language model. In this case, performing the accessibility problem detection operation based on the source code file and obtaining the detection result may include: obtaining the pre-trained neural network model or the large language model; inputting the source code file into the neural network model or the large language model to perform the accessibility problem detection operation, so as to obtain the detection result output by the neural network model or the large language model.
[0056] The accessibility problem detection method provided in the present embodiment, in the application scenario of code writing, obtains the source code file to be detected, and then performs the accessibility problem detection operation based on the source code information in the source code file to obtain the detection result, which effectively realizes that the accessibility problem detection operation can be performed without relying on the executable code compilation product. Specifically, the accessibility problem detection operation can be implemented in the source code development stage to discover possible and potential accessibility problems. For code developers, the detection operation in the source code stage has the advantage of discovering accessibility problems faster and omits the code compilation step. This not only enables the accessibility problem detection operation to be implemented as early as possible, but also helps to reduce the cost of discovering and repairing accessibility problems, further improving the practicality of the method.
[0057] Figure 3 A schematic diagram of a flow chart of performing accessibility problem detection based on source code files and obtaining detection results according to an embodiment of the present invention; based on the above embodiment, refer to the attached Figure 3 As shown, the detection operation of accessibility issues can be implemented not only through a pre-trained neural network model or a large language model, but also through detection rules. In this case, the detection operation of accessibility issues is performed based on the source code file, and the detection results obtained may include:
[0058] Step S301: Acquire detection rules for implementing accessibility problem detection operations.
[0059] Among them, detection rules for implementing accessibility problem detection operations are pre-configured and can be stored in a preset area or a preset device. When it is necessary to perform accessibility problem detection operations on source code files, the detection rules for implementing accessibility problem detection operations can be obtained by accessing the preset area or the preset device.
[0060] The detection rules can have different forms of expression, for example: the detection rules can be implemented as code representation information, that is, the detection rules can be implemented as multiple lines of code information; or, the detection rules can be implemented as logic expression information, that is, the detection rules can be implemented as a logic expression tree or a logic expression block diagram. Detection rules of different forms can be obtained in different ways. In some instances, when the detection rules are implemented as code representation information, the detection rules can be determined based on the problem type of the accessibility problem. At this time, obtaining the detection rules for implementing the detection operation of the accessibility problem may include: obtaining the problem type corresponding to at least one accessibility problem to be detected; based on the problem type, generating code representation information corresponding to each accessibility problem; determining the code representation information corresponding to each accessibility problem as a detection rule, and different accessibility problems correspond to different detection rules.
[0061] Specifically, for source code information in a code writing scenario, there may be various accessibility issues (which may refer to logical issues in the compiled product), for example: in a visually impaired application scenario, whether the compiled product is configured with a voice playback function; in a hearing-impaired application scenario, whether the compiled product is configured with a text display function, etc. In order to accurately perform accessibility problem detection operations on source code information in various application scenarios, the problem type corresponding to at least one accessibility problem to be detected can be first obtained, wherein the at least one accessibility problem can be all preset accessibility problems that can be detected, and the number of problem types obtained will also be large.
[0062] Since the number of problem types can directly affect the duration of the accessibility problem detection operation, and the compiled products in different application scenarios often correspond to different accessibility problems, in order to avoid the accessibility problem detection operation taking up a long time and reducing the efficiency of the accessibility problem detection operation, the at least one accessibility problem mentioned above may refer to several accessibility problems that occur more frequently, and then the number of problem types of the at least one accessibility problem is determined to be several.
[0063] Specifically, all backup accessibility questions that can be used for detection operations can be obtained first, and then the frequency of occurrence or the number of occurrences of each backup accessibility question can be counted based on historical data; all backup accessibility questions are sorted based on the frequency of occurrence or the number of occurrences, and the backup accessibility questions that are in the first N (N can be a number less than or equal to 5) in the sorting queue are determined as at least one of the above-mentioned accessibility questions. For example, at least one accessibility question can be implemented as 3 accessibility questions with higher occurrence frequencies, 5 accessibility questions, and so on.
[0064] Alternatively, at least one accessibility issue may be determined in combination with a specific compilation product type. In this case, the product type of the compilation product may be determined first, and based on the product type, a plurality of adaptation accessibility issues that can be detected for the compilation product may be determined. Then, based on historical data, the frequency of occurrence or the number of occurrences of each adaptation accessibility issue may be counted. The plurality of adaptation accessibility issues may be sorted based on the frequency of occurrence or the number of occurrences, and the first N (N may be a number less than or equal to 5) adaptation accessibility issues in the sorting queue may be determined as the at least one accessibility issue mentioned above. For example, the at least one accessibility issue may be implemented as 4 accessibility issues with higher occurrence frequencies, 6 accessibility issues, and so on.
[0065] After determining at least one accessibility problem, the problem type corresponding to each of the at least one accessibility problem can be directly determined, wherein different accessibility problems can correspond to different problem types. Since different types of accessibility problems can correspond to different code representation information, in order to accurately perform detection operations on at least one accessibility problem, code representation information corresponding to each accessibility problem can be generated based on the problem type corresponding to each of the at least one accessibility problems, wherein the code representation information corresponding to each accessibility problem can be obtained by parsing each accessibility problem based on the problem type.
[0066] After obtaining the code representation information corresponding to each accessibility problem, the code representation information corresponding to each accessibility problem can be directly determined as a detection rule, wherein different accessibility problems can correspond to different detection rules, which effectively ensures the accuracy and reliability of determining the detection rules.
[0067] In some other instances, the detection rules are also implemented as logical expression information. In this case, the detection rules can be determined based on the logical expression information of the accessibility problem. Specifically, obtaining the detection rules for implementing the detection operation of the accessibility problem may include: determining the logical expression information corresponding to each accessibility problem based on the problem type corresponding to at least one accessibility problem; and determining the logical expression information corresponding to each accessibility problem as the detection rule corresponding to each accessibility problem.
[0068] In order to accurately determine the detection rules constructed in a logical manner to express information, the problem type corresponding to at least one accessibility problem to be detected can be obtained, wherein the specific implementation methods of at least one accessibility problem and the problem type corresponding to at least one accessibility problem are similar to the specific implementation methods of at least one accessibility problem and the problem type corresponding to at least one accessibility problem in the above-mentioned embodiments. Please refer to the above-mentioned statements for details, which will not be repeated here.
[0069] After obtaining the problem type corresponding to at least one accessibility problem, the logical expression information corresponding to each accessibility problem can be determined based on the problem type corresponding to at least one accessibility problem. The logical expression information can be implemented as any one of the following: a logical expression tree, a flow chart of logical expression, etc.; after obtaining the logical expression information, the logical expression information corresponding to each accessibility problem can be determined as a detection rule corresponding to each accessibility problem, which effectively ensures the accuracy and reliability of the determination of the detection rules.
[0070] Step S302: Analyze and process the source code file based on the detection rules to obtain the detection result.
[0071] After obtaining the detection rules, the source code files can be analyzed and processed based on the detection rules to obtain detection results for identifying whether there are accessibility issues. Since detection rules have different forms of expression, different processing principles may be used when analyzing and processing source code files using detection rules of different forms of expression. In some instances, when the detection rules are implemented as code representation information, the source code files are analyzed and processed based on the detection rules to obtain the detection results, which may include: obtaining the code representation information corresponding to each accessibility issue included in the detection rules; and processing the source code information included in the source code files using the code representation information to obtain the detection results.
[0072] Among them, when the detection rules implemented by the code representation information are obtained, in order to accurately perform the detection operation of the accessibility problem, the code representation information corresponding to each accessibility problem included in the detection rule can be obtained. Specifically, when a detection rule corresponds to an accessibility problem, the code representation information included in the detection rule is the code representation information corresponding to the accessibility problem; when a detection rule corresponds to multiple accessibility problems, multiple code representation information in the detection rule can be determined, and then the corresponding accessibility problem can be determined based on the keywords in the code representation information, so that the code representation information corresponding to each accessibility problem can also be obtained. At this time, the source code information in the source code file and the detection rules are both information of the code dimension, and then the code representation information can be used to process the source code information included in the source code file, that is, the code representation information and the source code information are analyzed and compared to obtain the detection result.
[0073] Specifically, using the code representation information to process the source code information included in the source code file, obtaining the detection result may include: analyzing and comparing the code representation information with the source code information included in the source code file; when the source code information in the source code file includes a code segment that matches the code representation information, it is determined that there is an accessibility problem in the source code file, and the detection result at this time is implemented as a first detection result for identifying the existence of an accessibility problem. When the source code information in the source code file includes a code segment that matches the code representation information and does not include the code representation information, it is determined that there is no accessibility problem in the source code file, and the detection result at this time is implemented as a second detection result for identifying the absence of an accessibility problem, thereby effectively ensuring the accuracy and reliability of the determination of the detection result.
[0074] In other instances, the detection rules can also be implemented as logical expression information. In this case, the source code file is analyzed and processed based on the detection rules in this embodiment to obtain the detection results, which may include: performing simulated compilation operations on the code based on the source code information in the source code file to obtain simulated compilation results; and analyzing and processing the simulated compilation results using the logical expression information included in the detection rules to obtain detection results.
[0075] Among them, when the acquired detection rules are embodied in the form of logical expression information, in order to accurately perform the detection operation of accessibility problems, the code can be simulated compiled based on the source code information in the source code file to obtain the simulated compilation result. The above-mentioned simulated compilation operation can be realized by processing the source code information in the source code file through a preset application or tool. After obtaining the simulated compilation result, the simulated compilation result can be analyzed and processed using the logical expression information included in the detection rules to obtain the detection result.
[0076] Specifically, the simulation compilation results are analyzed and processed using the logical expression information included in the detection rules, and obtaining the detection results may include: determining the simulation logical expression corresponding to the source code file based on the simulation compilation results; analyzing and comparing the simulation logical expression with the logical expression information in the detection rules, and obtaining a detection result for identifying whether there are accessibility issues in the source code file.
[0077] Further, analyzing and comparing the simulation logic expression with the logic expression information included in the detection rule, obtaining a detection result for identifying whether there is an accessibility problem in the source code file may include: when the simulation logic expression includes simulation logic that matches the logic expression information in the detection rule, it is determined that there is an accessibility problem in the source code file, and the detection result at this time is implemented as a first detection result for identifying the existence of an accessibility problem. When the simulation logic expression does not include simulation logic that matches the logic expression information in the detection rule, it is determined that there is no accessibility problem in the source code file, and the detection result at this time is implemented as a second detection result for identifying the absence of an accessibility problem, thereby effectively ensuring the accuracy and reliability of the determination of the detection result.
[0078] In some other instances, for detection rules and accessibility issues, one accessibility issue may correspond to one detection rule, and different accessibility issues may correspond to different detection rules, that is, the number of detection rules is one or more. When the number of detection rules is multiple, in order to accurately perform detection operations on accessibility issues, the detection priorities corresponding to multiple detection rules may be combined to implement detection operations on accessibility issues. At this time, analyzing and processing the source code file based on the detection rules, and obtaining the detection results may include: obtaining the detection priorities of multiple detection rules; determining the detection order of multiple detection rules based on the detection priorities; and analyzing and processing the source code file according to the detection order and based on the multiple detection rules to obtain the detection results.
[0079] Specifically, when there are multiple detection rules, in order to improve the quality and effect of the detection operation of accessibility issues, the detection priorities of multiple detection rules can be obtained, wherein the detection priorities of multiple detection rules can be determined by the importance and occurrence frequency of the accessibility issues corresponding to each detection rule. Generally, the detection priority of the detection rule may be proportional to the importance and occurrence frequency of the corresponding accessibility issues, that is, the higher the importance of the accessibility issue, the higher the detection priority of the corresponding detection rule; the higher the occurrence frequency of the accessibility issue, the higher the detection priority of the corresponding detection rule.
[0080] After obtaining the detection priorities of multiple detection rules, the detection order of the multiple detection rules can be determined based on the detection priorities, wherein the higher the detection priority, the closer the detection order is to the front of the detection position; when the detection priority is lower, the detection order is closer to the back of the detection position. After obtaining the detection order of multiple detection rules, the source code file can be analyzed and processed according to the above detection order and based on the multiple detection rules to obtain a detection result for identifying whether there is an accessibility problem in the source code file.
[0081] For example, multiple detection rules include: detection rule 1, detection rule 2, detection rule 3 and detection rule 4, and the relationship between the detection priorities of the above detection rules 1, detection rule 2, detection rule 3 and detection rule 4 is: the priority of detection rule 3> the priority of detection rule 2> the priority of detection rule 4> the priority of detection rule 1, and then the detection order of multiple detection rules can be determined based on the relationship between the above detection priorities: detection rule 3-detection rule 2-detection rule 4-detection rule 1, and then the source code file can be analyzed and processed based on the above detection order, that is, the source code file is first analyzed and processed based on detection rule 3 to obtain detection result 1; then the source code file can be analyzed and processed based on detection rule 2 to obtain detection result 2, and then the source code file can be analyzed and processed based on detection rule 4 to obtain detection result 3, and finally the source code file can be analyzed and processed based on detection rule 1 to obtain detection result 4, and then the above multiple detection results can be summarized to obtain the target detection result corresponding to the source code file, thereby accurately realizing the accurate reliability of accessibility detection.
[0082] In this embodiment, by obtaining detection rules for implementing detection operations for accessibility issues, and then analyzing and processing the source code files based on the detection rules, it is effectively possible to implement detection operations for accessibility issues based on the detection rules, and the detection results can be stably obtained, further improving the flexibility and reliability of the detection method.
[0083] Figure 4 A flowchart of another method for detecting accessibility problems provided by an embodiment of the present invention; based on any of the above embodiments, refer to the attached Figure 4 As shown, in order to improve the practicability of the method, after obtaining the test result, the test result can be displayed. At this time, the method in this embodiment can also include:
[0084] Step S401: when the detection result is used to identify that there is at least one accessibility problem in the source code file, determine a problem repair suggestion corresponding to each of the at least one accessibility problem.
[0085] Step S402: Correlate and display the problem repair suggestion corresponding to at least one accessibility problem with the detection result.
[0086] After obtaining the detection results, it can be determined whether there are accessibility issues in the source code file based on the detection results. Specifically, when the detection results are used to identify that there are no accessibility issues in the source code file, compilation operations are allowed on the source code file to obtain a compilation product corresponding to the source code file.
[0087] When the detection result is used to identify at least one accessibility problem in the source code file, in order to improve the quality and effect of the code writing operation, a problem repair suggestion corresponding to at least one accessibility problem can be generated, wherein determining the problem repair suggestion corresponding to at least one accessibility problem can include: when the detection result is used to identify at least one accessibility problem in the source code file, the problem type of the existing accessibility problem can be determined; based on the problem type, the corresponding problem repair suggestion is generated, and accessibility problems of different problem types can correspond to different problem repair suggestions.
[0088] After generating a problem repair suggestion corresponding to at least one accessibility problem, the problem repair suggestion corresponding to at least one accessibility problem can be associated with the detection result and displayed. Specifically, the problem repair suggestion and the detection result can be associated and displayed on a display so that code developers can understand the accessibility problems existing in the code writing process as early as possible, and the displayed problem repair suggestions can help code developers to perform problem repair operations. Specifically, the problem repair operation can be that the code developer manually changes and repairs the source code information in the source code file based on the problem repair suggestion, thereby improving the quality and effect of the problem repair operation.
[0089] In some other instances, in order to further reduce the involvement of developers, problem repair operations can be implemented not only through manual operations, but also automatically based on problem repair suggestions. At this time, after determining the problem repair suggestion corresponding to at least one accessibility problem, the method in this embodiment may further include: determining repair information for performing repair operations on source code information based on the problem repair suggestion corresponding to at least one accessibility problem; performing automatic repair operations on the source code information based on the repair information to obtain repaired source code; and displaying at least one accessibility problem, problem repair suggestion, source code information, and repaired source code in an associated manner.
[0090] Specifically, after determining the problem repair suggestion corresponding to at least one accessibility problem, the problem repair suggestion corresponding to at least one accessibility problem can be analyzed and processed to determine the repair information used to perform a repair operation on the source code information, wherein the repair information can include: the code line that needs to be repaired and the specific method of repair, which can be determined by analyzing and processing the problem repair suggestion through a preset mapping relationship. After determining the repair information used to perform a repair operation on the source code information, the source code information can be automatically repaired based on the repair information to obtain a repaired source code, and the repaired source code will not have the detected accessibility problem relative to the source code information.
[0091] After obtaining the repaired source code, in order to enable code developers to understand the accessibility issues and code repair status in the code writing process in a timely and early manner, at least one accessibility issue, problem repair suggestion, source code information and repaired source code can be displayed in association. Among them, the repaired source code can be displayed in a highlighting manner such as highlighting, preset color, etc., so that code developers can quickly and intuitively view the code segment corresponding to the repair operation.
[0092] Furthermore, after at least one accessibility issue, problem fixing suggestion, source code information and repaired source code are displayed in association, the repaired source code can be reviewed. When the repaired source code passes the review, a code compilation operation based on the repaired source code can be allowed to obtain a compiled product. When the repaired source code fails the review, the repaired source code can be repaired or updated again to obtain a re-repaired source code, and then a code compilation operation can be performed based on the re-repaired source code to obtain a code compilation product.
[0093] In this embodiment, when the detection result is used to identify the presence of at least one accessibility problem in the source code file, the problem repair suggestion corresponding to the at least one accessibility problem is determined, and then the problem repair suggestion corresponding to the at least one accessibility problem is associated with the detection result and displayed. This allows code developers to understand the accessibility problems existing in the code writing process as early as possible, and can help code developers to perform problem repair operations through the displayed problem repair suggestions, further improving the practicality of the method.
[0094] For specific applications, refer to the attached Figure 5 As shown, this application embodiment provides a method for detecting accessibility issues, which is used for automatic detection of issues in the field of accessibility, and can implement the detection of accessibility issues without relying on executable code compilation products. The execution subject of the method can be implemented as a checker, which can be deployed in a code container, or the checker can be communicatively connected to the code container, wherein the checker can be implemented as a code static scanning system or a code static scanning plug-in. When the checker is integrated in the code container, the source code file inspection operation can be implemented through the code container of the checker containing the inspection logic, thereby eliminating the step of inspecting the compilable product after compilation, and can discover accessibility issues at an earlier stage. Specifically, the detection method may include the following steps:
[0095] Step 1: In a code writing scenario, obtain a source code file to be detected, wherein the source code file includes source code information for implementing a preset function.
[0096] Among them, when the code developer is writing code through the code container, he can actively or passively trigger the detection operation of accessibility issues for the source code information used to implement the function. Specifically, when the code developer believes that the writing operation of the source code information for the preset function has been completed, the code developer can actively trigger the detection operation of accessibility issues through the trigger control deployed in the code container for the detection operation of accessibility issues; when the code container detects that the source code writing operation for the preset function has been completed, the checker or code container can actively trigger the detection operation of accessibility issues for the source code information used to implement the preset function.
[0097] When it is necessary to detect accessibility issues on source code information, a full scan or incremental scan operation can be performed on the code container to obtain the source code file to be detected. At this time, the source code file can be stored in the code container. In order to enable the checker to perform accessibility issues detection operations on the source code file, the checker can obtain the source code file to be detected through the code container.
[0098] It should be noted that the source code information included in the above-mentioned source code file is the source code information directly written by the code developer during the code writing process, which is different from the code information obtained by reverse engineering the code compilation product. Since the code information obtained by the reverse engineering operation is closely related to the reasoning accuracy of the reverse engineering tool, different reverse engineering tools can obtain different versions of code information when analyzing and processing the same code compilation product. That is, for one code compilation product, it corresponds to one source code information, and after analyzing and identifying the code compilation product through different reverse engineering tools, multiple different versions of code information can be obtained. Obviously, the code information obtained by analyzing and processing the code compilation product is completely different from the source code information.
[0099] Step 2: The inspector can obtain detection rules for implementing detection operations for accessibility issues.
[0100] The detection rules may be implemented as any one of the following: code representation information corresponding to each accessibility issue, logic expression information corresponding to each accessibility issue, etc. In addition, the number of detection rules may be one or more. When the number of detection rules is multiple, the multiple detection rules may correspond to different priorities. In addition, in different application scenarios, the detection rules used to implement the detection operation of accessibility issues are different, so that the detection operation of accessibility issues can be implemented based on different detection rules in different application scenarios.
[0101] Step 3: Perform accessibility detection on the source code file based on the detection rules to obtain the detection results.
[0102] Among them, when there are multiple detection rules, the multiple detection rules can correspond to different priorities, and then the execution order of the multiple detection rules can be determined based on the priorities of the multiple detection rules, and then the source code files can be tested for accessibility issues based on the detection rules in turn based on the execution order to obtain the detection results.
[0103] Step 4: When the detection result indicates that there is an accessibility issue in the source code file, a repair suggestion matching the accessibility issue is generated.
[0104] For example, when the accessibility problem is implemented as "the voice broadcast function needs to be deployed at the preset points in the display interface", when the detection result indicates that the above accessibility problem exists in the source code file, it means that the voice broadcast function is not deployed at the preset points in the display interface corresponding to the source code file. At this time, a repair suggestion matching the accessibility problem can be generated based on the above detection result. The repair suggestion can be implemented as follows: through the source code information in the source code file, determine the code points where human-computer interaction operations can be performed, and a readable identifier for implementing the voice broadcast function needs to be added to the above code points.
[0105] Step 5: The detection results and repair suggestions are displayed in association to assist code developers in repairing the problem.
[0106] Step 6: When the detection result indicates that there is no accessibility issue in the source code file, code compilation operation is allowed for the source code file to generate a code compilation product.
[0107] After generating the code compilation product, in order to improve the stability and reliability of the operation of the code compilation product, the code compilation product can be again detected for accessibility issues. At this time, the specific implementation method and implementation principle of the accessibility issue detection operation on the code compilation product are similar to the above-mentioned implementation method of the accessibility issue detection operation on the source code file based on the detection rules. Please refer to the above statements for details, which will not be repeated here.
[0108] The technical solution provided by the present application embodiment can trigger the detection process of accessibility problems in real time or at a fixed time during the process of code writing by developers, and then the checker can traverse and check the source code files according to the detection rules to obtain the detection results. When the detection results indicate that there are accessibility problems in the code files, the repair suggestions can be matched based on the problem type (or error type) of the existing accessibility problems. Specifically, the code problem location in the source code information can be prompted to the developer, and the repair solution suggestion code can be provided in a targeted manner to reduce the developer's repair cost; then, the detection results and repair suggestions can be displayed in association in the code container to inform the developer of the corresponding problem situation and allow the developer to repair the problem more efficiently, or the code container can automatically repair the problem based on the repair suggestion, which can not only help the developer to discover accessibility adaptation problems as early as possible in the development stage and reduce the overall discovery and repair costs of accessibility problems, but also, because the above process is based on the source code and does not rely on the generation of compiled products, it has the characteristics of fast and safe detection, further ensuring the practicality of the method.
[0109] Figure 6 A schematic diagram of a detection device for accessibility problems provided by an embodiment of the present invention; see attached Figure 6 As shown, this embodiment provides a device for detecting accessibility problems, which can perform the above Figure 2 The accessibility problem detection method shown in the figure, specifically, the accessibility problem detection device includes:
[0110] A first acquisition module 11 is used to acquire a source code file to be detected in a code writing scenario, wherein the source code file includes source code information for realizing a preset function;
[0111] The first processing module 12 is used to perform an accessibility problem detection operation based on the source code file to obtain a detection result.
[0112] In some instances, when the first processing module 12 performs an accessibility problem detection operation based on a source code file and obtains a detection result, the first processing module 12 is used to execute: obtaining detection rules for implementing the accessibility problem detection operation; analyzing and processing the source code file based on the detection rules to obtain a detection result.
[0113] In some instances, when the first processing module 12 obtains detection rules for implementing detection operations for accessibility issues, the first processing module 12 is used to execute: obtaining the problem type corresponding to each of the at least one accessibility issues to be detected; based on the problem type, generating code representation information corresponding to each accessibility issue; and determining the code representation information corresponding to each accessibility issue as a detection rule, where different accessibility issues correspond to different detection rules.
[0114] In some instances, when the first processing module 12 analyzes and processes the source code file based on the detection rules to obtain the detection results, the first processing module 12 is used to execute: obtaining the code representation information corresponding to each accessibility problem included in the detection rules; and processing the source code information included in the source code file using the code representation information to obtain the detection results.
[0115] In some instances, when the first processing module 12 obtains detection rules for implementing detection operations for accessibility issues, the first processing module 12 is used to execute: determining logical expression information corresponding to each accessibility issue based on a problem type corresponding to at least one accessibility issue; and determining the logical expression information corresponding to each accessibility issue as a detection rule corresponding to each accessibility issue.
[0116] In some instances, when the first processing module 12 analyzes and processes the source code file based on the detection rules to obtain the detection results, the first processing module 12 is used to execute: performing a simulated compilation operation of the code based on the source code information in the source code file to obtain the simulated compilation result; and analyzing and processing the simulated compilation result using the logical expression information included in the detection rules to obtain the detection result.
[0117] In some instances, after obtaining the detection results, the first processing module 12 in this embodiment is also used to: when the detection results are used to identify the presence of at least one accessibility problem in the source code file, determine the problem repair suggestion corresponding to at least one accessibility problem; and associate the problem repair suggestion corresponding to at least one accessibility problem with the detection results and display them.
[0118] In some instances, after determining the problem repair suggestion corresponding to at least one accessibility problem, the first processing module 12 in this embodiment is also used to: determine repair information for performing repair operations on source code information based on the problem repair suggestion corresponding to at least one accessibility problem; automatically perform repair operations on the source code information based on the repair information to obtain repaired source code; and display at least one accessibility problem, problem repair suggestion, source code information, and repaired source code in an associated manner.
[0119] In some instances, when there are multiple detection rules; when the first processing module 12 analyzes and processes the source code file based on the detection rules to obtain the detection results, the first processing module 12 is used to execute: obtaining the detection priorities of the multiple detection rules; based on the detection priorities, determining the detection order of the multiple detection rules; analyzing and processing the source code file according to the detection order and based on the multiple detection rules to obtain the detection results.
[0120] Figure 6 The device shown can perform Figure 1-Figure 5 For the method of the embodiment shown in the figure, the part not described in detail in this embodiment can be referred to Figure 1-Figure 5 The implementation process and technical effects of this technical solution refer to Figure 1-Figure 5 The description in the illustrated embodiment will not be repeated here.
[0121] In one possible design, Figure 6 The structure of the accessibility problem detection device shown can be implemented as an electronic device, which can be a controller, a personal computer, a server, or other devices. Figure 7 As shown, the electronic device may include: a first processor 21 and a first memory 22. The first memory 22 is used to store the corresponding electronic device to execute the above Figure 1-Figure 5 The program of the accessibility problem detection method provided in the illustrated embodiment, the first processor 21 is configured to execute the program stored in the first memory 22.
[0122] The program includes one or more computer instructions, wherein the one or more computer instructions, when executed by the first processor 21, can implement the following steps: in a code writing scenario, obtain a source code file to be detected, wherein the source code file includes source code information for implementing preset functions; perform accessibility problem detection operations based on the source code file to obtain detection results.
[0123] Furthermore, the first processor 21 is also used to execute the aforementioned Figure 1-Figure 5 All or part of the steps in the illustrated embodiments.
[0124] The structure of the electronic device may further include a first communication interface 23 for the electronic device to communicate with other devices or a communication network.
[0125] In addition, an embodiment of the present invention provides a computer storage medium for storing computer software instructions used by electronic devices, which includes instructions for executing the above Figure 1-Figure 5 The procedures involved in the method for detecting accessibility issues in the illustrated embodiment.
[0126] In addition, an embodiment of the present invention provides a computer program product, including: a computer-readable storage medium storing computer instructions, when the computer instructions are executed by one or more processors, causing the one or more processors to execute the above Figure 1-Figure 5 The steps in the method for detecting accessibility issues in the method embodiment are shown.
[0127] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, i.e., they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Those of ordinary skill in the art may understand and implement it without creative effort.
[0128] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by adding a necessary general hardware platform, and of course can also be implemented by combining hardware and software. Based on such an understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a computer product, and the present invention can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.
[0129] The present invention is described with reference to flowcharts and / or block diagrams of methods, devices (systems), and computer program products according to embodiments of the present invention. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable device to produce a machine, so that the instructions executed by the processor of the computer or other programmable device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.
[0130] These computer program instructions may also be stored in a computer-readable memory that can direct a computer or other programmable device to work in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture including an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1These computer program instructions can also be loaded onto a computer or other programmable device so that a series of operation steps are executed on the computer or other programmable device to produce a computer-implemented process, so that the instructions executed on the computer or other programmable device provide the functions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps of the functions specified in the blocks or multiple blocks. In a typical configuration, the computing device includes one or more processors (CPU), input / output interfaces, network interfaces, and memory. The memory may include non-permanent memory in a computer-readable medium, random access memory (RAM) and / or non-volatile memory in the form of read-only memory (ROM) or flash RAM. The memory is an example of a computer-readable medium.
[0131] Computer readable media include permanent and non-permanent, removable and non-removable media that can be implemented by any method or technology to store information. Information can be computer readable instructions, data structures, program modules or other data. Examples of computer storage media include, but are not limited to, phase change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technology, compact disk read-only memory (CD-ROM), digital versatile disk (DVD) or other optical storage, magnetic cassettes, magnetic tape magnetic disk storage or other magnetic storage devices or any other non-transmission media that can be used to store information that can be accessed by a computing device. As defined herein, computer readable media does not include temporary computer readable media (transitory media), such as modulated data signals and carrier waves.
[0132] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for detecting accessibility issues, characterized in that: include: In a code writing scenario, a source code file to be detected is obtained, wherein the source code file includes source code information for realizing a preset function; An accessibility problem detection operation is performed based on the source code file to obtain a detection result.
2. The method according to claim 1, characterized in that Performing an accessibility problem detection operation based on the source code file to obtain a detection result includes: Get the detection rules used to implement the detection operation of accessibility issues; The source code file is analyzed and processed based on the detection rule to obtain a detection result.
3. The method according to claim 2, characterized in that Get the detection rules used to implement accessibility detection operations, including: Obtain the problem type corresponding to at least one accessibility problem to be detected; Based on the problem type, generate code representation information corresponding to each accessibility problem; The code representation information corresponding to each accessibility problem is determined as the detection rule, and different accessibility problems correspond to different detection rules.
4. The method according to claim 3, characterized in that: Analyzing and processing the source code file based on the detection rule to obtain a detection result includes: Obtaining code representation information corresponding to each accessibility issue included in the detection rule; The source code information included in the source code file is processed using the code representation information to obtain the detection result.
5. The method according to claim 2, characterized in that: Get the detection rules used to implement accessibility detection operations, including: Determine logical expression information corresponding to each accessibility question based on the question type corresponding to each accessibility question; The logical expression information corresponding to each accessibility issue is determined as a detection rule corresponding to each accessibility issue.
6. The method according to claim 5, characterized in that Analyzing and processing the source code file based on the detection rule to obtain a detection result includes: Performing a simulated compilation operation of the code based on the source code information in the source code file to obtain a simulated compilation result; The simulation compilation result is analyzed and processed using the logic expression information included in the detection rule to obtain the detection result.
7. The method according to any one of claims 1 to 6, characterized in that: After obtaining the test result, the method further includes: When the detection result is used to identify that at least one accessibility issue exists in the source code file, determining a problem repair suggestion corresponding to each of the at least one accessibility issue; A problem repair suggestion corresponding to each of the at least one accessibility problem is displayed in association with the detection result.
8. The method according to claim 7, characterized in that After determining a problem repair suggestion corresponding to each of the at least one accessibility problem, the method further includes: Determining repair information for performing a repair operation on the source code information based on the problem repair suggestion corresponding to each of the at least one accessibility issues; Performing an automatic repair operation on the source code information based on the repair information to obtain a repaired source code; The at least one accessibility issue, the problem repair suggestion, the source code information, and the repaired source code are displayed in association.
9. The method according to any one of claims 2 to 6, characterized in that: When there are multiple detection rules, analyzing and processing the source code file based on the detection rules to obtain a detection result includes: Get the detection priority of multiple detection rules; Based on the detection priority, determining a detection order of multiple detection rules; The source code file is analyzed and processed according to the detection order and based on multiple detection rules to obtain the detection result.
10. A device for detecting accessibility problems, characterized in that: include: A first acquisition module is used to acquire a source code file to be detected in a code writing scenario, wherein the source code file includes source code information for realizing a preset function; The first processing module is used to perform an accessibility problem detection operation based on the source code file to obtain a detection result.
11. An electronic device, characterized in that: include: A memory and a processor; wherein the memory is used to store one or more computer instructions, wherein the one or more computer instructions, when executed by the processor, implement the method of any one of claims 1 to 9.
12. A computer storage medium, characterized in that: Used to store a computer program, which enables a computer to implement the method according to any one of claims 1 to 9 when executed by the computer.
13. A computer program product, characterized in that include: A computer program, when executed by a processor of an electronic device, causes the processor to execute the steps of any one of the methods of claims 1 to 9.
Citation Information
Patent Citations
A code inspection method and device, a storage medium and a processor
CN107168872A
Code detection method, system and device
CN109857630A
Code similarity detection method and device, equipment and storage medium
CN116909911A