WO2016032234A1 - Source code analysis device, computer program for same, and recording medium thereof - Google Patents

Source code analysis device, computer program for same, and recording medium thereof Download PDF

Info

Publication number
WO2016032234A1
WO2016032234A1 PCT/KR2015/008937 KR2015008937W WO2016032234A1 WO 2016032234 A1 WO2016032234 A1 WO 2016032234A1 KR 2015008937 W KR2015008937 W KR 2015008937W WO 2016032234 A1 WO2016032234 A1 WO 2016032234A1
Authority
WO
WIPO (PCT)
Prior art keywords
information
analysis
source code
defect
function
Prior art date
Application number
PCT/KR2015/008937
Other languages
French (fr)
Korean (ko)
Inventor
함형길
정영범
Original Assignee
주식회사 파수닷컴
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
Priority claimed from KR1020140133347A external-priority patent/KR101623174B1/en
Application filed by 주식회사 파수닷컴 filed Critical 주식회사 파수닷컴
Priority to CN201580046317.1A priority Critical patent/CN106796543A/en
Priority to JP2017510645A priority patent/JP6579340B2/en
Priority to US15/505,669 priority patent/US10496516B2/en
Publication of WO2016032234A1 publication Critical patent/WO2016032234A1/en

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/44Arrangements for executing specific programs
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F11/00Error detection; Error correction; Monitoring
    • G06F11/36Preventing errors by testing or debugging software

Definitions

  • the present invention relates to a source code analysis apparatus, a computer program therefor, and a recording medium thereof, the source code configured to suggest a defect correction when a defect is found in the analysis target source code analyzed according to a predefined analysis rule.
  • Static code analysis is one of several ways of analyzing computer software. The feature of this method is that it does not run the software directly, but analyzes the source code of the software under development.
  • Static Analysis Tool is a program developed to automatically perform static program analysis using software rather than human hands. In general, the size of the source code is huge, and it is almost impossible to perform static program analysis by hand. Therefore, it is the role of static analysis tools to automate and perform these analyzes. Static analysis tools can detect various kinds of defects or vulnerabilities in the source code according to the type, and inform the user of the detected defects through analysis.
  • Source code analysis apparatus in the form of a static analysis tool as described above has been variously proposed.
  • the existing proposed or used source code analysis apparatus provides only a limited function of defect detection and detection message generation, so that the correction of the detected defect must depend on the personal knowledge and experience of the user (programmer). There was.
  • the present invention has been made in view of the above-mentioned problems, and is a source code analysis device configured to suggest a defect correction when a defect is found in an analysis target source code analyzed according to a predefined analysis rule, and a computer for the same. Its purpose is to provide a program and its recording medium.
  • a defect detection unit for detecting at least one defect information, a correction example generation unit for generating at least one of correction example information and notice information based on defect information detected by the defect detection unit and information necessary for analysis refined by the syntax analysis unit;
  • a source code analysis module including an analysis result delivery unit configured to configure at least one or more of the defect information, correction example information, and notice information to be analyzed result output module; And extracting and outputting defect information from the comprehensive analysis result information received from the source code analysis module, and extracting at least one of correction example information and notice information from the comprehensive analysis result information received from the source code analysis module.
  • a source code analysis apparatus comprising a; analysis result output module including a modified example output unit to output.
  • the modification example generation unit characterized in that configured to generate one or more correction example information or notice information for one defect information.
  • the detection of defect information of the defect detection unit is performed by executing a function of each checker provided to check whether each defect is present, wherein each checker is an example of correction to be generated for the defect information detected at the time of detecting the defect information. Characterized in that it is configured to deliver the comprehensive analysis result information including at least one of the information and notice information to the modification example generation unit.
  • the modification example information includes at least one of 'addition' of another code line, 'change' to another code line, and 'delete' of the detected code line with respect to the source code line from which defect information is detected. Characterized in that.
  • the modified example code included in the modified example information is generated by using a result of analyzing and inferring the source code according to a preset template by the checker that detects the defect information as an input value.
  • the analysis result output function may include a defect output function for extracting and outputting defect information from the comprehensive analysis result information received from the source code analysis function, and correction example information and notice information from the comprehensive analysis result information received from the source code analysis function.
  • a computer program for recording a source code analysis function and an analysis result output function is recorded in a source code analysis apparatus, wherein the source code analysis function is required for analysis from source code.
  • the analysis result output function may include a defect output function for extracting and outputting defect information from the comprehensive analysis result information received from the source code analysis function, and correction example information and notice information from the comprehensive analysis result information received from the source code analysis function.
  • the present invention is configured to suggest a defect correction when a defect is found in the analysis target source code analyzed according to a predefined analysis rule, so that the user (programmer) at the time of correcting the defect for the source code More objective and improved defect correction is possible without relying on personal knowledge and experience.
  • FIG. 1 is a block diagram of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 2 is a configuration example of analysis result information of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 3 is an example of a source code page screen in which a defect is found by a checker of a defect detector of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 4 is an example of a comprehensive analysis result output screen after clicking a modification example button of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 5 is an example menu display example of a comprehensive analysis result output screen after clicking a modification example button of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 6 shows an example of displaying defect information in a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 7 is an example of displaying modified example information in a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 8 is an example of displaying notice information of a comprehensive analysis result output screen after clicking a modification example button of a source code analysis apparatus according to an embodiment of the present invention
  • FIG. 10 is an example of a code generation class among checker implementation classes for a source code analysis apparatus according to an embodiment of the present invention.
  • first and second may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from another.
  • the first component may be referred to as the second component, and similarly, the second component may also be referred to as the first component.
  • FIG. 1 is a block diagram of a source code analysis device according to an embodiment of the present invention
  • Figure 2 is an example configuration of the analysis result information of the source code analysis device according to an embodiment of the present invention.
  • the source code analysis device A of the present embodiment includes a source code input module 100, a source code analysis module 200, an analysis result output module 300, and a control module 400.
  • the computer program for implementing the analysis device may be implemented in a form that runs on conventional computer hardware.
  • the source code input module 100 receives, for example, an analysis target source code in the form of a code file so that the source code analysis module 200 described later may perform an analysis process.
  • the input of the code file may be made by a file input or an open operation of the user.
  • the source code analysis module 200 includes a comprehensive analysis including defect information 220A, correction example information 230A, and various kinds of notice information 230B that may occur when correcting from a source code input and received for analysis. Generate result 240A.
  • the analysis result output module 300 shows defect information 220A, correction example information 230A, and notice information 230B to the user based on the comprehensive analysis result 240A received from the source code analysis module 200.
  • the source code analysis module 200 and the analysis result output module 300 may be integrated into one module.
  • the source code analysis module 200 includes a syntax analyzer 210, a defect detector 220, a modified example generator 230, and an analysis result transmitter 240.
  • the parser 210 performs a role of extracting and purifying various information required for analysis from the input source code.
  • the information necessary for the analysis may be, for example, an abstract syntax tree, the number of lines of source code, location information, or the like.
  • the defect detector 220 detects defect information 220A, which may be a problem in the source code, based on the information necessary for the analysis refined by the parser 210. Detection of the defect information 220A of the defect detector 220 may be performed by, for example, executing a checker function to check whether there is a defect.
  • the defect information 220A includes, for example, the actual defect such as the file name of the source code where the defect actually occurred, the location information such as a line and the type of the defect, the part causing the actual defect, and the flow of the source code where the defect occurred. Information and the like.
  • the syntax analysis function of the parser 210 and the defect information detection function of the defect detector 220 may be configured to have the same or similar configuration as the syntax analysis function and the defect information detection function of various known static analysis tools. It can be implemented through. Since the static analysis tool has been known a variety of commercial products of the syntactic analysis (Syntactic analysis) or semantic analysis (Semantic analysis method), its detailed description is omitted.
  • Detecting defect information 220A of the defect detection unit 220 is performed by the execution of the function of each checker provided to check whether each defect is present, and each checker detects the defect information detected at the time of detecting the defect information 220A.
  • the comprehensive analysis result information 240A including the modified example information 230A and the notice information 230B to be generated for the 220A is transmitted to the modified example generator 230.
  • the comprehensive analysis result information 240A may be configured, for example, in the form of a modified example XML file, but is not necessarily limited thereto.
  • modified example information 230A and notice information 230B may be transmitted according to the structure of the analyzed source code.
  • the correction example information 230A and the notice information 230B does not need to be provided, or provide only the correction example information 230A or note. It may be configured to provide only the item information 230B.
  • a plurality of modification example information 230A and notice information 230B may be generated as a plurality of alternatives for one defect information 220A, which will be described later. In the description of this embodiment, an example in which the modified example information 230A and the notice information 230B are provided together is described.
  • the modified example generation unit 230 is based on the defect information 220A detected by the defect detector 220 and the information necessary for the analysis refined by the parser 210, the modified example information 230A and the notice information 230B. Produces
  • the modification example information 230A refers to a modification example code that can inform how to correct a defect occurring in the defect information 220A with the actual source code. For example, if the source code is modified based on the information provided in the modification example information 230A, a defect does not occur.
  • the modified example information 230A may include at least one of 'addition' of another code line, 'change' to another code line, and 'delete' of the detected code line with respect to the source code line where the defect information 220A is detected. It may include one.
  • the notice information 230B refers to various notice information that may occur while the user modifies the source code. For example, information helpful when a user modifies the source code, incidental problems that may occur while modifying the code as described in the modification example information 230A, or automatically in the source code analysis apparatus A. Because it cannot be created, it may be something that a user needs to modify.
  • the analysis result transmitting unit 240 configures the previously generated defect information 220A, correction example information 230A, and notice information 230B as comprehensive analysis result information 240A and delivers the result to the analysis result output module 300. do.
  • the comprehensive analysis result information 240A may be data in a file or a memory, and other information may be included.
  • the correction example information 230A or the notice information 230B may not be present or more in one defect information 220A according to the type of the defect.
  • the analysis result output module 300 includes a defect output unit 310 and a correction example output unit 320.
  • the defect output unit 310 extracts the defect information 220A from the comprehensive analysis result information 240A received from the source code analysis module 200 and shows it to the user.
  • information may be a file name of a source code, location information such as a line, a kind of a defect or a part that causes a real defect, a flow of source code in which a defect occurs, and the like.
  • the modified example output unit 320 extracts the modified example information 230A and the notice information 230B from the comprehensive analysis result information 240A received from the source code analysis module 200 and shows it to the user.
  • the information may be modified examples of how to correct the actual source code and various notice information that may occur while modifying the source code.
  • the defect output unit 310 and the modified example output unit 320 may simultaneously output or additionally output other information.
  • FIG. 3 is an example of a source code page screen in which a defect is found by a checker of a defect detection unit of a source code analysis apparatus according to an exemplary embodiment of the present invention.
  • a corrective action button is displayed on the upper right of the screen.
  • FIG. 4 is an example of a comprehensive analysis result output screen after clicking on a modified example button of a source code analysis apparatus according to an embodiment of the present invention.
  • Defect information, correction example information and notice information are displayed on the screen, respectively.
  • the modified example information or the notice information may be provided with one or more for one defect information.
  • FIG. 5 is an example of displaying an example menu of a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an embodiment of the present invention.
  • example menus may vary depending on the type of checkers and the source code. Each example menu can be folded or unfolded by pressing the triangle mark on the left end.
  • FIG. 6 is an example of displaying defect information in a comprehensive analysis result output screen after a button of a modification example button of a source code analysis apparatus according to an exemplary embodiment of the present invention.
  • the fault information menu tells the checker how to fix the faults detected.
  • FIG. 7 illustrates an example of displaying modified example information on a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an exemplary embodiment of the present invention.
  • the example menu tells you how to modify what part of the source code.
  • the example code is provided as identical as possible to the actual code. Lines starting with '-' that are gradated in red on the screen indicate the code to be deleted, and lines starting with '+' that are graded in green correspond to the code to be added. If you have a lot of lines of code that need to be modified or are different files, you may see multiple boxes.
  • FIG. 8 is an example of displaying notice information in a comprehensive analysis result output screen after clicking a modification example button of the apparatus for analyzing a source code according to an embodiment of the present invention.
  • the following source code is an example of a modification example XML file of a source code analysis apparatus according to an embodiment of the present invention
  • Table 1 is a table showing an example of the main tag or variable definition of the modification example XML file of the following source code.
  • the modified example XML file of the present embodiment can be understood as an example.
  • strncpy (dst, src, 10);
  • 'sca' or 'Sca' is an abbreviation of 'Smart Code Alternative', and is conveniently named as an exemplary name of an upper element including a plurality of alternatives included in the modified XML file of this embodiment.
  • Figure 10 is a code generation of the checker implementation class for a source code analysis apparatus according to an embodiment of the present invention Example of a class.
  • the 'AlarmXMLMaker' class at the top outputs the Sca instance when the alarm is output.
  • the intermediate 'Sca' class is responsible for creating a ScaAlternative instance, and uses this function to generate alternatives in Checker.
  • the bottom 'ScaAlternative' class contains description, code, and notice information.Addition / change / deletion information of the code can be obtained from the code information generated by the 'CodeGenerator' class or from the original source code. It may be received.
  • the 'CodeGenerator' classes (code generation classes) generate modified example codes based on a result of analyzing and inferring original source code according to a predetermined template.
  • the 'CodeGenerator' class includes 'SimpleCodeGenerator' for adding lines, 'TypeCodeGenerator' for type generation, 'VariableCodeGenerator' for variable creation, and 'FunctionCodeGenerator' for function creation.
  • Table 2 is an example of a checker configuration for a source code analysis apparatus according to an embodiment of the present invention
  • Table 3 is another example of a checker configuration for a source code analysis apparatus according to an embodiment of the present invention
  • Table 4 Table showing another example of the checker configuration for the source code analysis apparatus according to an embodiment of the present invention.
  • Example 1 checkers DO_NOT_USE_ADJACENT_BINARY_OPERATOR Source code [1] strncpy (dst, src, sizeof (dst) -1); Alternative 1 Explanation -Add spaces between operators. Alternative type REPLACE Alternative code [1] strncpy (dst, src, sizeof (dst)-1); Notice none
  • this is a checker that checks that binary operators (except the dot (.)) Operator and the before and after operands must be separated by spaces.
  • Alternate code modification example code
  • Source code [1] void func (char dst [], char src []) [2] ⁇ [3] strncpy (dst, src, sizeof (dst) -1); [4] ⁇ Alternative 1 Explanation Change the function interface, using the third argument of strncpy as the value passed in.
  • Example 2 the checker says that sizeof should not be used for variables of array types received as array type parameters.
  • the alternative code occurs on lines 1 and 3, and the change of line 1 causes the change of function interface. If the function interface changes, the declaration or use of this function must also be modified.
  • the strncpy on line 3 causes the length variable to be added in alternative code 1 with the start clause of the third argument. There is no special note in this regard.
  • this is a checker that checks for ineffective function calls. For example, if the value of the third argument in memset is 0, it will be practically meaningless code.
  • Alternative 1 displays the size of the buffer to be initialized if it can be inferred, and if it cannot be inferred, using a specified identifier such as ⁇ length >> or the like.
  • Alternative 2 is a conditional alternative. If the second argument of memset is not a single constant, the second and third arguments may be used interchangeably. Therefore, alternative 2 suggests swapping the second and third parameter values of memset.
  • the checker also has no special note.
  • each checker illustrated in Tables 2 to 4 may be provided by the 'CodeGenerator' class (code generation class) illustrated through FIG. 10.
  • the 'Sca' class, the 'ScaAlternative' class (alternative information class), and the 'CodeGenerator' class (code generation class) can be preset according to the defect content of each checker.
  • Embodiments of the present invention include a program for performing various computer-implemented operations and a computer readable medium recording the same.
  • the computer readable medium may include program instructions, data files, data structures, etc. alone or in combination.
  • the media may be those specially designed and constructed for the purposes of the present invention, or they may be of the kind well-known and available to those having skill in the computer software arts.
  • Examples of computer readable recording media include magnetic media such as hard disks, floppy disks and magnetic tape, optical recording media such as CD-ROM, DVD, USB drives, magnetic-optical media such as floppy disks, and ROM, RAM, Hardware devices specifically configured to store and execute program instructions, such as flash memory, are included.
  • the medium may be a transmission medium such as an optical or metal wire, a waveguide, or the like including a carrier wave for transmitting a signal specifying a program command, a data structure, or the like.
  • program instructions include not only machine code generated by a compiler, but also high-level language code that can be executed by a computer using an interpreter or the like.
  • the source code analysis apparatus of the present invention may be implemented in a form in which a functional operation of a computer is executed by a computer program for executing a source code analysis function and an analysis result output function.
  • the source code analysis function is provided by the above-described source code analysis module, and the analysis result output function is provided by the above-described analysis result output module.
  • the source code analysis function further executes the detailed function of the source code analysis module, and the analysis result output function further executes the detailed function of the analysis result output module, whereby the entire function of the source code analysis device of the present invention can be provided.

