diff options
author | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-08 10:28:10 +0100 |
---|---|---|
committer | Allan Sandfeld Jensen <allan.jensen@qt.io> | 2017-03-20 13:40:30 +0000 |
commit | e733310db58160074f574c429d48f8308c0afe17 (patch) | |
tree | f8aef4b7e62a69928dbcf880620eece20f98c6df /chromium/PRESUBMIT.py | |
parent | 2f583e4aec1ae3a86fa047829c96b310dc12ecdf (diff) | |
download | qtwebengine-chromium-e733310db58160074f574c429d48f8308c0afe17.tar.gz |
BASELINE: Update Chromium to 56.0.2924.122
Change-Id: I4e04de8f47e47e501c46ed934c76a431c6337ced
Reviewed-by: Michael BrĂ¼ning <michael.bruning@qt.io>
Diffstat (limited to 'chromium/PRESUBMIT.py')
-rw-r--r-- | chromium/PRESUBMIT.py | 57 |
1 files changed, 50 insertions, 7 deletions
diff --git a/chromium/PRESUBMIT.py b/chromium/PRESUBMIT.py index 3083e5455a9..92888ceb587 100644 --- a/chromium/PRESUBMIT.py +++ b/chromium/PRESUBMIT.py @@ -52,8 +52,6 @@ _TEST_CODE_EXCLUDED_PATHS = ( r'.*[\\\/](test|tool(s)?)[\\\/].*', # content_shell is used for running layout tests. r'content[\\\/]shell[\\\/].*', - # At request of folks maintaining this folder. - r'chrome[\\\/]browser[\\\/]automation[\\\/].*', # Non-production example code. r'mojo[\\\/]examples[\\\/].*', # Launcher for running iOS tests on the simulator. @@ -147,6 +145,15 @@ _BANNED_OBJC_FUNCTIONS = ( ), True, ), + ( + r"/\s+UTF8String\s*]", + ( + 'The use of -[NSString UTF8String] is dangerous as it can return null', + 'even if |canBeConvertedToEncoding:NSUTF8StringEncoding| returns YES.', + 'Please use |SysNSStringToUTF8| instead.', + ), + True, + ), ) @@ -307,6 +314,24 @@ _BANNED_CPP_FUNCTIONS = ( True, (), ), + ( + r'STLDeleteElements', # http://crbug.com/555865 + ( + 'This call is obsolete with C++ 11; create a container with owning', + 'pointers instead (e.g. std::vector<std::unique_ptr<x>> ).', + ), + True, + (), + ), + ( + r'STLDeleteValues', # http://crbug.com/555865 + ( + 'This call is obsolete with C++ 11; create a map with owning', + 'pointers instead (e.g. std::map<std::string, std::unique_ptr<x>> ).', + ), + True, + (), + ), ) @@ -1432,6 +1457,12 @@ def _CheckIpcOwners(input_api, output_api): '*TypeConverter*.*', ] + # These third_party directories do not contain IPCs, but contain files + # matching the above patterns, which trigger false positives. + exclude_paths = [ + 'third_party/crashpad/*', + ] + # Dictionary mapping an OWNERS file path to Patterns. # Patterns is a dictionary mapping glob patterns (suitable for use in per-file # rules ) to a PatternEntry. @@ -1467,6 +1498,13 @@ def _CheckIpcOwners(input_api, output_api): for pattern in file_patterns: if input_api.fnmatch.fnmatch( input_api.os_path.basename(f.LocalPath()), pattern): + skip = False + for exclude in exclude_paths: + if input_api.fnmatch.fnmatch(f.LocalPath(), exclude): + skip = True + break + if skip: + continue owners_file = input_api.os_path.join( input_api.os_path.dirname(f.LocalPath()), 'OWNERS') if owners_file not in to_check: @@ -1756,12 +1794,15 @@ class PydepsChecker(object): def DetermineIfStale(self, pydeps_path): """Runs print_python_deps.py to see if the files is stale.""" + import difflib old_pydeps_data = self._LoadFile(pydeps_path).splitlines() cmd = old_pydeps_data[1][1:].strip() new_pydeps_data = self._input_api.subprocess.check_output( cmd + ' --output ""', shell=True) + old_contents = old_pydeps_data[2:] + new_contents = new_pydeps_data.splitlines()[2:] if old_pydeps_data[2:] != new_pydeps_data.splitlines()[2:]: - return cmd + return cmd, '\n'.join(difflib.context_diff(old_contents, new_contents)) def _CheckPydepsNeedsUpdating(input_api, output_api, checker_for_tests=None): @@ -1794,11 +1835,13 @@ def _CheckPydepsNeedsUpdating(input_api, output_api, checker_for_tests=None): for pydep_path in checker.ComputeAffectedPydeps(): try: - cmd = checker.DetermineIfStale(pydep_path) - if cmd: + result = checker.DetermineIfStale(pydep_path) + if result: + cmd, diff = result results.append(output_api.PresubmitError( - 'File is stale: %s\nTo regenerate, run:\n\n %s' % - (pydep_path, cmd))) + 'File is stale: %s\nDiff (apply to fix):\n%s\n' + 'To regenerate, run:\n\n %s' % + (pydep_path, diff, cmd))) except input_api.subprocess.CalledProcessError as error: return [output_api.PresubmitError('Error running: %s' % error.cmd, long_text=error.output)] |