@@ -73,7 +73,7 @@ def log_report(context, output, elapsed_ms, files_to_analyze, token_usage):
7373def apply_codemods (
7474 context : CodemodExecutionContext ,
7575 codemods_to_run : Sequence [BaseCodemod ],
76- hardening : bool ,
76+ remediation : bool ,
7777) -> TokenUsage :
7878 log_section ("scanning" )
7979 token_usage = TokenUsage ()
@@ -90,7 +90,7 @@ def apply_codemods(
9090 for codemod in codemods_to_run :
9191 # NOTE: this may be used as a progress indicator by upstream tools
9292 logger .info ("running codemod %s" , codemod .id )
93- if codemod_token_usage := codemod .apply (context , hardening ):
93+ if codemod_token_usage := codemod .apply (context , remediation ):
9494 log_token_usage (f"Codemod { codemod .id } " , codemod_token_usage )
9595 token_usage += codemod_token_usage
9696
@@ -136,7 +136,7 @@ def run(
136136 sast_only : bool = False ,
137137 ai_client : bool = True ,
138138 log_matched_files : bool = False ,
139- hardening : bool = False ,
139+ remediation : bool = False ,
140140) -> tuple [CodeTF | None , int , TokenUsage ]:
141141 start = datetime .datetime .now ()
142142
@@ -208,7 +208,7 @@ def run(
208208 context .find_and_fix_paths ,
209209 )
210210
211- token_usage = apply_codemods (context , codemods_to_run , hardening )
211+ token_usage = apply_codemods (context , codemods_to_run , remediation )
212212
213213 elapsed = datetime .datetime .now () - start
214214 elapsed_ms = int (elapsed .total_seconds () * 1000 )
@@ -233,7 +233,7 @@ def run(
233233 return codetf , 0 , token_usage
234234
235235
236- def _run_cli (original_args , hardening = False ) -> int :
236+ def _run_cli (original_args , remediation = False ) -> int :
237237 codemod_registry = registry .load_registered_codemods ()
238238 argv = parse_args (original_args , codemod_registry )
239239 if not os .path .exists (argv .directory ):
@@ -272,8 +272,8 @@ def _run_cli(original_args, hardening=False) -> int:
272272
273273 _ , status , _ = run (
274274 argv .directory ,
275- # Force dry-run if not hardening
276- argv . dry_run if hardening else True ,
275+ # Force dry-run if remediation
276+ True if remediation else argv . dry_run ,
277277 argv .output ,
278278 argv .output_format ,
279279 argv .verbose ,
@@ -287,22 +287,22 @@ def _run_cli(original_args, hardening=False) -> int:
287287 codemod_registry = codemod_registry ,
288288 sast_only = argv .sonar_issues_json or argv .sarif ,
289289 log_matched_files = True ,
290- hardening = hardening ,
290+ remediation = remediation ,
291291 )
292292 return status
293293
294294
295- def harden ():
295+ def main ():
296296 """
297297 Hardens a project. The application will write all the fixes into the files.
298298 """
299299 sys_argv = sys .argv [1 :]
300- sys .exit (_run_cli (sys_argv , True ))
300+ sys .exit (_run_cli (sys_argv ))
301301
302302
303- def main ():
303+ def remediate ():
304304 """
305305 Remediates a project. The application will suggest fix for each separate issue found. No files will be written.
306306 """
307307 sys_argv = sys .argv [1 :]
308- sys .exit (_run_cli (sys_argv ))
308+ sys .exit (_run_cli (sys_argv , True ))
0 commit comments