Landscapes

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

Abstract

The present invention relates to a source code analysis device, a computer program for the same, and a recording medium thereof. According to one aspect of the present invention, disclosed is a source code analysis device comprising: a source code analysis module comprising a syntax analysis unit for extracting, from a source code information required for the analysis thereof, and refining the same, a defect detection unit for detecting defect information, which can be a problem in the source code, on the basis of the pieces of information, which are required for analysis and refined by the syntax analysis unit, a correction example generation unit for generating correction example information and/or matters of interest information on the basis of the defect information detected by the defect detection unit and the pieces of information, which are required for analysis and refined by the syntax analysis unit, and an analysis result transmission unit for constructing synthesized analysis result information including at least one of the generated defect information, correction example information and matters of interest information so as to transmit the constructed synthesized analysis result information to an analysis result output module; and the analysis result output module comprising a defect output unit for extracting the defect information from the synthesized analysis result information, received from the source code analysis module, so as to output the same, and a correction example output unit for extracting the correction example information and/or the matters of interest information from the synthesized analysis result information, received from the source code analysis module, so as to output the same.

Description

소스 코드 분석 장치, 이를 위한 컴퓨터 프로그램, 그 기록매체Source code analysis device, computer program therefor, recording medium thereof
본 발명은 소스 코드 분석 장치, 이를 위한 컴퓨터 프로그램, 그 기록매체에 관한 것으로서, 미리 정의된 분석룰에 따라 분석한 분석 대상 소스 코드에 결함이 발견된 경우에 결함 수정안을 제안할 수 있도록 구성된 소스 코드 분석 장치, 이를 위한 컴퓨터 프로그램, 그 기록매체에 관한 것이다.The present invention relates to a source code analysis apparatus, a computer program therefor, and a recording medium thereof, the source code configured to suggest a defect correction when a defect is found in the analysis target source code analyzed according to a predefined analysis rule. An analysis device, a computer program for the same, and a recording medium thereof.
정적 프로그램 분석(Static Code Analysis)은 컴퓨터 소프트웨어를 분석하는 여러 가지 방법 중 하나이다. 이 방법의 특징은 소프트웨어를 직접 실행하지 않고 개발중인 소프트웨어의 소스 코드를 대상으로 분석을 수행한다는 점이다. Static code analysis is one of several ways of analyzing computer software. The feature of this method is that it does not run the software directly, but analyzes the source code of the software under development.
정적 분석 도구(Static Analysis Tool)는 정적 프로그램 분석을 사람의 손이 아닌 소프트웨어를 이용하여 자동적으로 수행하도록 개발된 프로그램이다. 일반적으로 소스 코드의 크기는 매우 방대하며, 사람의 손으로 일일이 정적 프로그램 분석을 수행하는 것은 거의 불가능하다고 볼 수 있다. 따라서 이러한 분석을 자동화하여 수행할 수 있도록 해주는 것이 정적 분석 도구의 역할이라고 할 수 있다. 정적 분석 도구는 종류에 따라 소스 코드에서 다양한 종류의 결함이나 취약점을 검출할 수 있으며, 분석을 통해 검출된 결함을 사용자에게 알려준다. Static Analysis Tool is a program developed to automatically perform static program analysis using software rather than human hands. In general, the size of the source code is huge, and it is almost impossible to perform static program analysis by hand. Therefore, it is the role of static analysis tools to automate and perform these analyzes. Static analysis tools can detect various kinds of defects or vulnerabilities in the source code according to the type, and inform the user of the detected defects through analysis.
상기와 같은 정적 분석 도구 형태의 소스 코드 분석 장치가 기존에 다양하게 제안된 바 있다. Source code analysis apparatus in the form of a static analysis tool as described above has been variously proposed.
그러나, 기존에 제안 또는 사용되어온 소스 코드 분석 장치는 결함 검출 및 그에 대한 검출 메시지 생성이라는 제한된 기능만을 제공하여, 검출된 결함에 대한 수정 작업은 사용자(프로그래머)의 개인적인 지식과 경험에 의존해야 한다는 한계가 있었다.However, the existing proposed or used source code analysis apparatus provides only a limited function of defect detection and detection message generation, so that the correction of the detected defect must depend on the personal knowledge and experience of the user (programmer). There was.
본 발명은 상기와 같은 문제점을 감안하여 안출한 것으로서, 미리 정의된 분석룰에 따라 분석한 분석 대상 소스 코드에 결함이 발견된 경우에 결함 수정안을 제안할 수 있도록 구성된 소스 코드 분석 장치, 이를 위한 컴퓨터 프로그램, 그 기록매체를 제공하는 것을 그 목적으로 한다.SUMMARY OF THE INVENTION The present invention has been made in view of the above-mentioned problems, and is a source code analysis device configured to suggest a defect correction when a defect is found in an analysis target source code analyzed according to a predefined analysis rule, and a computer for the same. Its purpose is to provide a program and its recording medium.
상기 목적을 달성하기 위한 본 발명의 일측면에 따르면, 소스 코드로부터 분석에 필요한 정보들을 추출하고 정제하는 구문 분석부와, 구문 분석부에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보를 검출하는 결함 검출부와, 결함 검출부에서 검출된 결함 정보 및 구문 분석부에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보 및 유의사항 정보 중 적어도 하나를 생성하는 수정예시 생성부와, 생성된 결함 정보 및 수정예시 정보, 유의사항 정보 중 적어도 하나 이상을 종합 분석 결과 정보로 구성하여 분석 결과 출력 모듈로 전달하는 분석결과 전달부를 포함하는 소스 코드 분석 모듈; 및 소스 코드 분석 모듈로부터 전달받은 종합 분석 결과 정보에서 결함 정보를 추출하여 출력하는 결함 출력부와, 소스 코드 분석 모듈로부터 전달받은 종합 분석 결과 정보에서 수정예시 정보 및 유의사항 정보 중 적어도 하나를 추출하여 출력하는 수정예시 출력부를 포함하는 분석 결과 출력 모듈;을 포함하여 구성된 소스 코드 분석 장치가 개시된다. According to an aspect of the present invention for achieving the above object, it may be a problem in the source code based on the parser for extracting and purifying the information required for analysis from the source code, and the information required for the analysis purified by the parser A defect detection unit for detecting at least one defect information, a correction example generation unit for generating at least one of correction example information and notice information based on defect information detected by the defect detection unit and information necessary for analysis refined by the syntax analysis unit; A source code analysis module including an analysis result delivery unit configured to configure at least one or more of the defect information, correction example information, and notice information to be analyzed result output module; And extracting and outputting defect information from the comprehensive analysis result information received from the source code analysis module, and extracting at least one of correction example information and notice information from the comprehensive analysis result information received from the source code analysis module. Disclosed is a source code analysis apparatus comprising a; analysis result output module including a modified example output unit to output.
바람직하게, 상기 수정예시 생성부는, 하나의 결함 정보에 대하여 하나 또는 그 이상의 수정예시 정보 또는 유의사항 정보를 생성하도록 구성된 것을 특징으로 한다. Preferably, the modification example generation unit, characterized in that configured to generate one or more correction example information or notice information for one defect information.
바람직하게, 상기 결함 검출부의 결함 정보 검출은 각각의 결함 여부를 체크하도록 구비된 각각의 체커의 기능 실행에 의해 이뤄지며, 상기 각각의 체커는 결함 정보 검출 시에 검출된 결함 정보에 대하여 생성될 수정예시 정보 및 유의사항 정보 중 적어도 하나가 포함된 종합 분석 결과 정보를 수정예시 생성부로 전달하도록 구성된 것을 특징으로 한다. Preferably, the detection of defect information of the defect detection unit is performed by executing a function of each checker provided to check whether each defect is present, wherein each checker is an example of correction to be generated for the defect information detected at the time of detecting the defect information. Characterized in that it is configured to deliver the comprehensive analysis result information including at least one of the information and notice information to the modification example generation unit.
바람직하게, 상기 수정예시 정보는, 결함 정보가 검출된 소스 코드 라인에 대하여 다른 코드 라인의 '추가', 다른 코드 라인으로의 '변경', 검출된 코드 라인의 '삭제' 중의 적어도 어느 하나를 포함하는 것을 특징으로 한다. Preferably, the modification example information includes at least one of 'addition' of another code line, 'change' to another code line, and 'delete' of the detected code line with respect to the source code line from which defect information is detected. Characterized in that.
바람직하게, 상기 수정예시 정보에 포함되는 수정예시 코드는, 결함 정보를 검출한 체커가 미리 설정된 템플릿에 따라 소스 코드를 분석 및 추론한 결과를 입력값으로 하여 생성되는 것을 특징으로 한다. Preferably, the modified example code included in the modified example information is generated by using a result of analyzing and inferring the source code according to a preset template by the checker that detects the defect information as an input value.
본 발명의 또다른 일측면에 따르면, 소스 코드 분석 장치에서 소스 코드 분석 기능 및 분석 결과 출력 기능을 실행하기 위한 컴퓨터 프로그램으로서, 상기 소스 코드 분석 기능은, 소스 코드로부터 분석에 필요한 정보들을 추출하고 정제하는 구문 분석 기능과, 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보를 검출하는 결함 검출 기능과, 결함 검출 기능에서 검출된 결함 정보 및 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보 및 유의사항 정보 중 적어도 하나를 생성하는 수정예시 생성 기능과, 생성된 결함 정보 및 수정예시 정보, 유의사항 정보 중 적어도 하나 이상을 종합 분석 결과 정보로 구성하여 분석 결과 출력 기능으로 전달하는 분석결과 전달 기능을 포함하여 실행하며; 상기 분석 결과 출력 기능은, 소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 결함 정보를 추출하여 출력하는 결함 출력 기능과, 소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 수정예시 정보 및 유의사항 정보 중 적어도 하나를 추출하여 출력하는 수정예시 출력 기능을 포함하여 실행하기 위하여; 매체에 저장된 컴퓨터 프로그램이 개시된다.According to another aspect of the present invention, a computer program for executing a source code analysis function and an analysis result output function in a source code analysis device, the source code analysis function, extracts and refines the information necessary for analysis from the source code Based on the information required for the analysis refined in the parsing function, the defect detection function for detecting defect information that may be a problem in the source code, and the defect information and parsing function detected in the defect detection function Based on the information necessary for the analysis, the correction example generation function for generating at least one of the correction information and the notice information, and at least one or more of the generated defect information, correction example information, notice information by combining the analysis result information Includes analysis result delivery function to deliver analysis result output function Open and run; The analysis result output function may include a defect output function for extracting and outputting defect information from the comprehensive analysis result information received from the source code analysis function, and correction example information and notice information from the comprehensive analysis result information received from the source code analysis function. To include a modified example output function for extracting and outputting at least one of the outputs; A computer program stored on a medium is disclosed.
본 발명의 또다른 일측면에 따르면, 소스 코드 분석 장치에서 소스 코드 분석 기능 및 분석 결과 출력 기능을 실행하기 위한 컴퓨터 프로그램이 기록된 기록 매체로서, 상기 소스 코드 분석 기능은, 소스 코드로부터 분석에 필요한 정보들을 추출하고 정제하는 구문 분석 기능과, 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보를 검출하는 결함 검출 기능과, 결함 검출 기능에서 검출된 결함 정보 및 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보 및 유의사항 정보 중 적어도 하나를 생성하는 수정예시 생성 기능과, 생성된 결함 정보 및 수정예시 정보, 유의사항 정보 중 적어도 하나 이상을 종합 분석 결과 정보로 구성하여 분석 결과 출력 기능으로 전달하는 분석결과 전달 기능을 포함하여 실행하며; 상기 분석 결과 출력 기능은, 소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 결함 정보를 추출하여 출력하는 결함 출력 기능과, 소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 수정예시 정보 및 유의사항 정보 중 적어도 하나를 추출하여 출력하는 수정예시 출력 기능을 포함하여 실행하기 위한; 컴퓨터 프로그램이 기록된, 컴퓨터로 판독 가능한 기록 매체가 개시된다.According to yet another aspect of the present invention, a computer program for recording a source code analysis function and an analysis result output function is recorded in a source code analysis apparatus, wherein the source code analysis function is required for analysis from source code. A parsing function for extracting and refining information, a defect detection function for detecting defect information that may be a problem in the source code based on the information necessary for the analysis refined in the parsing function, a defect information detected in the defect detection function, and Based on the information required for the refined analysis in the parsing function, a modified example generating function for generating at least one of correction example information and notice information, and comprehensive analysis of at least one or more of the generated defect information, correction example information, and notice information Analysis result composed of result information and delivered to analysis result output function Execution, including the moon and functions; The analysis result output function may include a defect output function for extracting and outputting defect information from the comprehensive analysis result information received from the source code analysis function, and correction example information and notice information from the comprehensive analysis result information received from the source code analysis function. Executing at least one of a modified example output function for extracting and outputting at least one of the outputs; A computer readable recording medium having a computer program recorded thereon is disclosed.
이와 같은 본 발명은, 미리 정의된 분석룰에 따라 분석한 분석 대상 소스 코드에 결함이 발견된 경우에 결함 수정안을 제안할 수 있도록 구성되므로, 소스 코드에 대한 결함 수정 작업 시에 사용자(프로그래머)의 개인적인 지식과 경험에 의존하지 않고 보다 객관적이고 향상된 결함 수정 작업이 가능하다.The present invention is configured to suggest a defect correction when a defect is found in the analysis target source code analyzed according to a predefined analysis rule, so that the user (programmer) at the time of correcting the defect for the source code More objective and improved defect correction is possible without relying on personal knowledge and experience.
도 1은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 구성도, 1 is a block diagram of a source code analysis apparatus according to an embodiment of the present invention,
도 2는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 분석 결과 정보 구성 예, 2 is a configuration example of analysis result information of a source code analysis apparatus according to an embodiment of the present invention;
도 3은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 결함 검출부의 체커에 의해 결함이 발견된 소스 코드 페이지 화면 예, 3 is an example of a source code page screen in which a defect is found by a checker of a defect detector of a source code analysis apparatus according to an embodiment of the present invention;
도 4는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 예, 4 is an example of a comprehensive analysis result output screen after clicking a modification example button of a source code analysis apparatus according to an embodiment of the present invention;
도 5는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 예시 메뉴 표시 예, 5 is an example menu display example of a comprehensive analysis result output screen after clicking a modification example button of a source code analysis apparatus according to an embodiment of the present invention;
도 6은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 결함 정보 표시 예, FIG. 6 shows an example of displaying defect information in a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an embodiment of the present invention; FIG.
도 7은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 수정예시 정보 표시 예, 7 is an example of displaying modified example information in a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an embodiment of the present invention;
도 8은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 유의사항 정보 표시 예, 8 is an example of displaying notice information of a comprehensive analysis result output screen after clicking a modification example button of a source code analysis apparatus according to an embodiment of the present invention;
도 9는 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구현 클래스 중 XML 출력 클래스의 예, 9 is an example of an XML output class in a checker implementation class for a source code analysis apparatus according to an embodiment of the present invention;
도 10은 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구현 클래스 중 코드 생성 클래스의 예이다.10 is an example of a code generation class among checker implementation classes for a source code analysis apparatus according to an embodiment of the present invention.
본 발명은 그 기술적 사상 또는 주요한 특징으로부터 벗어남이 없이 다른 여러가지 형태로 실시될 수 있다. 따라서, 본 발명의 실시예들은 모든 점에서 단순한 예시에 지나지 않으며 한정적으로 해석되어서는 안 된다.The present invention can be embodied in many other forms without departing from the spirit or main features thereof. Therefore, the embodiments of the present invention are merely examples in all respects and should not be interpreted limitedly.
제1, 제2 등의 용어는 다양한 구성요소들을 설명하는 데 사용될 수 있지만, 상기 구성요소들은 상기 용어들에 의해 한정되어서는 안 된다. 상기 용어들은 하나의 구성요소를 다른 구성요소로부터 구별하는 목적으로만 사용된다. 예를 들어, 본 발명의 권리 범위를 벗어나지 않으면서 제1 구성요소는 제2 구성요소로 명명될 수 있고, 유사하게 제2 구성요소도 제1 구성요소로 명명될 수 있다. 및/또는 이라는 용어는 복수의 관련된 기재된 항목들의 조합 또는 복수의 관련된 기재된 항목들 중의 어느 항목을 포함한다.Terms such as first and second may be used to describe various components, but the components should not be limited by the terms. The terms are used only for the purpose of distinguishing one component from another. For example, without departing from the scope of the present invention, the first component may be referred to as the second component, and similarly, the second component may also be referred to as the first component. The term and / or includes a combination of a plurality of related items or any item of a plurality of related items.
어떤 구성요소가 다른 구성요소에 "연결되어" 있다거나 "접속되어" 있다고 언급된 때에는, 그 다른 구성요소에 직접적으로 연결되어 있거나 또는 접속되어 있을 수도 있지만, 중간에 다른 구성요소가 존재할 수도 있다고 이해되어야 할 것이다. 반면에, 어떤 구성요소가 다른 구성요소에 "직접 연결되어" 있다거나 "직접 접속되어" 있다고 언급된 때에는, 중간에 다른 구성요소가 존재하지 않는 것으로 이해되어야 할 것이다.When a component is referred to as being "connected" or "connected" to another component, it may be directly connected to or connected to that other component, but it may be understood that other components may be present in between. Should be. On the other hand, when a component is said to be "directly connected" or "directly connected" to another component, it should be understood that there is no other component in between.
본 출원에서 사용한 용어는 단지 특정한 실시예를 설명하기 위해 사용된 것으로, 본 발명을 한정하려는 의도가 아니다. 단수의 표현은 문맥상 명백하게 다르게 뜻하지 않는 한, 복수의 표현을 포함한다. 본 출원에서, "포함하다" 또는 "구비하다", "가지다" 등의 용어는 명세서상에 기재된 특징, 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것이 존재함을 지정하려는 것이지, 하나 또는 그 이상의 다른 특징들이나 숫자, 단계, 동작, 구성요소, 부품 또는 이들을 조합한 것들의 존재 또는 부가 가능성을 미리 배제하지 않는 것으로 이해되어야 한다.The terminology used herein is for the purpose of describing particular example embodiments only and is not intended to be limiting of the present invention. Singular expressions include plural expressions unless the context clearly indicates otherwise. In this application, the terms "comprise", "comprise", "have", and the like are intended to indicate that there is a feature, number, step, operation, component, part, or combination thereof described in the specification. Or other features or numbers, steps, operations, components, parts or combinations thereof in any way should not be excluded in advance.
다르게 정의되지 않는 한, 기술적이거나 과학적인 용어를 포함해서 여기서 사용되는 모든 용어들은 본 발명이 속하는 기술 분야에서 통상의 지식을 가진 자에 의해 일반적으로 이해되는 것과 동일한 의미를 가지고 있다. 일반적으로 사용되는 사전에 정의되어 있는 것과 같은 용어들은 관련 기술의 문맥상 가지는 의미와 일치하는 의미를 가지는 것으로 해석되어야 하며, 본 출원에서 명백하게 정의하지 않는 한, 이상적이거나 과도하게 형식적인 의미로 해석되지 않는다.Unless defined otherwise, all terms used herein, including technical or scientific terms, have the same meaning as commonly understood by one of ordinary skill in the art. Terms such as those defined in the commonly used dictionaries should be construed as having meanings consistent with the meanings in the context of the related art, and are not construed in ideal or excessively formal meanings unless expressly defined in this application. Do not.
이하, 첨부된 도면을 참조하여 본 발명에 따른 바람직한 실시예를 상세히 설명하되, 도면 부호에 관계없이 동일하거나 대응하는 구성 요소는 동일한 참조 번호를 부여하고 이에 대한 중복되는 설명은 생략하기로 한다. 본 발명을 설명함에 있어서 관련된 공지 기술에 대한 구체적인 설명이 본 발명의 요지를 흐릴 수 있다고 판단되는 경우 그 상세한 설명을 생략한다.Hereinafter, exemplary embodiments of the present invention will be described in detail with reference to the accompanying drawings, and the same or corresponding components will be denoted by the same reference numerals regardless of the reference numerals and redundant description thereof will be omitted. In the following description of the present invention, if it is determined that the detailed description of the related known technology may obscure the gist of the present invention, the detailed description thereof will be omitted.
도 1은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 구성도, 도 2는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 분석 결과 정보 구성 예이다. 1 is a block diagram of a source code analysis device according to an embodiment of the present invention, Figure 2 is an example configuration of the analysis result information of the source code analysis device according to an embodiment of the present invention.
본 실시예의 소스 코드 분석 장치(A)는, 소스 코드 입력 모듈(100), 소스 코드 분석 모듈(200), 분석 결과 출력 모듈(300) 및 제어 모듈(400)을 포함하며, 일예로, 소스 코드 분석 장치 구현을 위한 컴퓨터 프로그램이 통상의 컴퓨터 하드웨어에서 구동되는 형태로 구현될 수 있다. The source code analysis device A of the present embodiment includes a source code input module 100, a source code analysis module 200, an analysis result output module 300, and a control module 400. The computer program for implementing the analysis device may be implemented in a form that runs on conventional computer hardware.
소스 코드 입력 모듈(100)은, 예를 들어, 분석 대상 소스 코드를 코드 파일의 형태로 입력받아 후술하는 소스 코드 분석 모듈(200)이 분석 처리를 할 수 있도록 한다. 일예로, 코드 파일의 입력은 사용자의 파일 입력 또는 오픈 조작에 의해 이뤄질 수 있다. The source code input module 100 receives, for example, an analysis target source code in the form of a code file so that the source code analysis module 200 described later may perform an analysis process. For example, the input of the code file may be made by a file input or an open operation of the user.
소스 코드 분석 모듈(200)은, 분석을 위해 입력 전달된 소스 코드로부터 결함 정보(220A) 및 수정예시 정보(230A), 수정 시 발생할 수 있는 다양한 종류의 유의사항 정보(230B)들을 포함하는 종합 분석 결과(240A)를 생성한다. The source code analysis module 200 includes a comprehensive analysis including defect information 220A, correction example information 230A, and various kinds of notice information 230B that may occur when correcting from a source code input and received for analysis. Generate result 240A.
분석 결과 출력 모듈(300)은, 소스 코드 분석 모듈(200)로부터 전달받은 종합 분석 결과(240A)를 토대로 사용자에게 결함 정보(220A), 수정예시 정보(230A), 유의 사항 정보(230B)를 보여준다. 실시예에 따라 소스 코드 분석 모듈(200) 및 분석 결과 출력 모듈(300)은 하나의 모듈로 통합 구현될 수 있다.The analysis result output module 300 shows defect information 220A, correction example information 230A, and notice information 230B to the user based on the comprehensive analysis result 240A received from the source code analysis module 200. . According to an embodiment, the source code analysis module 200 and the analysis result output module 300 may be integrated into one module.
바람직한 일예로, 소스 코드 분석 모듈(200)은, 구문 분석부(210), 결함 검출부(220), 수정예시 생성부(230), 분석결과 전달부(240)를 포함한다. In a preferred embodiment, the source code analysis module 200 includes a syntax analyzer 210, a defect detector 220, a modified example generator 230, and an analysis result transmitter 240.
구문 분석부(210)는 입력받은 소스 코드로부터 분석에 필요한 각종 정보들을 추출하고 정제하는 역할을 수행한다. 분석에 필요한 정보는, 예를 들어, 추상 구문 트리(Abstract Syntax Tree)나 소스 코드의 라인 수, 위치 정보 등이 될 수 있다. The parser 210 performs a role of extracting and purifying various information required for analysis from the input source code. The information necessary for the analysis may be, for example, an abstract syntax tree, the number of lines of source code, location information, or the like.
결함 검출부(220)는 구문 분석부(210)에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보(220A)를 검출해 낸다. 상기 결함 검출부(220)의 결함 정보(220A) 검출은 일예로, 결함 여부를 체크하는 체커의 기능 실행에 의해 이뤄질 수 있다. 결함 정보(220A)는 예를 들어, 결함이 실제 발생한 소스 코드의 파일명, 라인과 같은 위치 정보와 결함의 종류, 실제 결함의 원인이 된 부분, 결함이 발생하게 된 소스 코드의 흐름과 같은 실제 결함 정보 등으로 구성된다. The defect detector 220 detects defect information 220A, which may be a problem in the source code, based on the information necessary for the analysis refined by the parser 210. Detection of the defect information 220A of the defect detector 220 may be performed by, for example, executing a checker function to check whether there is a defect. The defect information 220A includes, for example, the actual defect such as the file name of the source code where the defect actually occurred, the location information such as a line and the type of the defect, the part causing the actual defect, and the flow of the source code where the defect occurred. Information and the like.
상기 구문 분석부(210)의 구문 분석 기능 및 결함 검출부(220)의 결함 정보 검출 기능은, 공지의 다양한 정적 분석 도구(Static Analysis Tool)의 구문 분석 기능 및 결함 정보 검출 기능과 동일 내지 유사한 구성을 통해 구현될 수 있다. 정적 분석 도구는 문법기반(Syntactic) 분석 또는 의미기반(Semantic) 분석 방식의 다양한 상용 제품들이 공지된 바 있으므로, 그 상세한 설명은 생략한다. The syntax analysis function of the parser 210 and the defect information detection function of the defect detector 220 may be configured to have the same or similar configuration as the syntax analysis function and the defect information detection function of various known static analysis tools. It can be implemented through. Since the static analysis tool has been known a variety of commercial products of the syntactic analysis (Syntactic analysis) or semantic analysis (Semantic analysis method), its detailed description is omitted.
상기 결함 검출부(220)의 결함 정보(220A) 검출은 각각의 결함 여부를 체크하도록 구비된 각각의 체커의 기능 실행에 의해 이뤄지며, 상기 각각의 체커는 결함 정보(220A) 검출 시에 검출된 결함 정보(220A)에 대하여 생성될 수정예시 정보(230A)와 유의사항 정보(230B)가 포함된 종합 분석 결과 정보(240A)를 수정예시 생성부(230)로 전달하도록 구성된다. 종합 분석 결과 정보(240A)는 예를 들어, 수정 예시 XML 파일의 형태로 구성될 수 있으며, 반드시 이러한 형태로 한정되는 것은 아니다. Detecting defect information 220A of the defect detection unit 220 is performed by the execution of the function of each checker provided to check whether each defect is present, and each checker detects the defect information detected at the time of detecting the defect information 220A. The comprehensive analysis result information 240A including the modified example information 230A and the notice information 230B to be generated for the 220A is transmitted to the modified example generator 230. The comprehensive analysis result information 240A may be configured, for example, in the form of a modified example XML file, but is not necessarily limited thereto.
한편, 동일한 하나의 체커인 경우에도, 분석된 소스 코드의 구조에 따라 다른 수정예시 정보(230A)와 유의사항 정보(230B)를 전달할 수 있다. 또한, 결함 특성상 체커가 체크한 결함에 대하여 굳이 수정예시 정보(230A)와 유의사항 정보(230B)가 제공될 필요가 없는 경우에는 이들 정보를 제공하지 않거나, 수정예시 정보(230A)만을 제공하거나 유의사항 정보(230B)만을 제공하도록 구성될 수도 있다. 또한, 하나의 결함 정보(220A)에 대해서 복수의 수정예시 정보(230A)와 유의사항 정보(230B)가 복수의 대안으로서 생성될 수도 있으며, 이에 대해서는 별도로 후술한다. 본 실시예의 설명에서는 수정예시 정보(230A)와 유의사항 정보(230B)가 함께 제공되는 경우를 예시 설명한다. Meanwhile, even in the case of the same checker, other modified example information 230A and notice information 230B may be transmitted according to the structure of the analyzed source code. In addition, in the case of the defect characteristics checked by the checker, the correction example information 230A and the notice information 230B does not need to be provided, or provide only the correction example information 230A or note. It may be configured to provide only the item information 230B. Also, a plurality of modification example information 230A and notice information 230B may be generated as a plurality of alternatives for one defect information 220A, which will be described later. In the description of this embodiment, an example in which the modified example information 230A and the notice information 230B are provided together is described.
수정예시 생성부(230)는 결함 검출부(220)에서 검출된 결함 정보(220A) 및 구문 분석부(210)에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보(230A) 와 유의사항 정보(230B)를 생성해 낸다. The modified example generation unit 230 is based on the defect information 220A detected by the defect detector 220 and the information necessary for the analysis refined by the parser 210, the modified example information 230A and the notice information 230B. Produces
수정예시 정보(230A)는 결함 정보(220A) 내에서 발생한 결함을 실제 소스 코드로 어떻게 수정하면 되는지 알려줄 수 있는 수정예시 코드를 말한다. 예를 들어, 수정예시 정보(230A)에서 알려준 정보를 토대로 소스 코드를 수정하면 결함이 발생하지 않는다. The modification example information 230A refers to a modification example code that can inform how to correct a defect occurring in the defect information 220A with the actual source code. For example, if the source code is modified based on the information provided in the modification example information 230A, a defect does not occur.
상기 수정예시 정보(230A)는, 결함 정보(220A)가 검출된 소스 코드 라인에 대하여 다른 코드 라인의 '추가', 다른 코드 라인으로의 '변경', 검출된 코드 라인의 '삭제' 중의 적어도 어느 하나를 포함할 수 있다. The modified example information 230A may include at least one of 'addition' of another code line, 'change' to another code line, and 'delete' of the detected code line with respect to the source code line where the defect information 220A is detected. It may include one.
유의사항 정보(230B)는 사용자가 소스 코드를 수정하면서 발생할 수 있는 다양한 유의사항 정보를 말한다. 예를 들어, 사용자가 소스 코드 수정 시 도움이 되는 정보나, 수정예시 정보(230A)에서 알려주는 수정예시대로 코드를 수정하면서 발생할 수 있는 부수적인 문제들, 또는 소스 코드 분석 장치(A)에서 자동적으로 생성할 수 없어 사용자가 직접 수정해야 하는 사항들이 될 수 있다. The notice information 230B refers to various notice information that may occur while the user modifies the source code. For example, information helpful when a user modifies the source code, incidental problems that may occur while modifying the code as described in the modification example information 230A, or automatically in the source code analysis apparatus A. Because it cannot be created, it may be something that a user needs to modify.
분석결과 전달부(240)는 앞서 생성된 결함 정보(220A)나 수정예시 정보(230A), 유의사항 정보(230B)들을 종합 분석 결과 정보(240A)로 구성하여 분석 결과 출력 모듈(300)로 전달한다. 이러한 종합 분석 결과 정보(240A)는 파일 혹은 메모리 내의 데이터가 될 수 있으며, 다른 정보들이 포함될 수도 있다. 또한, 결함의 종류에 따라 하나의 결함 정보(220A)에서 수정예시 정보(230A)나 유의사항 정보(230B)는 없거나 더 많을 수 있다.The analysis result transmitting unit 240 configures the previously generated defect information 220A, correction example information 230A, and notice information 230B as comprehensive analysis result information 240A and delivers the result to the analysis result output module 300. do. The comprehensive analysis result information 240A may be data in a file or a memory, and other information may be included. In addition, the correction example information 230A or the notice information 230B may not be present or more in one defect information 220A according to the type of the defect.
바람직한 일예로, 분석 결과 출력 모듈(300)은 결함 출력부(310)와 수정예시 출력부(320)를 포함한다. In an exemplary embodiment, the analysis result output module 300 includes a defect output unit 310 and a correction example output unit 320.
결함 출력부(310)는 소스 코드 분석 모듈(200)로부터 전달받은 종합 분석 결과 정보(240A)에서 결함 정보(220A)를 추출하여 사용자에게 보여준다. 이러한 정보는 일반적으로 상술한 바와 같이 소스 코드의 파일명, 라인과 같은 위치 정보, 결함의 종류나 실제 결함의 원인이 된 부분, 결함이 발생하게 된 소스 코드의 흐름 등이 될 수 있다. The defect output unit 310 extracts the defect information 220A from the comprehensive analysis result information 240A received from the source code analysis module 200 and shows it to the user. As described above, such information may be a file name of a source code, location information such as a line, a kind of a defect or a part that causes a real defect, a flow of source code in which a defect occurs, and the like.
수정예시 출력부(320)는 소스 코드 분석 모듈(200)로부터 전달받은 종합 분석 결과 정보(240A)에서 수정예시 정보(230A) 및 유의사항 정보(230B)를 추출하여 사용자에게 보여준다. 이러한 정보는 일반적으로 상술한 바와 같이 실제 소스 코드를 어떻게 고쳐야 하는지에 대한 수정예시 코드와 소스 코드를 수정하면서 발생할 수 있는 다양한 유의사항 정보가 될 수 있다. 실시예에 따라 결함 출력부(310)와 수정예시 출력부(320)는 동시에 출력을 수행하거나 다른 정보를 추가적으로 출력할 수도 있다. The modified example output unit 320 extracts the modified example information 230A and the notice information 230B from the comprehensive analysis result information 240A received from the source code analysis module 200 and shows it to the user. As described above, the information may be modified examples of how to correct the actual source code and various notice information that may occur while modifying the source code. In some embodiments, the defect output unit 310 and the modified example output unit 320 may simultaneously output or additionally output other information.
이하, 각 예시 화면을 통해 본 실시예의 소스 코드 분석 장치의 구현예를 예시 설명한다. Hereinafter, an implementation example of the source code analysis apparatus of this embodiment will be described by way of example screens.
도 3은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 결함 검출부의 체커에 의해 결함이 발견된 소스 코드 페이지 화면 예이다. 3 is an example of a source code page screen in which a defect is found by a checker of a defect detection unit of a source code analysis apparatus according to an exemplary embodiment of the present invention.
결함 발견 시 화면의 우측 상단에 수정예시 버튼이 표시된다.When a defect is found, a corrective action button is displayed on the upper right of the screen.
도 4는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 예이다. 4 is an example of a comprehensive analysis result output screen after clicking on a modified example button of a source code analysis apparatus according to an embodiment of the present invention.
화면에 결함 정보, 수정예시 정보, 유의사항 정보가 각각 표시된다. 수정예시 정보 또는 유의사항 정보는 하나의 결함 정보에 대하여 하나 또는 그 이상이 제공될 수 있다.Defect information, correction example information and notice information are displayed on the screen, respectively. The modified example information or the notice information may be provided with one or more for one defect information.
도 5는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 예시 메뉴 표시 예이다. 5 is an example of displaying an example menu of a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an embodiment of the present invention.
예시 메뉴는 체커의 종류 및 소스 코드에 따라 개수가 달라질 수 있다. 각각의 예시 메뉴는 좌측단의 세모 표시를 누름에 의해 접거나 펴지는 것이 가능하다.The number of example menus may vary depending on the type of checkers and the source code. Each example menu can be folded or unfolded by pressing the triangle mark on the left end.
도 6은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 결함 정보 표시 예이다. FIG. 6 is an example of displaying defect information in a comprehensive analysis result output screen after a button of a modification example button of a source code analysis apparatus according to an exemplary embodiment of the present invention. FIG.
결함 정보 메뉴는 체커가 검출한 결함을 어떻게 수정해야 할 지를 알려준다.The fault information menu tells the checker how to fix the faults detected.
도 7은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 수정예시 정보 표시 예이다. 7 illustrates an example of displaying modified example information on a comprehensive analysis result output screen after clicking a modified example button of a source code analysis apparatus according to an exemplary embodiment of the present invention.
수정예시 메뉴에서는 소스 코드에서 어떤 부분을 어떻게 수정해야 하는지를 알려준다. 상기 예시 코드는 최대한 실제 코드와 동일하게 제공된다. 화면 중에 붉은색으로 그라데이션 되어 '-' 로 시작하는 라인은 삭제될 코드를 표시하며, 녹색으로 그라데이션 되어 '+' 로 시작하는 라인은 추가되어야 할 코드에 해당한다. 수정이 필요한 코드의 라인이 많이 떨어져 있거나 다른 파일인 경우, 박스가 여러개 표시될 수 있다.The example menu tells you how to modify what part of the source code. The example code is provided as identical as possible to the actual code. Lines starting with '-' that are gradated in red on the screen indicate the code to be deleted, and lines starting with '+' that are graded in green correspond to the code to be added. If you have a lot of lines of code that need to be modified or are different files, you may see multiple boxes.
도 8은 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 버튼 클릭 후의 종합 분석 결과 출력 화면 중 유의사항 정보 표시 예이다. 8 is an example of displaying notice information in a comprehensive analysis result output screen after clicking a modification example button of the apparatus for analyzing a source code according to an embodiment of the present invention.
유의사항 정보는 소스 코드를 수정하였을 때 발생할 수 있는 다양한 상황이나 주의점들을 설명한다. 따라서, 체커의 종류 및 소스 코드에 따라 개수 및 내용이 달라질 수 있다. Notice Information describes various situations or precautions that may occur when the source code is modified. Therefore, the number and content of the checkers may vary depending on the type and source code.
하기의 소스 코드는 본 발명의 일실시예에 따른 소스 코드 분석 장치의 수정예시 XML 파일의 예이고, 표 1은 하기의 소스 코드의 수정예시 XML 파일의 주요 태그 또는 변수 정의 예를 나타낸 표이다. 하기의 소스 코드 및 표 1을 통해 본 실시예의 수정예시 XML 파일이 예시적으로 이해될 수 있다.The following source code is an example of a modification example XML file of a source code analysis apparatus according to an embodiment of the present invention, Table 1 is a table showing an example of the main tag or variable definition of the modification example XML file of the following source code. Through the following source code and Table 1, the modified example XML file of the present embodiment can be understood as an example.
<alarm><alarm>
<sca><sca>
<alternative id=“1”>  <alternative id = “1”>
<desc id=“crulechk.CHECKER_NAME.sca.desc.default”>    <desc id = “crulechk.CHECKER_NAME.sca.desc.default”>
<arg>func</arg>      <arg> func </ arg>
</desc>    </ desc>
<code type=“add” src=“/src/somefile.cpp” startline=“1230”>    <code type = “add” src = “/ src / somefile.cpp” startline = “1230”>
strncpy(dst, src, 10);strncpy (dst, src, 10);
</code>    </ code>
<code type=“remove” src=“/src/somefile.cpp” startline=“1250” endline=“1251”/>    <code type = “remove” src = “/ src / somefile.cpp” startline = “1250” endline = “1251” />
<code type=“replace” src=“/src/somefile.cpp” startline=“1400”>void func(int arg) </code>    <code type = “replace” src = “/ src / somefile.cpp” startline = “1400”> void func (int arg) </ code>
<note type=“change_function_interface”>    <note type = “change_function_interface”>
<desc id=“crulechk.CHECKER_NAME.sca.note.desc.1”>      <desc id = “crulechk.CHECKER_NAME.sca.note.desc.1”>
<arg>func</arg>        <arg> func </ arg>
</desc>      </ desc>
<value type=“def_src”>/src/somefile.cpp</value>      <value type = “def_src”> / src / somefile.cpp </ value>
<value type =“def_line”>1250</value>      <value type = “def_line”> 1250 </ value>
<value type =“function_name”>func</value>      <value type = “function_name”> func </ value>
</note>    </ note>
</alternative>  </ alternative>
<alternative id=“2”>  <alternative id = “2”>
    …
