Flutter Engine
The Flutter Engine
Loading...
Searching...
No Matches
PRESUBMIT.py
Go to the documentation of this file.
1#!/usr/bin/env python3
2# Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
3# for details. All rights reserved. Use of this source code is governed by a
4# BSD-style license that can be found in the LICENSE file.
5"""Analyzer specific presubmit script.
6
7See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
8for more details about the presubmit API built into gcl.
9"""
10
11import os.path
12import re
13
14USE_PYTHON3 = True
15PRESUBMIT_VERSION = '2.0.0'
16
17
19 local_root = input_api.change.RepositoryRoot()
20 node_text_expectations_file = os.path.join(local_root, 'pkg', 'analyzer',
21 'test', 'src', 'dart',
22 'resolution',
23 'node_text_expectations.dart')
24 for git_file in input_api.AffectedTestableFiles():
25 filename = git_file.AbsoluteLocalPath()
26 if (filename == node_text_expectations_file):
27 isEnabledLine = re.compile('static const updatingIsEnabled = (.*);')
28 for line in git_file.NewContents():
29 m = isEnabledLine.search(line)
30 if (m is not None):
31 value = m.group(1)
32 if (value == 'false'):
33 return []
34 else:
35 return [
36 output_api.PresubmitError(
37 'NodeTextExpectationsCollector.updatingIsEnabled '
38 'must be `false`')
39 ]
40 return [
41 output_api.PresubmitError(
42 'Could not validate '
43 'NodeTextExpectationsCollector.updatingIsEnabled')
44 ]
45 return []
CheckNodeTextExpectationsCollectorUpdatingIsDisabled(input_api, output_api)
Definition PRESUBMIT.py:18