@@ -124,6 +124,22 @@ def _init_japplication(data: str) -> JApplication:
124
124
125
125
# set_trace()
126
126
return JApplication (** json .loads (data ))
127
+
128
+ @staticmethod
129
+ def check_exisiting_analysis_file_level (analysis_json_path_file : Path , analysis_level : int ) -> bool :
130
+ analysis_file_compatible = True
131
+ if not analysis_json_path_file .exists ():
132
+ analysis_file_compatible = False
133
+ else :
134
+ with open (analysis_json_path_file ) as f :
135
+ data = json .load (f )
136
+ if analysis_level == 2 and "call_graph" not in data :
137
+ analysis_file_compatible = False
138
+ elif analysis_level == 1 and "symbol_table" not in data :
139
+ analysis_file_compatible = False
140
+ return analysis_file_compatible
141
+
142
+
127
143
128
144
def _init_codeanalyzer (self , analysis_level = 1 ) -> JApplication :
129
145
"""Should initialize the Codeanalyzer.
@@ -170,7 +186,7 @@ def _init_codeanalyzer(self, analysis_level=1) -> JApplication:
170
186
)
171
187
is_run_code_analyzer = True
172
188
else :
173
- if not analysis_json_path_file . exists ( ) or self .eager_analysis :
189
+ if not self . check_exisiting_analysis_file_level ( analysis_json_path_file , analysis_level ) or self .eager_analysis :
174
190
# If the analysis file does not exist, we'll run the analysis. Alternately, if the eager_analysis
175
191
# flag is set, we'll run the analysis every time the object is created. This will happen regradless
176
192
# of the existence of the analysis file.
0 commit comments