</alternative>  </ alternative>
</sca></ sca>
</alarm></ alarm>
alarmalarm 최상위 결함 요소를 표현함.Represents the highest level of fault.
scasca SCA 최상위 요소.SCA top level element.
alternativealternative 각각 하나의 대안을 포괄하는 요소.Each element encompasses one alternative.
descdesc 대안의 설명 요소를 표현함.(=리소스 프로퍼티)Represents an alternative descriptive element (= resource property).
argarg 대안의 설명 요소의 인자값을 표현함.Represents the argument value of an alternative description element.
codecode 변경되는 코드의 요소를 표현함.Represents an element of code that changes.
notenote 유의사항 요소를 표현함.Notice Expresses the element.
(note)desc(note) desc 유의사항의 설명 요소를 표현함.(=리소스 프로퍼티)Represents the description element of the note (= resource property).
(note)arg(note) arg 유의사항의 설명 요소의 인자값을 표현함.Explanation of the notes Indicates the argument values of the elements.
valuevalue 유의사항에서 변경되는 값 요소를 표현함.Represents a value element that changes in the note.
'sca' 또는 'Sca'는 'Smart Code Alternative'의 약자로서, 본 실시예의 수정예시 XML 파일에 포함된 복수의 대안(alternative)을 포함하는 상위 요소의 예시적 명칭으로 편의상 명명한다.'sca' or 'Sca' is an abbreviation of 'Smart Code Alternative', and is conveniently named as an exemplary name of an upper element including a plurality of alternatives included in the modified XML file of this embodiment.
도 9는 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구현 클래스 중 XML 출력 클래스의 예, 도 10은 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구현 클래스 중 코드 생성 클래스의 예이다. 9 is an example of an XML output class in a checker implementation class for a source code analysis apparatus according to an embodiment of the present invention, Figure 10 is a code generation of the checker implementation class for a source code analysis apparatus according to an embodiment of the present invention Example of a class.
도 9의 경우, 상위 클래스부터 간략하게 예시 설명한다. In the case of FIG. 9, the upper class is briefly described as an example.
최상부의 'AlarmXMLMaker' 클래스는, 알람 출력시 Sca 인스턴스가 있으면 함께 출력한다. The 'AlarmXMLMaker' class at the top outputs the Sca instance when the alarm is output.
중간의 'Sca' 클래스는, ScaAlternative 인스턴스 생성을 책임지며, 체커에서 대안 생성 시에 이 함수를 사용한다. The intermediate 'Sca' class is responsible for creating a ScaAlternative instance, and uses this function to generate alternatives in Checker.
최하부의 'ScaAlternative' 클래스(대안 정보 클래스)는, 설명, 코드, 유의사항 정보를 포함하며, 코드의 추가/변경/삭제 정보는 'CodeGenerator' 클래스가 생성한 코드 정보를 받아오거나, 원본 소스 코드로부터 받아오는 경우도 있다. The bottom 'ScaAlternative' class (alternative information class) contains description, code, and notice information.Addition / change / deletion information of the code can be obtained from the code information generated by the 'CodeGenerator' class or from the original source code. It may be received.
도 10의 경우, 'CodeGenerator' 클래스(코드 생성 클래스)들은, 일정한 템플릿에 따라 원본 소스 코드를 분석 및 추론한 결과를 입력값으로 하여 수정 예시 코드를 생성해낸다. 'CodeGenerator' 클래스에는 라인 추가를 위한 'SimpleCodeGenerator', 타입 생성을 위한 'TypeCodeGenerator', 변수 생성을 위한 'VariableCodeGenerator', 함수 생성을 위한 'FunctionCodeGenerator' 등이 포함된다. In the case of FIG. 10, the 'CodeGenerator' classes (code generation classes) generate modified example codes based on a result of analyzing and inferring original source code according to a predetermined template. The 'CodeGenerator' class includes 'SimpleCodeGenerator' for adding lines, 'TypeCodeGenerator' for type generation, 'VariableCodeGenerator' for variable creation, and 'FunctionCodeGenerator' for function creation.
표 2는 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구성의 일예, 표 3은 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구성의 또다른 일예, 표 4는 본 발명의 일실시예에 따른 소스 코드 분석 장치를 위한 체커 구성의 또다른 일예를 나타내는 표이다.Table 2 is an example of a checker configuration for a source code analysis apparatus according to an embodiment of the present invention, Table 3 is another example of a checker configuration for a source code analysis apparatus according to an embodiment of the present invention, Table 4 Table showing another example of the checker configuration for the source code analysis apparatus according to an embodiment of the present invention.
예제 1Example 1
체커checkers DO_NOT_USE_ADJACENT_BINARY_OPERATORDO_NOT_USE_ADJACENT_BINARY_OPERATOR
소스코드Source code [1] strncpy(dst, src, sizeof(dst)-1);[1] strncpy (dst, src, sizeof (dst) -1);
대안1Alternative 1 설명Explanation - 연산자 사이에 공백을 추가합니다.-Add spaces between operators.
대안타입Alternative type REPLACEREPLACE
대안코드Alternative code [1] strncpy(dst, src, sizeof(dst) - 1);[1] strncpy (dst, src, sizeof (dst)-1);
유의사항Notice 없음none
예제 1의 경우, dot(.) 연산자를 제외한 이항 연산자들과 전후 피연산자들은 공백으로 구분되어야 한다는 것을 검사하는 체커이다. 제공된 소스 코드 중 이항연산자 '-'가 사용된 부분의 좌우에 공백을 넣는 것으로 대안 코드(수정 예시 코드)를 작성할 수 있다. 이 예제의 경우 특별한 유의사항은 없다.For example 1, this is a checker that checks that binary operators (except the dot (.)) Operator and the before and after operands must be separated by spaces. Alternate code (modification example code) can be written by inserting spaces to the left and right of the part of the provided source code where the binary operator '-' is used. There is no special note for this example.
예제 2Example 2
체커checkers DO_NOT_USE_SIZEOF_ON_ARRAY_PARAMDO_NOT_USE_SIZEOF_ON_ARRAY_PARAM
소스코드Source code [1] void func(char dst[], char src[])[2] {[3] strncpy(dst, src, sizeof(dst)-1);[4] }[1] void func (char dst [], char src []) [2] {[3] strncpy (dst, src, sizeof (dst) -1); [4]}
대안1Alternative 1 설명Explanation 함수 인터페이스를 변경하며, strncpy의 세번째 인자를 넘겨받은 값으로 사용합니다.Change the function interface, using the third argument of strncpy as the value passed in.
대안타입Alternative type REPLACEREPLACE
대안코드Alternative code [1] void func(char dst[], int<<length_identifier>>, char src[])[1] void func (char dst [], int << length_identifier >>, char src [])
유의사항Notice [함수 인터페이스 변경]func 함수 선언부 및 이 함수를 사용한 코드들을 수정해야 합니다.[Function Interface Change] You need to modify the func function declaration and the code that uses this function.
대안타입Alternative type REPLACEREPLACE
대안코드Alternative code [3] strncpy(dst, src, <<length_identifier>>);[3] strncpy (dst, src, << length_identifier >>);
유의사항Notice 없음none
예제 2의 경우, 배열 타입 파라메터로 받은 배열 타입의 변수에 대해 sizeof를 사용해서는 안된다는 체커이다. 대안코드는 1, 3번 라인에서 발생하게 되며, 이때 1번 라인의 변경으로 함수 인터페이스 변경 유의사항이 생긴다. 만약 함수 인터페이스가 변경되는 경우, 이 함수의 선언이나 사용한 부분 역시 수정되어야 한다. 3번 라인의 strncpy는 3번째 인자의 시작절을 대안코드1에서 추가한 길이값 변수를 넣도록 한다. 이와 관련된 관련된 특별한 유의사항은 없다.In Example 2, the checker says that sizeof should not be used for variables of array types received as array type parameters. The alternative code occurs on lines 1 and 3, and the change of line 1 causes the change of function interface. If the function interface changes, the declaration or use of this function must also be modified. The strncpy on line 3 causes the length variable to be added in alternative code 1 with the start clause of the third argument. There is no special note in this regard.
예제 3Example 3
체커checkers NONEFFECTIVE_FUNCTION_CALLNONEFFECTIVE_FUNCTION_CALL
소스코드Source code [1] char * buf= (char *)malloc(sizeof(char) * ((l * 2) + 1));[2] memset(buf, (l * 2) + 1, 0); // Initialize the buffer[1] char * buf = (char *) malloc (sizeof (char) * ((l * 2) + 1)); [2] memset (buf, (l * 2) + 1, 0); // Initialize the buffer
대안1Alternative 1 설명Explanation memset의 세번째 인자를 버퍼의 크기로 대체합니다.Replace the third argument of memset with the size of the buffer.
대안타입Alternative type REPLACEREPLACE
대안코드Alternative code [2] memset(buf, (l * 2) + 1, sizeof(char) * ((l * 2) + 1));[2] memset (buf, (l * 2) + 1, sizeof (char) * ((l * 2) + 1));
유의사항Notice 없음none
대안2Alternative 2 설명Explanation memset의 두번째 인자가 상수가 아니므로 세번째 인자와 바꾸도록 합니다. 인자의 위치를 혼동했을 수 있습니다.The second argument of memset is not a constant, so replace it with the third argument. You may have confused the position of the argument.
조건Condition memset의 두번 째 인자가 단일 상수가 아닌 경우if the second argument of memset is not a single constant
대안타입Alternative type REPLACEREPLACE
대안코드Alternative code [3] memset(buf, 0, (l * 2) + 1);[3] memset (buf, 0, (l * 2) + 1);
유의사항Notice 없음none
예제 3의 경우, 효과가 없는 함수 호출을 검사하는 체커이다. 예를들어, memset에서 세번째 인자의 값이 0인 경우 실질적으로 의미가 없는 코드가 되게 된다. 대안1은 초기화하려는 버퍼의 사이즈를 추론 가능한 경우 그 사이즈를 표시하고, 추론할 수 없는 경우 <<length>> 등과 같은 지정된 식별자를 사용하여 표시한다. 대안2의 경우 조건부로 생성하는 대안이다. 만약 memset의 두번째 인자가 단일 상수가 아닌 경우는 2, 3번째 인자를 바꿔 사용하였을 가능성이 있다. 따라서 대안2는 memset의 2, 3번째 인자값들을 서로 교체하는 것을 제안하도록 한다. 해당 체커 역시 특별한 유의사항은 없다.For example 3, this is a checker that checks for ineffective function calls. For example, if the value of the third argument in memset is 0, it will be practically meaningless code. Alternative 1 displays the size of the buffer to be initialized if it can be inferred, and if it cannot be inferred, using a specified identifier such as << length >> or the like. Alternative 2 is a conditional alternative. If the second argument of memset is not a single constant, the second and third arguments may be used interchangeably. Therefore, alternative 2 suggests swapping the second and third parameter values of memset. The checker also has no special note.
일예로, 상기 표 2 내지 표 4에 예시된 각 체커의 대안은 상기 도 9를 통해 예시된 'Sca' 클래스 및 'ScaAlternative' 클래스(대안 정보 클래스)에 의해 제공될 수 있다. For example, alternatives to each checker illustrated in Tables 2 to 4 may be provided by the 'Sca' class and the 'ScaAlternative' class (alternative information class) illustrated through FIG. 9.
다른 예로, 상기 표 2 내지 표 4에 예시된 각 체커의 대안 코드는 상기 도 10을 통해 예시된 'CodeGenerator' 클래스(코드 생성 클래스)에 의해 제공될 수 있다. As another example, the alternative code of each checker illustrated in Tables 2 to 4 may be provided by the 'CodeGenerator' class (code generation class) illustrated through FIG. 10.
'Sca' 클래스, 'ScaAlternative' 클래스(대안 정보 클래스) 및 'CodeGenerator' 클래스(코드 생성 클래스) 들은 각 체커의 결함 내용에 상응하여 미리 설정될 수 있다. The 'Sca' class, the 'ScaAlternative' class (alternative information class), and the 'CodeGenerator' class (code generation class) can be preset according to the defect content of each checker.
본 발명의 실시예 들은 다양한 컴퓨터로 구현되는 동작을 수행하기 위한 프로그램과 이를 기록한 컴퓨터 판독가능 매체를 포함한다. 상기 컴퓨터 판독 가능 매체는 프로그램 명령, 데이터 파일, 데이터 구조 등을 단독으로 또는 조합하여 포함할 수 있다. 상기 매체는 본 발명을 위하여 특별히 설계되고 구성된 것들이거나 컴퓨터 소프트웨어 당업자에게 공지되어 사용 가능한 것일 수도 있다. 컴퓨터 판독 가능 기록 매체의 예에는 하드 디스크, 플로피 디스크 및 자기 테이프와 같은 자기 매체, CD-ROM, DVD, USB 드라이브와 같은 광기록 매체, 플롭티컬 디스크와 같은 자기-광 매체, 및 롬, 램, 플래시 메모리 등과 같은 프로그램 명령을 저장하고 수행하도록 특별히 구성된 하드웨어 장치가 포함된다. 상기 매체는 프로그램 명령, 데이터 구조 등을 지정하는 신호를 전송하는 반송파를 포함하는 광 또는 금속선, 도파관 등의 전송 매체일 수도 있다. 프로그램 명령의 예에는 컴파일러에 의해 만들어지는 것과 같은 기계어 코드뿐만 아니라 인터프리터 등을 사용해서 컴퓨터에 의해서 실행될 수 있는 고급 언어 코드를 포함한다.Embodiments of the present invention include a program for performing various computer-implemented operations and a computer readable medium recording the same. The computer readable medium may include program instructions, data files, data structures, etc. alone or in combination. The media may be those specially designed and constructed for the purposes of the present invention, or they may be of the kind well-known and available to those having skill in the computer software arts. Examples of computer readable recording media include magnetic media such as hard disks, floppy disks and magnetic tape, optical recording media such as CD-ROM, DVD, USB drives, magnetic-optical media such as floppy disks, and ROM, RAM, Hardware devices specifically configured to store and execute program instructions, such as flash memory, are included. The medium may be a transmission medium such as an optical or metal wire, a waveguide, or the like including a carrier wave for transmitting a signal specifying a program command, a data structure, or the like. Examples of program instructions include not only machine code generated by a compiler, but also high-level language code that can be executed by a computer using an interpreter or the like.
일예로, 본 발명의 소스 코드 분석 장치는, 소스 코드 분석 기능 및 분석 결과 출력 기능을 실행하기 위한 컴퓨터 프로그램에 의해 컴퓨터의 기능 동작이 실행되는 형태로 구현될 수 있다. For example, the source code analysis apparatus of the present invention may be implemented in a form in which a functional operation of a computer is executed by a computer program for executing a source code analysis function and an analysis result output function.
소스 코드 분석 기능은 상술한 소스 코드 분석 모듈에 의해 제공되며, 분석 결과 출력 기능은 상술한 분석 결과 출력 모듈에 의해 제공된다. The source code analysis function is provided by the above-described source code analysis module, and the analysis result output function is provided by the above-described analysis result output module.
소스 코드 분석 기능은 소스 코드 분석 모듈의 세부 기능을 더욱 실행하고, 분석 결과 출력 기능은 분석 결과 출력 모듈의 세부 기능을 더욱 실행함으로써, 본 발명의 소스 코드 분석 장치의 전체 기능이 제공될 수 있다. The source code analysis function further executes the detailed function of the source code analysis module, and the analysis result output function further executes the detailed function of the analysis result output module, whereby the entire function of the source code analysis device of the present invention can be provided.

