MCPcopy Index your code
hub / github.com/nodejs/node / ClangFormatProcessor

Class ClangFormatProcessor

deps/v8/tools/v8_presubmit.py:474–514  ·  view source on GitHub ↗

Check if clang-format runs into timeouts with any files. Note, we are not actually enforcing the format as that creates too many differences on config updates.

Source from the content-addressed store, hash-verified

472
473
474class ClangFormatProcessor(CacheableSourceFileProcessor):
475 """
476 Check if clang-format runs into timeouts with any files.
477
478 Note, we are not actually enforcing the format as that creates too
479 many differences on config updates.
480 """
481
482 def __init__(self, use_cache=True):
483 super(ClangFormatProcessor, self).__init__(
484 use_cache=use_cache, cache_file_path='.clang-format-cache', file_type='C/C++')
485
486 def IsRelevant(self, name):
487 return name.endswith('.cc') or name.endswith('.h')
488
489 def IgnoreDir(self, name):
490 return (super(ClangFormatProcessor, self).IgnoreDir(name)
491 or (name == 'third_party'))
492
493 # Clang-format is too slow on these files.
494 IGNORE_FORMAT = [
495 'gay-fixed.cc',
496 'gay-precision.cc',
497 'gay-shortest.cc',
498 ]
499
500 def IgnoreFile(self, name):
501 return (super(ClangFormatProcessor, self).IgnoreFile(name)
502 or (name in ClangFormatProcessor.IGNORE_FORMAT))
503
504 def GetPathsToSearch(self):
505 dirs = ['include', 'samples', 'src']
506 test_dirs = ['cctest', 'common', 'fuzzer', 'inspector', 'unittests']
507 return dirs + [join('test', dir) for dir in test_dirs]
508
509 def GetProcessorWorker(self):
510 return ClangFormatWorker
511
512 def GetProcessorScript(self):
513 arguments = ['--fail-on-incomplete-format', '--Werror', '-n']
514 return join(DEPS_DEPOT_TOOLS_PATH, 'clang_format.py'), arguments
515
516
517COPYRIGHT_HEADER_PATTERN = re.compile(

Callers 1

MainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…