JP5188421B2 - Source code analysis method and source code analysis support system - Google Patents
Source code analysis method and source code analysis support system Download PDFInfo
- Publication number
- JP5188421B2 JP5188421B2 JP2009045052A JP2009045052A JP5188421B2 JP 5188421 B2 JP5188421 B2 JP 5188421B2 JP 2009045052 A JP2009045052 A JP 2009045052A JP 2009045052 A JP2009045052 A JP 2009045052A JP 5188421 B2 JP5188421 B2 JP 5188421B2
- Authority
- JP
- Japan
- Prior art keywords
- source code
- analysis result
- analysis
- output
- information
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
Images
Description
本発明は、ソースコード解析方法、およびこれを実施するソースコード解析支援システムに関する。 The present invention relates to a source code analysis method and a source code analysis support system that implements the method.
従来、複数のソースコードに跨る静的解析において、静的解析時に必要な全てのソースコードの解析を行うのではなく、サーバで管理されているコミット済みのソースコードに対して、サーバ上で事前処理として静的解析を実施し、実際の解析時には、サーバにおいてこの事前処理の結果に基づいて静的解析を実施するソースコード解析システムが知られている(例えば、特許文献1参照)。 Conventionally, in static analysis across multiple source codes, instead of analyzing all the source code necessary for static analysis, the server does not perform all of the source code that is already managed on the server in advance. A source code analysis system that performs static analysis as processing and performs static analysis on the basis of the result of this pre-processing in a server at the time of actual analysis is known (for example, see Patent Document 1).
また、従来のソースコード解析システムでは、ソースコードの静的解析の結果、エラーが検出されれば、警告が出力される。開発者は、この警告により、エラーが発生したソースコードを修正する。しかし、エラーの中には、必ずしも修正しなくても良い場合がある。これは、あるコーディングが好ましくない書式で記述されていたとしても、プロジェクトの特性からそう記述しなければならないなどの状況が発生するためである。しかし、従来では、検出されたエラーに対して、各開発者のスキルや裁量で修正要否を判断していた。このため、ソースコードの品質が開発者に依存し、開発者によって品質にバラツキが生じていた。この問題を解決する技術として、ソースコード解析システムによって出力された警告に対して、どの警告に関するエラーを修正すべきかという優先度を自動的に付与することにより、判断基準が統一できるとともに開発者による修正要否の判断が容易になり、開発者の作業負荷軽減を図る技術が知られている(例えば、特許文献2参照)。 In the conventional source code analysis system, if an error is detected as a result of static analysis of the source code, a warning is output. With this warning, the developer corrects the source code in which the error occurred. However, some errors do not necessarily have to be corrected. This is because even if a certain coding is described in an unfavorable format, a situation arises in which it is necessary to describe so from the characteristics of the project. However, conventionally, it has been determined whether or not a detected error needs to be corrected based on the skill and discretion of each developer. For this reason, the quality of the source code depends on the developer, and the quality varies depending on the developer. As a technology to solve this problem, the warnings output by the source code analysis system are automatically assigned a priority to which error should be corrected. A technique for facilitating determination of whether correction is necessary and reducing the workload of a developer is known (see, for example, Patent Document 2).
しかしながら、上記の従来技術には、以下に示すような問題点がある。 However, the above prior art has the following problems.
まず、特許文献1に記載の技術では、サーバに登録済みのソースコードに対して、テスト工程にて不良が発生したなどの理由によりソースコードの修正が発生した場合、サーバに蓄積されているソースコードおよび事前処理結果が、修正中のソースコードと整合性が取れない場合がある。この場合、修正中のソースコードをサーバに一度登録した上で、他のソースコードの解析処理を実施する必要があるため、開発者に作業負荷がかかる。また、ソースコードの解析結果が、サーバで実施されている事前処理結果に対して変更(ソースコード単体で解析した場合は指摘対象となる箇所が、関連するプログラムを通して解析した場合、指摘対象外となる場合など)が発生した場合、ソースコード解析の再実行が必要になる。
First, in the technique described in
また、特許文献2に記載の技術では、出力される警告の件数自体は変わらないため、膨大に出力される警告に対する修正要否を判断する開発者の作業負荷は変わらない。また、上述のように警告が出力されても、プロジェクトの特性によっては、コーディングルール上問題が無いため、修正不要なエラーがある。したがって、開発者の負荷軽減の観点から、このようなエラーは解析結果として出力させないよう制御することが望ましいが、特許文献2にはこの点について言及されていない。
Further, in the technique described in
本発明は、上記に鑑みてなされたものであり、ソフトウェア開発時のソースコード解析作業において、開発者の作業負荷軽減を図るとともに、精度の高いソースコード解析を行えるソースコード解析方法、およびこれを実施するソースコード解析支援システムを提供することを目的とする。 The present invention has been made in view of the above, and a source code analysis method capable of reducing a developer's work load and performing highly accurate source code analysis in a source code analysis work during software development. An object is to provide a source code analysis support system to be implemented.
上述した課題を解決するために、本発明は、例えば、コンピュータにより実施されるソースコード解析方法であって、入力部を介してソースコードを受信する処理と、該受信したソースコードから、関数および変数の参照関係を示すソースコード関連情報を抽出して、記憶部に格納する処理と、前記受信したソースコードとあらかじめ規定されたソースコードのコーディングルールに基づいて、前記ソースコードが前記コーディングルールに準拠しているかどうかを解析する処理と、該解析の結果、前記ソースコードが前記コーディングルールに準拠していない場合、該解析結果、前記ソースコードに記述されたファイル名および該当コーディングルール情報を前記記憶部に格納する処理と、前記記憶部からソースコード関連情報および前記解析結果に基づき、該解析結果の変更要否を判定する処理と、前記解析結果の変更が必要な場合に、前記判定処理の結果に基づき、前記記憶部に記憶されている前記解析結果を変更する処理と、前記記憶部に記憶されており前記準拠していないコーディングルールごとに前記解析結果の出力要否を規定した出力制御情報に基づき前記解析結果を出力部に出力する処理と、前記出力された解析結果の出力要否の変更を受付け、当該変更にかかる解析結果のコーディングルールについての前記出力制御情報の出力要否を変更する処理と、を実施することを特徴とする。 In order to solve the above-described problem, the present invention provides a source code analysis method implemented by, for example, a computer, a process of receiving a source code via an input unit, a function and a function from the received source code Based on a process of extracting source code related information indicating a variable reference relationship and storing it in a storage unit, and the received source code and a pre-defined source code coding rule, the source code is converted into the coding rule. If the source code does not comply with the coding rule as a result of the analysis of whether or not it conforms, the analysis result, the file name described in the source code and the corresponding coding rule information are Processing to store in the storage unit, source code related information from the storage unit and the Based on the analysis result, when the analysis result needs to be changed, and when the analysis result needs to be changed, the analysis result stored in the storage unit is changed based on the result of the determination process. Processing to output the analysis result to the output unit based on output control information that defines the necessity of output of the analysis result for each non-compliant coding rule stored in the storage unit, and the output And changing the necessity of outputting the output control information for the coding rule of the analysis result according to the change .
本発明によれば、ソフトウェア開発時のソースコード解析作業において、開発者の作業
負荷軽減を図るとともに、精度の高いソースコードの解析を行うことができるソースコー
ド解析方法およびこれを実施するソースコード解析支援システムを提供することができ
る。
ADVANTAGE OF THE INVENTION According to this invention, in the source code analysis work at the time of software development, while reducing the workload of a developer, the source code analysis method which can analyze a source code with high precision, and the source code analysis which implements this A support system can be provided.
本発明の実施形態について、図面を参照して詳細に説明する。 Embodiments of the present invention will be described in detail with reference to the drawings.
図1は、ソースコード解析支援システムの全体構成図である。 FIG. 1 is an overall configuration diagram of a source code analysis support system.
ソースコード解析支援システム100は、例えば、一般的な計算機で実現され、CPU、CPUが実行するプログラムや各種データを記憶する記憶装置、キーボード・マウス等の入力装置、ディスプレイ等の出力装置を有する。ソースコード解析支援システム100の記憶装置には、ソースコード解析手段101、ソースコード情報抽出手段102、解析情報連結手段103、結果出力手段104からなるプログラムが記憶されている。また、上記記憶装置には、解析対象となるソースコード105について関数や変数の命名規則や使用禁止命令などが規定されたコーディングルール106、前記ソースコード解析手段101により生成される解析結果情報107、前記ソースコード情報抽出手段により生成されるソースコード関連情報108、前記結果出力手段104により生成される出力制御情報109が記憶されている。
The source code
ソースコード解析手段101は、ソースコード105の解析処理を実施するに当たり、ソースコード情報抽出手段102を呼び出して実行し、ソースコード105における関数間の呼出関係および関数内で使用される変数の参照関係を示すソースコード関連情報108を生成する。また、ソースコード解析手段101は、前記ソースコード関連情報108を生成後、ソースコードに対する関数や変数の命名規則や使用禁止命令などを記憶するコーディングルール106と、前記ソースコード関連情報108に基づいて、入力装置を介して入力されたソースコード105がコーディングルール106に準拠しているかを解析する。ここで、ソースコード関連情報108とソースコード105とを関連づけるため、ソースコード関連情報108には、ソースコードにおける関数間の呼出関係および関数内で使用される変数の参照関係を示す情報が含まれる。
The source
例えば、入力装置を介して入力されたソースコード105に、前記コーディングルール106で規定されている使用禁止命令が存在した場合、この部分がコーディングルール106に違反している箇所として検出される。また、ソースコード解析手段101は、ソースコード105で初期化されていない変数を発見した場合、記憶装置に記憶されている前記ソースコード関連情報108を参照し、初期化されていない変数に関する参照情報が存在しないかを確認する。確認した結果、同じ変数に対する更新情報が存在した場合、ソースコード解析手段101は、ソースコード105で発見した初期化されていない変数は、初期化済みであると判断し、違反箇所として検出しない。なお、上記確認の結果、同じ変数に対する更新情報が存在しない場合には、ソースコード解析手段101は、ソースコード105で発見した初期化されていない変数を、初期化漏れ変数として検出する。ソースコード解析手段101は、ソースコード105の解析処理終了後、ソースコード解析結果を示す解析結果情報107を生成し、記憶装置に記憶する。また、ソースコード解析手段101は、前記解析結果情報107から、入力装置を介して入力されたソースコード105について、過去に解析したことがあるかどうかを判定し、その判定の結果、過去に解析したことがあった場合には、入力されたソースコード105の解析処理を実施するかどうかを開発者110に確認させるための画面を出力装置へ出力する手段を有する。
For example, when the use prohibition instruction defined in the
ソースコード情報抽出手段102は、ソースコード105の解析時に、ソースコード解析手段101によって呼び出され実行されるプログラムであり、ソースコード105における関数間の呼出関係および関数内で使用される変数の参照関係を示すソースコード関連情報108を生成し、これを記憶装置に記憶する。
The source code
例えば、ソースコード情報抽出手段102は、ソースコード105を参照し、関数呼び出し箇所を検索する。関数呼び出し箇所を発見した場合、ソースコード情報抽出手段102は、呼び出される関数名、関数に引数として使用さている変数、戻り値として使用されている変数に関する情報を抽出する。また、ソースコード情報抽出手段102は、ソースコード105で使用されている変数についても検索を行い、変数名、参照箇所、参照種別(参照/更新など)に関する情報も抽出する。ソースコード情報抽出手段102は、上記抽出した情報をソースコード関連情報108として記憶する。
For example, the source code
解析情報連結手段103は、入力装置を介して入力されたソースコード105に対して生成されたソースコード関連情報108から、記憶装置に記憶している解析結果情報107を更新すべきかを判断すると共に、更新する必要がある場合は、記憶装置に記憶している解析結果情報107を更新する。ここで、ソースコード関連情報108と解析結果情報107を関連づけるため、解析結果情報107には、コーディングルール106に準拠していない関数、変数の参照関係、使用箇所を示す情報が含まれる。
The analysis information linking means 103 determines whether or not the analysis result
例えば、解析情報連結手段103は、記憶装置に記憶されている解析結果情報107に、初期化漏れの変数として記憶されている情報に対して、新たに解析したソースコード105について生成されたソースコード関連情報108を参照し、同じ変数に対する更新情報(初期化されている箇所)が存在するかを検索する。ここで、更新情報を発見した場合、解析情報連結手段103は、解析結果情報107に記憶されている変数の初期化漏れの情報を削除する必要があると判断し、変数の初期化漏れの情報を、記憶装置に記憶している解析結果情報107から削除する。
For example, the analysis
結果出力手段104は、記憶装置に記憶している解析結果情報107を、出力制御情報に基づき出力装置に出力するかどうかを判断し、出力する場合には、該当解析結果情報107を出力装置に出力する。また、開発者110から、解析結果の出力内容に対する変更要求を入力装置を介して受け付けると、結果出力手段104は、この変更要求に応じて出力制御情報109を更新する。ここで、出力制御情報109と解析結果情報107を関連づけるため、出力制御情報109には、コーディングルール106に準拠していないソースコードの箇所と、該当するコーディングルール106の内容(ルールNOなど)の情報が含まれる。
The result output means 104 determines whether or not to output the analysis result
例えば、記憶装置に記憶している解析結果情報107に、1件以上の情報が記憶されている場合、結果出力手段104は、出力装置に出力する前に出力制御情報109を参照し、例えば、1件のみ出力するよう指定されている場合には、その指定されている解析結果情報107の1件のみを出力装置に出力する。また、1件以上出力するよう変更したい場合には、開発者110は、入力装置を用いて出力内容の変更を行うことができる。この場合、結果出力手段104は、入力装置を介して受け取った変更内容に応じて出力制御情報109を更新する。
For example, when one or more pieces of information are stored in the analysis result
次に、本実施形態に係るソースコード解析支援システムの処理の流れを、図2に示す処理手順に沿って説明する。 Next, the processing flow of the source code analysis support system according to the present embodiment will be described along the processing procedure shown in FIG.
まず、ソースコード解析手段101は、記憶装置に記憶されている解析結果情報107に基づいて、入力装置を介して入力されたソースコード105について既に解析したことがあるかどうかを判定する(ステップS200)。ソースコード解析手段101は、判定する際、ソースコード105に対する解析処理を実行した日時と、解析結果情報107に含まれる解析日時とを比較し、解析結果情報107に含まれる解析日時が解析処理実行日時より古い場合には、上記入力されたソースコード105は既に解析済みのソースコードと判断し、ステップ201に移る。また、ソースコード105に対する解析処理を実行した日時と、解析結果情報107に含まれる解析日時とを比較し、解析結果情報107に含まれる解析日時と解析処理実行日時が同じ場合には、ソースコード解析手段101は、上記入力されたソースコード105が過去に解析されたことがないソースコードと判断し、ステップS202に移る。
First, the source
ステップ200の判定の結果、解析結果情報107に含まれる解析日時が解析処理実行日時より古い場合には次に、ソースコード解析手段101は、入力されたソースコード105の解析処理を実行するかどうかを開発者110に確認させるための画面を出力装置に出力する(ステップ201)。開発者110により入力装置を介して解析処理の実行が選択された場合、ソースコード解析手段101は、ステップ202に移り、解析処理の実行が選択されなかった場合、入力されたソースコード105に対する解析処理を終了する。
If the result of determination in
ステップ202に示すソースコード解析処理では、ソースコード解析手段101およびソースコード情報抽出手段102による、入力されたソースコード105を解析する処理を実施する。処理である。このステップ202に示すソースコード解析処理の詳細な処理内容を、図3を用いて説明する。
In the source code analysis process shown in step 202, a process of analyzing the
まず、ソースコード解析手段101は、ソースコード情報抽出手段102を呼び出す。ソースコード情報抽出手段102は、入力装置を介して入力されたソースコード105から、関数間の呼び出し関係および関数内で使用される変数の参照関係を示すソースコード関連情報108を抽出し、記憶装置に格納する(ステップ300)。
First, the source
次に、ソースコード解析手段101は、コーディングルール106およびステップ200で記憶装置に格納したソースコード関連情報108に基づいて、上記入力されたソースコード105がコーディングルール106に準拠しているかを確認し、その結果を記憶装置に格納する(ステップ301)。ソースコード解析手段101は、入力されたソースコード105について、コーディングルール106に準拠していない箇所を発見した場合、違反しているコーディングルールの内容およびソースコード内のコーディングルールに違反している行、コーディング内容を検出し、これを解析結果情報107として記憶装置に格納した後、ステップ203(図2)に移る。一方、ソースコード解析手段101は、上記入力されたソースコード105について、コーディングルール106に準拠していない箇所が存在しない場合、ステップ203に移る。
Next, the source
以下に、ソースコード解析手段101が実行するソースコード解析処理の具体例を説明する。ここで、例えば、図9に示すコーディングルールに則って、図6に示すソースコードを解析した場合、ソースコードの6800行目で禁止命令(例では、GO TO命令を指す)が記述されているため、ソースコード解析手段101は、図9に示すコーディングルールで規定されているルールID=A1001に違反していると判断し、ソースコードの6800行目をコーディングルールID=A1001違反箇所として検出し、該当ファイル名、該当コーディングルールIDおよび解析結果を含む解析結果情報107を記憶装置に格納する。また、ソースコードの4800行目と10000行目で変数=OUT-DATAが記述されているが、初期化が実施されておらず、コーディングルールで規定されているルールID=B2011に違反しているため、ソースコード解析手段101は、上記変数=OUT-DATAをコーディングルールID=B2011違反箇所として検出し、該当ファイル名、該当コーディングルールIDおよび解析結果を含む解析結果情報107を記憶装置に格納する。さらに、ソースコードの4800行目のIF命令について、END-IF命令が省略されており、図9のコーディングルールで規定されているルールID=A1101に違反しているため、ソースコード解析手段101は、ソースコードの4800行目のIF命令をコーディングルールID=A1101違反箇所として検出し、該当ファイル名、該当コーディングルールIDおよび解析結果を含む解析結果情報107を記憶装置に格納する。
A specific example of source code analysis processing executed by the source
また、例えば、図7に示すソースコードを解析した場合、図9に示すコーディングルールで規定するルールに違反する箇所は存在しないため、ソースコード解析手段101は、コーディングルールに違反する箇所は存在しない判断し、図7に示すソースコードの解析処理を終了する。
Further, for example, when the source code shown in FIG. 7 is analyzed, there is no part that violates the rule defined by the coding rule shown in FIG. 9, so the source
また、図8に示すソースコードを解析した場合、ソースコードの9200行目のEVALUATE命令について、WHEN OTHER句が省略されており、図9に示すコーディングルールで規定されているルールID=A1102に違反しているため、ソースコード解析手段101は、ソースコードの9200行目のEVALUATE命令をコーディングルールID=A1102違反箇所として検出し、該当ファイル名、該当コーディングルールIDおよび解析結果を含む解析結果情報107を記憶装置に格納する。また、ソースコードの9200行目で変数=OUT-DATAが記述されているが、初期化が実施されておらず、図9に示すコーディングルールで規定されているルールID=B2011に違反しているため、ソースコード解析手段101は、上記変数=OUT-DATAをコーディングルールID=B2011違反箇所として検出し、該当ファイル名、該当コーディングルールIDおよび解析結果を含む解析結果情報107を記憶装置に格納する。記憶装置に格納される解析結果情報107の例を図11に示す。
When the source code shown in FIG. 8 is analyzed, the WHEN OTHER clause is omitted for the EVALUATE instruction on the 9200th line of the source code, and the rule ID = A1102 defined in the coding rule shown in FIG. 9 is violated. Therefore, the source code analysis means 101 detects the EVALUATE instruction on the 9200th line of the source code as a coding rule ID = A1102 violation location, and the analysis result
図2に戻り説明を続ける。ステップ203に示す解析情報連結処理では、解析情報連結手段103にて、入力装置を介して新たに入力されたソースコードから、ソースコード情報抽出手段102によって抽出されたソースコード関連情報108に基づいて、記憶装置に記憶されている解析結果情報107の更新処理を実施する。以下、ステップ203に示す解析情報連結処理の詳細な処理内容を、図4を用いて説明する。
Returning to FIG. In the analysis information linking process shown in step 203, the analysis information linking means 103 is based on the source code related
まず、解析情報連結手段103は、記憶装置に記憶されているソースコード関連情報108および解析結果情報107に基づき、解析結果情報107を変更する必要があるかを判定する(ステップ400)。すなわち、解析情報連結手段103は、入力装置を介して新たに入力されたソースコード105から、ソースコード情報抽出手段102によって抽出されたソースコード関連情報108を元に、ソースコード解析手段101により記憶装置に格納された解析結果情報107の内容を精査する。解析情報連結手段103は、解析結果情報107の変更が必要と判断した場合、この解析結果情報107を変更する(ステップ401)。な、ステップ400において、解析結果情報107の変更が不要の場合には、解析情報連結手段103はと、ステップ204(図2)に移る。
First, the analysis
以下に、解析情報連結手段103が実行するソースコード解析処理の具体例を説明する。なお、ここでは、図10に示すソース関連情報108と図11に示す解析結果情報107を用いて説明する。
A specific example of the source code analysis process executed by the analysis
まず、解析結果情報連結手段103は、図11に示す解析結果情報107を参照し、例えば、ルールID=B2011(図13)に違反している変数OUT-DATAの初期化漏れに関するファイル名(TESTPG01、TESTPG03)を抽出する。次に、解析結果情報連結手段103は、ソースコード関連情報108(図10)を参照し、変数=OUT-DATAに関連づいている区分(変数の参照種別)および使用行番号(使用箇所に関する情報)を検索する。図10に示す例では、解析結果情報連結手段103は、変数=OUT-DATAについて、プログラム名=TESTPG02の8300行目が更新されていることを確認できる。これにより、解析結果情報連結手段103は、プログラム単体(TESTPG01、TESTPG03)で解析した場合、変数=OUT-DATAは初期化漏れとして検出されているが、関連するプログラム全体を通して解析した場合、変数=OUT-DATAは初期化処理が実施されていると確認できる。すなわち、解析結果情報連結手段103は、変数=OUT-DATAに対する初期化漏れという解析結果情報107は削除してよいと判断してこれを記憶装置から削除し、ステップ204(図2)に移る。削除後の解析結果情報107を図12に示す。
First, the analysis result information linking means 103 refers to the analysis result
図2に戻り説明を続ける。 Returning to FIG.
ステップ204に示す結果出力処理では、結果出力手段104にて、結果出力手段104にて生成される出力制御情報109に基づいて、ソースコード解析手段101により格納された解析結果情報107を出力装置に出力する処理を実施する。また、開発者110から、出力される解析結果情報107に対して出力内容の変更要求を入力装置を介して受信した場合、結果出力手段104は、その要求内容に応じて記憶装置に記憶されている出力制御情報109を更新する処理を実施する。以下、ステップ204に示す結果出力処理の詳細な処理内容を、図5を用いて説明する。
In the result output process shown in
まず、結果出力手段104は、記憶装置から解析結果情報107を読み出し、記憶装置に記憶されている出力制御情報109に基づいて出力要否を判定し、出力要の場合にその解析結果情報を出力装置に出力する(ステップ500)。具体例を挙げて説明する。図13に出力制御情報109の例を、図12に解析結果情報107の例を、それぞれ示す。
First, the result output means 104 reads the analysis result
結果出力手段104は、図13に示す出力制御情報109の解析結果の出力要否を示す情報を確認する。図13に示す例では、結果出力手段104は、TRUEが設定されている情報(ルールID=A1101、A1102、B2011が該当)とFALSEが設定されている情報(ルールID=A1001が該当)を確認する。次に、結果出力手段104は、図12に示す解析結果情報107を参照して、上記確認結果のうち、出力要否にTRUEが設定されていたルールID(A1101、A1102、B2011)を検索し、一致する情報を出力装置に出力する。図12に示す解析結果情報107の場合、ルールID=A1101、A1102に該当する情報が出力装置に出力される。その出力画面の例を図14に示す。 図5に戻り説明を続ける。
The result output means 104 confirms information indicating whether or not the analysis result of the output control information 109 shown in FIG. In the example shown in FIG. 13, the result output means 104 confirms information in which TRUE is set (rule ID = A1101, A1102, and B2011 are applicable) and information in which FALSE is set (rule ID = A1001 is applicable). To do. Next, the
ステップ500の処理後、開発者110が、プロジェクトの特性を考慮し、例えば、図14に示す該当ファイルについて、「出力する」または「出力しない」の何れかのボタンを入力装置を用いて押下する操作を行うと、結果出力手段10は、入力装置を介して解析結果情報の変更要求を受信し(ステップ501)、ステップ502に移る。なお、変更要求が無い場合には、結果出力手段10は、解析結果の出力処理を終了すると共に、ソースコードの解析処理を終了する。
After the processing of
次に、結果出力手段104は、ステップ501で受信した変更要求に従い、記憶装置に記憶されている該当出力制御情報109を更新する(ステップ502)。
Next, the
出力制御情報109の更新処理の具体例を説明する。例えば、結果出力手段104は、入力装置を介して、出力要(TRUE)に設定されていた、ルールID=A1101に対する解析結果情報を出力否(FALSE)へ変更する要求を受信した場合、記憶装置に記憶されている出力制御情報109から、ルールID=A1101に該当する情報を検索し、一致した情報の出力有無列の内容について、FALSEを設定する。 以上説明したように、上記実施例によれば、ソースコード解析にかかる処理時間の短縮を図ることが可能となる。これは、複数のプログラムに関連するソースコードを実施する場合など、ソースコード解析手段が記憶する解析結果情報およびソースコード情報抽出手段が記憶するソースコード関連情報に基づいて実施することにより、従来のように関連する全てのソースコードを取得および再度解析する作業が軽減されるためである。
A specific example of the update process of the output control information 109 will be described. For example, when the
また、上記実施例によれば、精度の高いソースコード解析を実施することが可能となる。すなわち、ソースコード解析による警告が膨大に出力されることを抑えることが可能となる。これは、ソースコード情報抽出手段が記憶するソースコード関連情報および前記ソースコード解析手段が記憶する解析結果情報の内容を更新する解析情報連結手段により、ソースコード解析時に参照している情報が常に更新・精査されているためである。 Further, according to the above embodiment, it is possible to perform source code analysis with high accuracy. That is, it is possible to suppress a large amount of warnings generated by source code analysis. This is because the information referred to at the time of source code analysis is always updated by the analysis information linking means for updating the contents of the source code related information stored in the source code information extraction means and the analysis result information stored in the source code analysis means・ Because it has been scrutinized.
また、上記実施例によれば、開発者に出力するソースコード解析の結果情報について、プロジェクトの特性に合わせた結果情報のみを出力することが可能となる。すなわち、出力されたソースコード解析の結果に対する開発者の修正要否作業の負荷軽減を図ることが可能となる。これは、開発者に対して前記解析結果情報を出力装置に出力するか出力しないかを入力させるための画面を出力装置に出力するようにしたためである。 Further, according to the above-described embodiment, only the result information that matches the characteristics of the project can be output as the result information of the source code analysis output to the developer. That is, it is possible to reduce the load of the developer's necessity of modification on the output source code analysis result. This is because a screen for allowing the developer to input whether the analysis result information is output to the output device or not is output to the output device.
100 ソースコード解析支援システム
101 ソースコード解析手段
102 ソースコード情報抽出手段
103 解析情報連結手段
104 解析結果出力手段
105 ソースコード
106 コーディングルール
107 解析結果情報
108 ソースコード関連情報
109 出力制御情報
110 開発者
DESCRIPTION OF
Claims (2)
入力部を介してソースコードを受信する処理と、
該受信したソースコードから、関数および変数の参照関係を示すソースコード関連情報を抽出して、記憶部に格納する処理と、
前記受信したソースコードとあらかじめ規定されたソースコードのコーディングルールに基づいて、前記ソースコードが前記コーディングルールに準拠しているかどうかを解析する処理と、
該解析の結果、前記ソースコードが前記コーディングルールに準拠していない場合、該解析結果、前記ソースコードに記述されたファイル名および該当コーディングルール情報を前記記憶部に格納する処理と、
前記記憶部からソースコード関連情報および前記解析結果に基づき、該解析結果の変更要否を判定する処理と、
前記解析結果の変更が必要な場合に、前記判定処理の結果に基づき、前記記憶部に記憶されている前記解析結果を変更する処理と、
前記記憶部に記憶されており前記準拠していないコーディングルールごとに前記解析結果の出力要否を規定した出力制御情報に基づき前記解析結果を出力部に出力する処理と、
前記出力された解析結果の出力要否の変更を受付け、当該出力要否変更にかかる解析結果のコーディングルールについての前記出力制御情報の出力要否を変更する処理と、
を実施することを特徴とするソースコード解析方法。 A source code analysis method implemented by a computer,
Processing to receive source code via the input unit;
Processing for extracting source code related information indicating a reference relationship between a function and a variable from the received source code and storing the information in a storage unit;
A process of analyzing whether the source code conforms to the coding rule based on the received source code and a predetermined coding rule of the source code;
As a result of the analysis, when the source code does not conform to the coding rule, the analysis result, a process of storing the file name described in the source code and the corresponding coding rule information in the storage unit;
Based on the source code related information and the analysis result from the storage unit, a process of determining whether the analysis result needs to be changed,
When the analysis result needs to be changed, based on the result of the determination process, a process of changing the analysis result stored in the storage unit;
A process of outputting the analysis result to the output unit based on output control information that defines the necessity of outputting the analysis result for each coding rule that is stored in the storage unit and does not comply with the coding rule ;
A process of accepting a change in the necessity of output of the output analysis result, and a process of changing the necessity of output of the output control information for the coding rule of the analysis result according to the change in the necessity of output;
The source code analysis method characterized by implementing.
前記制御部は、
前記入力部を介してソースコードを受信する手段と、
該受信したソースコードから、関数および変数の参照関係を示すソースコード関連情報を抽出して、前記記憶部に格納する手段と、
前記受信したソースコードとあらかじめ規定されたソースコードのコーディングルールに基づいて、前記ソースコードが前記コーディングルールに準拠しているかどうかを解析する手段と、
該解析の結果、前記ソースコードが前記コーディングルールに準拠していない場合、該解析結果、前記ソースコードに記述されたファイル名および該当コーディングルール情報を前記記憶部に格納する手段と、
前記記憶部からソースコード関連情報および前記解析結果に基づき、該解析結果の変更要否を判定する手段と、
前記解析結果の変更が必要な場合に、前記判定処理の結果に基づき、前記記憶部に記憶されている前記解析結果を変更する手段と、
前記記憶部に記憶されており前記準拠していないコーディングルールごとに前記解析結果の出力要否を規定した出力制御情報に基づき前記解析結果を前記出力部に出力する手段と、
前記出力された解析結果の出力要否の変更を受付け、当該出力要否変更にかかる解析結果のコーディングルールについての前記出力制御情報の出力要否を変更する手段と、
を有することを特徴とするコンピュータ。 A computer having an input unit, an output unit, a control unit and a storage unit,
The controller is
Means for receiving source code via the input unit;
Means for extracting source code related information indicating a reference relationship between functions and variables from the received source code, and storing the extracted information in the storage unit;
Means for analyzing whether the source code conforms to the coding rule based on the received source code and a predetermined coding rule of the source code;
As a result of the analysis, if the source code does not conform to the coding rule, means for storing the analysis result, a file name described in the source code and corresponding coding rule information in the storage unit;
Means for determining whether or not to change the analysis result based on the source code related information and the analysis result from the storage unit;
Means for changing the analysis result stored in the storage unit based on the result of the determination process when the analysis result needs to be changed;
Means for outputting the analysis result to the output unit based on output control information defining whether the analysis result is output for each non-compliant coding rule stored in the storage unit;
Means for accepting a change in output necessity of the output analysis result, and changing the necessity of output of the output control information for the coding rule of the analysis result relating to the output necessity change;
A computer comprising:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009045052A JP5188421B2 (en) | 2009-02-27 | 2009-02-27 | Source code analysis method and source code analysis support system |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2009045052A JP5188421B2 (en) | 2009-02-27 | 2009-02-27 | Source code analysis method and source code analysis support system |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2010198522A JP2010198522A (en) | 2010-09-09 |
JP5188421B2 true JP5188421B2 (en) | 2013-04-24 |
Family
ID=42823157
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2009045052A Expired - Fee Related JP5188421B2 (en) | 2009-02-27 | 2009-02-27 | Source code analysis method and source code analysis support system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP5188421B2 (en) |
Families Citing this family (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JP2013045307A (en) * | 2011-08-24 | 2013-03-04 | Nec Corp | Static analysis system, static analysis result display method and program |
JP6172946B2 (en) * | 2013-01-10 | 2017-08-02 | 株式会社富士通マーケティング | Source code conversion apparatus, source code conversion method, and source code conversion program |
KR20170115784A (en) * | 2016-04-08 | 2017-10-18 | (주)투비소프트 | Method for developing application based on script |
US11086604B2 (en) | 2017-11-21 | 2021-08-10 | Mitsubishi Electric Corporation | Source code splitting device, source code analyzing device, source code splitting method, and computer readable medium |
Family Cites Families (6)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
JPH0869380A (en) * | 1994-08-29 | 1996-03-12 | Fujitsu Ltd | Source program check device |
JP2000347894A (en) * | 1999-06-09 | 2000-12-15 | Fujitsu Ltd | Source program check device and program recording medium therefor |
JP2006018735A (en) * | 2004-07-05 | 2006-01-19 | Hitachi Software Eng Co Ltd | Coding standard observance situation monitoring system |
JP4667386B2 (en) * | 2004-09-24 | 2011-04-13 | 富士通株式会社 | Business model diagram creation support program, business model diagram creation support method, and business model diagram creation support device |
JP2006092475A (en) * | 2004-09-27 | 2006-04-06 | Hitachi Software Eng Co Ltd | Source code inspection system |
JP2008225519A (en) * | 2007-03-08 | 2008-09-25 | Nec Corp | Static analysis system, server, static analysis method and program |
-
2009
- 2009-02-27 JP JP2009045052A patent/JP5188421B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2010198522A (en) | 2010-09-09 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US8627289B2 (en) | Detecting configuration problems in an eclipse-based software application | |
JP5775829B2 (en) | Software structure visualization program and system | |
US9201757B2 (en) | Offline type checking in programming languages | |
US8904352B2 (en) | Systems and methods for processing source code during debugging operations | |
US10437815B2 (en) | Identification of code object dependencies | |
US7814471B2 (en) | Method and apparatus for providing DLL compatibility | |
JP2008191963A (en) | Source code verification system, source code verification method and source code verification program | |
US8898649B2 (en) | Application program analysis method, analysis system and recording medium for identifying a contributing factor for an invalid operation of an application program | |
US20180004508A1 (en) | Program code comparison and reporting | |
JP5188421B2 (en) | Source code analysis method and source code analysis support system | |
US9760470B2 (en) | Device, method, and program analysis of new source code to be added to execution program to check for bug | |
JP2017091208A (en) | Document inspection support device, document inspection support system, and program | |
CN106708897B (en) | Data warehouse quality guarantee method, device and system | |
EP3570173B1 (en) | Equivalence verification apparatus and equivalence verification program | |
JP4915362B2 (en) | Annotation automatic insertion method of static verification tool | |
KR20180129623A (en) | Apparatus for statically analyzing assembly code including assoxiated multi files | |
US9396239B2 (en) | Compiling method, storage medium and compiling apparatus | |
US20150082278A1 (en) | Clone detection method and clone function commonalizing method | |
JP5741265B2 (en) | Program improvement support system | |
JP2016057715A (en) | Graphic type program analyzer | |
CN111666216B (en) | Intelligent contract analysis method and device | |
JP2009169573A (en) | Analysis result output device and analysis result output method | |
US20220244938A1 (en) | Method and system for code maintenance | |
JP2008020972A (en) | Software analysis system | |
US20130246899A1 (en) | Drawing support apparatus, supporting method and drawing support program |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A621 | Written request for application examination |
Free format text: JAPANESE INTERMEDIATE CODE: A621 Effective date: 20110915 |
|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20121004 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20121009 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20121205 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20121225 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20130122 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160201 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20160201 Year of fee payment: 3 |
|
LAPS | Cancellation because of no payment of annual fees |