Claims (7)

  1. 소스 코드로부터 분석에 필요한 정보들을 추출하고 정제하는 구문 분석부와, 구문 분석부에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보를 검출하는 결함 검출부와, 결함 검출부에서 검출된 결함 정보 및 구문 분석부에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보 및 유의사항 정보 중 적어도 하나를 생성하는 수정예시 생성부와, 생성된 결함 정보 및 수정예시 정보, 유의사항 정보 중 적어도 하나 이상을 종합 분석 결과 정보로 구성하여 분석 결과 출력 모듈로 전달하는 분석결과 전달부를 포함하는 소스 코드 분석 모듈; 및 A parsing unit for extracting and refining information required for analysis from source code, a defect detection unit for detecting defect information that may be a problem in source code based on the information required for analysis refined by the parsing unit, and a defect detection unit A modification example generation unit that generates at least one of correction example information and notice information based on the detected defect information and information necessary for analysis refined by the parser, and at least one of generated defect information, correction example information, and notice information. A source code analysis module including an analysis result delivery unit configured to configure the above as the comprehensive analysis result information and delivering the analysis result output module; And
    소스 코드 분석 모듈로부터 전달받은 종합 분석 결과 정보에서 결함 정보를 추출하여 출력하는 결함 출력부와, 소스 코드 분석 모듈로부터 전달받은 종합 분석 결과 정보에서 수정예시 정보 및 유의사항 정보 중 적어도 하나를 추출하여 출력하는 수정예시 출력부를 포함하는 분석 결과 출력 모듈;을 포함하여 구성된 소스 코드 분석 장치.The defect output unit extracts and outputs defect information from the comprehensive analysis result information received from the source code analysis module, and extracts and outputs at least one of correction example information and notice information from the comprehensive analysis result information received from the source code analysis module. And an analysis result output module including a modified example output unit.
  2. 제1항에 있어서, The method of claim 1,
    상기 수정예시 생성부는, The modification example generation unit,
    하나의 결함 정보에 대하여 하나 또는 그 이상의 수정예시 정보 또는 유의사항 정보를 생성하도록 구성된 것을 특징으로 하는 소스 코드 분석 장치.And generate one or more correction example information or notice information for one defect information.
  3. 제2항에 있어서, The method of claim 2,
    상기 결함 검출부의 결함 정보 검출은 각각의 결함 여부를 체크하도록 구비된 각각의 체커의 기능 실행에 의해 이뤄지며, Defect information detection of the defect detection unit is performed by the function execution of each checker provided to check each defect or not,
    상기 각각의 체커는 결함 정보 검출 시에 검출된 결함 정보에 대하여 생성될 수정예시 정보 및 유의사항 정보 중 적어도 하나가 포함된 종합 분석 결과 정보를 수정예시 생성부로 전달하도록 구성된 것을 특징으로 하는 소스 코드 분석 장치.The checkers may be configured to deliver comprehensive analysis result information including at least one of correction example information and notice information to be generated with respect to defect information detected at the time of detecting the defect information to the modification example generation unit. Device.
  4. 제1항에 있어서, The method of claim 1,
    상기 수정예시 정보는, The modified example information,
    결함 정보가 검출된 소스 코드 라인에 대하여 다른 코드 라인의 '추가', 다른 코드 라인으로의 '변경', 검출된 코드 라인의 '삭제' 중의 적어도 어느 하나를 포함하는 것을 특징으로 하는 소스 코드 분석 장치.A source code analysis device comprising at least one of 'addition' of another code line, 'change' to another code line, and 'delete' of the detected code line with respect to the source code line where the defect information is detected .
  5. 제3항에 있어서, The method of claim 3,
    상기 수정예시 정보에 포함되는 수정예시 코드는, Modification example code included in the modification example information,
    결함 정보를 검출한 체커가 미리 설정된 템플릿에 따라 소스 코드를 분석 및 추론한 결과를 입력값으로 하여 생성되는 것을 특징으로 하는 소스 코드 분석 장치.And a checker for detecting defect information is generated based on a result of analyzing and inferring source code according to a preset template.
  6. 소스 코드 분석 장치에서 소스 코드 분석 기능 및 분석 결과 출력 기능을 실행하기 위한 컴퓨터 프로그램으로서, A computer program for executing a source code analysis function and an analysis result output function in a source code analysis device,
    상기 소스 코드 분석 기능은, The source code analysis function,
    소스 코드로부터 분석에 필요한 정보들을 추출하고 정제하는 구문 분석 기능과, 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보를 검출하는 결함 검출 기능과, 결함 검출 기능에서 검출된 결함 정보 및 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보 및 유의사항 정보 중 적어도 하나를 생성하는 수정예시 생성 기능과, 생성된 결함 정보 및 수정예시 정보, 유의사항 정보 중 적어도 하나 이상을 종합 분석 결과 정보로 구성하여 분석 결과 출력 기능으로 전달하는 분석결과 전달 기능을 포함하여 실행하며; Parsing function that extracts and refines information needed for analysis from source code, defect detection function that detects defect information that may be a problem in source code based on information necessary for analysis that is parsed in parsing function, and defect detection function A correction example generation function that generates at least one of correction example information and notice information based on defect information detected by the parser and information necessary for analysis refined by the parsing function, among the generated defect information, correction example information, and notice information. Including at least one analysis result delivery function configured to form at least one or more analysis result information and delivering the result to an analysis result output function;
    상기 분석 결과 출력 기능은, The analysis result output function,
    소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 결함 정보를 추출하여 출력하는 결함 출력 기능과, 소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 수정예시 정보 및 유의사항 정보 중 적어도 하나를 추출하여 출력하는 수정예시 출력 기능을 포함하여 실행하기 위하여; 매체에 저장된 컴퓨터 프로그램.The defect output function extracts and outputs defect information from the comprehensive analysis result information received from the source code analysis function, and extracts and outputs at least one of correction example information and notice information from the comprehensive analysis result information received from the source code analysis function. To execute a modified example output function; Computer program stored on media.
  7. 소스 코드 분석 장치에서 소스 코드 분석 기능 및 분석 결과 출력 기능을 실행하기 위한 컴퓨터 프로그램이 기록된 기록 매체로서, A recording medium on which a computer program for executing a source code analysis function and an analysis result output function in a source code analysis apparatus is recorded.
    상기 소스 코드 분석 기능은, The source code analysis function,
    소스 코드로부터 분석에 필요한 정보들을 추출하고 정제하는 구문 분석 기능과, 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 소스 코드에서 문제가 될 수 있는 결함 정보를 검출하는 결함 검출 기능과, 결함 검출 기능에서 검출된 결함 정보 및 구문 분석 기능에서 정제된 분석에 필요한 정보들을 토대로 수정예시 정보 및 유의사항 정보 중 적어도 하나를 생성하는 수정예시 생성 기능과, 생성된 결함 정보 및 수정예시 정보, 유의사항 정보 중 적어도 하나 이상을 종합 분석 결과 정보로 구성하여 분석 결과 출력 기능으로 전달하는 분석결과 전달 기능을 포함하여 실행하며; Parsing function that extracts and refines information needed for analysis from source code, defect detection function that detects defect information that may be a problem in source code based on information necessary for analysis that is parsed in parsing function, and defect detection function A correction example generation function that generates at least one of correction example information and notice information based on defect information detected by the parser and information necessary for analysis refined by the parsing function, among the generated defect information, correction example information, and notice information. Including at least one analysis result delivery function configured to form at least one or more analysis result information and delivering the result to an analysis result output function;
    상기 분석 결과 출력 기능은, The analysis result output function,
    소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 결함 정보를 추출하여 출력하는 결함 출력 기능과, 소스 코드 분석 기능으로부터 전달받은 종합 분석 결과 정보에서 수정예시 정보 및 유의사항 정보 중 적어도 하나를 추출하여 출력하는 수정예시 출력 기능을 포함하여 실행하기 위한; 컴퓨터 프로그램이 기록된, 컴퓨터로 판독 가능한 기록 매체.The defect output function extracts and outputs defect information from the comprehensive analysis result information received from the source code analysis function, and extracts and outputs at least one of correction example information and notice information from the comprehensive analysis result information received from the source code analysis function. To execute a modified example output function; A computer readable recording medium having a computer program recorded thereon.
