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

Method ProcessContents

deps/v8/tools/v8_presubmit.py:624–674  ·  view source on GitHub ↗
(self, name, contents)

Source from the content-addressed store, hash-verified

622 line.find(") {") != -1
623
624 def ProcessContents(self, name, contents):
625 result = True
626 base = basename(name)
627 if not base in SourceProcessor.IGNORE_TABS:
628 if '\t' in contents:
629 print("%s contains tabs" % name)
630 result = False
631 if not base in SourceProcessor.IGNORE_COPYRIGHTS and \
632 not any(ignore_dir in name for ignore_dir
633 in SourceProcessor.IGNORE_COPYRIGHTS_DIRECTORIES):
634 if not COPYRIGHT_HEADER_PATTERN.search(contents):
635 print("%s is missing a correct copyright header." % name)
636 result = False
637 if ' \n' in contents or contents.endswith(' '):
638 line = 0
639 lines = []
640 parts = contents.split(' \n')
641 if not contents.endswith(' '):
642 parts.pop()
643 for part in parts:
644 line += part.count('\n') + 1
645 lines.append(str(line))
646 linenumbers = ', '.join(lines)
647 if len(lines) > 1:
648 print("%s has trailing whitespaces in lines %s." % (name, linenumbers))
649 else:
650 print("%s has trailing whitespaces in line %s." % (name, linenumbers))
651 result = False
652 if not contents.endswith('\n') or contents.endswith('\n\n'):
653 print("%s does not end with a single new line." % name)
654 result = False
655 # Sanitize flags for fuzzer.
656 if (".js" in name or ".mjs" in name) and ("mjsunit" in name or "debugger" in name):
657 match = FLAGS_LINE.search(contents)
658 if match:
659 print("%s Flags should use '-' (not '_')" % name)
660 result = False
661 if (not "mjsunit/mjsunit.js" in name and
662 not "mjsunit/mjsunit_numfuzz.js" in name):
663 if ASSERT_OPTIMIZED_PATTERN.search(contents) and \
664 not FLAGS_ENABLE_MAGLEV.search(contents) and \
665 not FLAGS_ENABLE_TURBOFAN.search(contents):
666 print("%s Flag --maglev or --turbofan should be set if " \
667 "assertOptimized() is used" % name)
668 result = False
669
670 match = self.runtime_function_call_pattern.search(contents)
671 if match:
672 print("%s has unexpected spaces in a runtime call '%s'" % (name, match.group(1)))
673 result = False
674 return result
675
676 def ProcessFiles(self, files):
677 success = True

Callers 1

ProcessFilesMethod · 0.95

Calls 9

basenameFunction · 0.90
strFunction · 0.85
popMethod · 0.80
printFunction · 0.70
searchMethod · 0.45
splitMethod · 0.45
countMethod · 0.45
appendMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected