MCPcopy Create free account
hub / github.com/ARM-software/ComputeLibrary / run_fix_code_formatting

Function run_fix_code_formatting

scripts/format_code.py:321–360  ·  view source on GitHub ↗
( files="git-head", file_list=None, folder=".", num_threads=1, error_on_diff=True, \
    check_copyright=True, check_android_bp=True, check_formatting=True)

Source from the content-addressed store, hash-verified

319 raise Exception("generate Android bp file failed with error code %d" % retval)
320
321def run_fix_code_formatting( files="git-head", file_list=None, folder=".", num_threads=1, error_on_diff=True, \
322 check_copyright=True, check_android_bp=True, check_formatting=True):
323 try:
324 retval = 0
325
326 # Genereate Android.bp file and test it
327 if check_android_bp:
328 gen_android_bp = GenerateAndroidBP(folder)
329 gen_android_bp.run()
330
331 if check_formatting:
332 doxygen_checks = DoxygenCheckRun(folder,error_on_diff, files, file_list)
333 doxygen_checks.run()
334
335 if check_copyright:
336 to_check, skip_copyright = CopyrightCheckRun.get_files(folder, files, file_list)
337 if not skip_copyright:
338 logger.debug(to_check)
339 num_files = len(to_check)
340 per_thread = max( num_files / num_threads,1)
341 start=0
342 logger.info("Files to format:\n\t%s" % "\n\t".join(to_check))
343
344 for i in range(num_threads):
345 if i == num_threads -1:
346 end = num_files
347 else:
348 end= min(start+per_thread, num_files)
349 sub = to_check[start:end]
350 logger.debug("[%d] [%d,%d] %s" % (i, start, end, sub))
351 start = end
352 copyright_check_run = CopyrightCheckRun(sub, folder)
353 copyright_check_run.run()
354
355 return retval
356
357 except Exception as e:
358 logger.error("Exception caught in run_fix_code_formatting: %s" % e)
359 traceback.print_exc()
360 return -1
361
362if __name__ == "__main__":
363 parser = argparse.ArgumentParser(

Callers 1

format_code.pyFile · 0.85

Calls 9

runMethod · 0.95
runMethod · 0.95
runMethod · 0.95
GenerateAndroidBPClass · 0.85
DoxygenCheckRunClass · 0.85
rangeFunction · 0.85
CopyrightCheckRunClass · 0.85
get_filesMethod · 0.80
infoMethod · 0.45

Tested by

no test coverage detected