PCT/KR2015/008937 2014-08-27 2015-08-26 Source code analysis device, computer program for same, and recording medium thereof WO2016032234A1 (en)

Priority Applications (3)

Application Number Priority Date Filing Date Title
CN201580046317.1A CN106796543A (en) 2014-08-27 2015-08-26 Source code analysis device, computer program and its recording medium for the device
JP2017510645A JP6579340B2 (en) 2014-08-27 2015-08-26 Source code analysis apparatus, computer program therefor, and recording medium therefor
US15/505,669 US10496516B2 (en) 2014-08-27 2015-08-26 Source code analysis device, computer program for same, and recording medium thereof

Applications Claiming Priority (4)

Application Number Priority Date Filing Date Title
KR10-2014-0112583 2014-08-27
KR20140112583 2014-08-27
KR10-2014-0133347 2014-10-02
KR1020140133347A KR101623174B1 (en) 2014-08-27 2014-10-02 Source code analysis apparatus, Computer program for the same, Recording medium storing computer program for the same

Publications (1)

Publication Number Publication Date
WO2016032234A1 true WO2016032234A1 (en) 2016-03-03

Family

ID=55400047

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/KR2015/008937 WO2016032234A1 (en) 2014-08-27 2015-08-26 Source code analysis device, computer program for same, and recording medium thereof

Country Status (1)

Country Link
WO (1) WO2016032234A1 (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857641A (en) * 2018-12-29 2019-06-07 北京奇安信科技有限公司 The method and device of defects detection is carried out to program source file
CN110134435A (en) * 2019-05-29 2019-08-16 北京百度网讯科技有限公司 A kind of code repairs case acquisition methods, device, equipment and storage medium

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010011036A (en) * 1999-07-24 2001-02-15 윤종용 Interpreter type control program developing method and system
KR100501936B1 (en) * 2003-05-07 2005-07-18 삼성전자주식회사 System and method for source code checking
KR20110020520A (en) * 2009-08-24 2011-03-03 한국전력기술 주식회사 Software safety analysis method and system integrated with software develpoment
KR101051600B1 (en) * 2010-03-29 2011-07-22 주식회사 소프트 포 소프트 Systems for performing code inspection on abap source code
JP2012103923A (en) * 2010-11-10 2012-05-31 Renesas Electronics Corp Compiler device, compiling method and compiler program

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20010011036A (en) * 1999-07-24 2001-02-15 윤종용 Interpreter type control program developing method and system
KR100501936B1 (en) * 2003-05-07 2005-07-18 삼성전자주식회사 System and method for source code checking
KR20110020520A (en) * 2009-08-24 2011-03-03 한국전력기술 주식회사 Software safety analysis method and system integrated with software develpoment
KR101051600B1 (en) * 2010-03-29 2011-07-22 주식회사 소프트 포 소프트 Systems for performing code inspection on abap source code
JP2012103923A (en) * 2010-11-10 2012-05-31 Renesas Electronics Corp Compiler device, compiling method and compiler program

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109857641A (en) * 2018-12-29 2019-06-07 北京奇安信科技有限公司 The method and device of defects detection is carried out to program source file
CN109857641B (en) * 2018-12-29 2022-09-13 奇安信科技集团股份有限公司 Method and device for detecting defects of program source file
CN110134435A (en) * 2019-05-29 2019-08-16 北京百度网讯科技有限公司 A kind of code repairs case acquisition methods, device, equipment and storage medium
CN110134435B (en) * 2019-05-29 2023-01-10 北京百度网讯科技有限公司 Code repair case acquisition method, device, equipment and storage medium

Similar Documents

Publication Publication Date Title
US9389849B2 (en) Test case pattern matching
Linsbauer et al. Recovering traceability between features and code in product variants
US20060064677A1 (en) Debugger and method for debugging computer programs across multiple programming languages
CN104866734B (en) A kind of guard method of DEX file and device
US8954940B2 (en) Integrating preprocessor behavior into parsing
WO2013191458A1 (en) License verification method and apparatus, and computer readable storage medium storing program therefor
KR101623174B1 (en) Source code analysis apparatus, Computer program for the same, Recording medium storing computer program for the same
WO2016032234A1 (en) Source code analysis device, computer program for same, and recording medium thereof
US20090297043A1 (en) Pattern scanner and editor for security audit systems
GB2522628A (en) Software tracing using extensible markup language messages
JP2010140408A (en) Source code converting device
Kaplan et al. CUPV—a visualization tool for generated parsers
WO2018080009A1 (en) Electronic apparatus for recording debugging information and control method thereof
US8578323B2 (en) Hierarchical program source management
US6611924B1 (en) Reducing code size of debug output statements
WO2012169708A1 (en) Method and apparatus for converting metadata
WO2016137035A1 (en) Test case generation device and method, and computer-readable recording medium for recording program for executing same
JP2010287101A (en) Software debugging device and method
WO2016085213A1 (en) Computer-executable model reverse engineering method and apparatus
Omori et al. Comparative study between two approaches using edit operations and code differences to detect past refactorings
US10937203B1 (en) Devices, systems, and methods for integrated circuit verification
WO2022149674A1 (en) Electronic apparatus and controlling method thereof
WO2018190487A1 (en) Visualization method for trace analysis of test case design information, test case generation device, and computer-readable recording medium
JP6945434B2 (en) Software development equipment, software development methods and software development programs
KR101276933B1 (en) Conditional block source code display method for displaying selected version&#39;s conditional block source code

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 15835882

Country of ref document: EP

Kind code of ref document: A1

ENP Entry into the national phase

Ref document number: 2017510645

Country of ref document: JP

Kind code of ref document: A

WWE Wipo information: entry into national phase

Ref document number: 15505669

Country of ref document: US

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 15835882

Country of ref document: EP

Kind code of ref document: A1