mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 21:11:40 +00:00
[CFE] apply curly_braces_in_flow_control_structures lint
Change-Id: Id6c7e60b40f7dd0ffd68d007fe86abb785ac0dba Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/113025 Reviewed-by: Johnni Winther <johnniwinther@google.com> Commit-Queue: Jens Johansen <jensj@google.com>
This commit is contained in:
parent
812796ff3d
commit
48af666c9f
|
@ -1,17 +1,9 @@
|
|||
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
||||
# Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
- test/extensions/data/**
|
||||
- test/flow_analysis/definite_assignment/data/**
|
||||
- test/flow_analysis/nullability/data/**
|
||||
- test/flow_analysis/reachability/data/**
|
||||
- test/flow_analysis/type_promotion/data/**
|
||||
- testcases/**
|
||||
- test/id_testing/data/**
|
||||
- test/language_versioning/data/**
|
||||
errors:
|
||||
# Allow having TODOs in the code
|
||||
todo: ignore
|
||||
include: analysis_options_no_lints.yaml
|
||||
|
||||
linter:
|
||||
rules:
|
||||
- curly_braces_in_flow_control_structures
|
||||
|
|
17
pkg/front_end/analysis_options_no_lints.yaml
Normal file
17
pkg/front_end/analysis_options_no_lints.yaml
Normal file
|
@ -0,0 +1,17 @@
|
|||
# Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
|
||||
# for details. All rights reserved. Use of this source code is governed by a
|
||||
# BSD-style license that can be found in the LICENSE file.
|
||||
|
||||
analyzer:
|
||||
exclude:
|
||||
- test/extensions/data/**
|
||||
- test/flow_analysis/definite_assignment/data/**
|
||||
- test/flow_analysis/nullability/data/**
|
||||
- test/flow_analysis/reachability/data/**
|
||||
- test/flow_analysis/type_promotion/data/**
|
||||
- testcases/**
|
||||
- test/id_testing/data/**
|
||||
- test/language_versioning/data/**
|
||||
errors:
|
||||
# Allow having TODOs in the code
|
||||
todo: ignore
|
|
@ -1011,7 +1011,9 @@ class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
}
|
||||
} else {
|
||||
TreeNode parent = invocation.parent;
|
||||
while (parent is! Component && parent != null) parent = parent.parent;
|
||||
while (parent is! Component && parent != null) {
|
||||
parent = parent.parent;
|
||||
}
|
||||
if (parent == null) continue;
|
||||
}
|
||||
|
||||
|
@ -1912,8 +1914,9 @@ class BodyBuilder extends ScopeListener<JumpTarget>
|
|||
} else if (declaration is LoadLibraryBuilder) {
|
||||
return new LoadLibraryGenerator(this, token, declaration);
|
||||
} else {
|
||||
if (declaration.hasProblem && declaration is! AccessErrorBuilder)
|
||||
if (declaration.hasProblem && declaration is! AccessErrorBuilder) {
|
||||
return declaration;
|
||||
}
|
||||
Builder setter;
|
||||
if (declaration.isSetter) {
|
||||
setter = declaration;
|
||||
|
|
|
@ -254,8 +254,9 @@ class ClassHierarchyBuilder {
|
|||
Builder supertypeDeclaration = supertypeNode.cls;
|
||||
if (depth < supertypes.length) {
|
||||
TypeBuilder asSupertypeOf = supertypes[depth];
|
||||
if (asSupertypeOf.declaration == supertypeDeclaration)
|
||||
if (asSupertypeOf.declaration == supertypeDeclaration) {
|
||||
return asSupertypeOf;
|
||||
}
|
||||
}
|
||||
supertypes = clsNode.interfaces;
|
||||
for (int i = 0; i < supertypes.length; i++) {
|
||||
|
|
|
@ -511,8 +511,9 @@ abstract class AbstractScanner implements Scanner {
|
|||
// This recovers nicely from from situations like "{[}".
|
||||
while (!identical(originalStack, groupingStack)) {
|
||||
// Don't report unmatched errors for <; it is also the less-than operator.
|
||||
if (!identical(groupingStack.head.kind, LT_TOKEN))
|
||||
if (!identical(groupingStack.head.kind, LT_TOKEN)) {
|
||||
unmatchedBeginGroup(originalStack.head);
|
||||
}
|
||||
originalStack = originalStack.tail;
|
||||
}
|
||||
return true;
|
||||
|
|
|
@ -105,10 +105,11 @@ class StringCanonicalizer {
|
|||
t = t.next;
|
||||
}
|
||||
String payload;
|
||||
if (data is String)
|
||||
if (data is String) {
|
||||
payload = data.substring(start, end);
|
||||
else
|
||||
} else {
|
||||
payload = decode(data, start, end, asciiOnly);
|
||||
}
|
||||
_nodes[index] = new Node(data, start, end, payload, s);
|
||||
_count++;
|
||||
return payload;
|
||||
|
|
|
@ -1045,7 +1045,9 @@ class SourceLibraryBuilder extends LibraryBuilder {
|
|||
// additionalExports either. Add the last one only (the one that
|
||||
// will eventually be added to the library).
|
||||
Builder memberLast = member;
|
||||
while (memberLast.next != null) memberLast = memberLast.next;
|
||||
while (memberLast.next != null) {
|
||||
memberLast = memberLast.next;
|
||||
}
|
||||
library.additionalExports.add(memberLast.target.reference);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -206,8 +206,9 @@ Future<Map<String, List<int>>> createModules(
|
|||
for (String filename in moduleSources.keys) {
|
||||
String data = moduleSources[filename];
|
||||
Uri uri = base.resolve(filename);
|
||||
if (await fs.entityForUri(uri).exists())
|
||||
if (await fs.entityForUri(uri).exists()) {
|
||||
throw "More than one entry for $filename";
|
||||
}
|
||||
fs.entityForUri(uri).writeAsStringSync(data);
|
||||
}
|
||||
}
|
||||
|
@ -499,14 +500,16 @@ Future<Null> newWorldTest(List worlds, Map modules, bool omitPlatform) async {
|
|||
countNonSyntheticPlatformLibraries(component);
|
||||
int syntheticLibraries = countSyntheticLibraries(component);
|
||||
if (world["expectsPlatform"] == true) {
|
||||
if (nonSyntheticPlatformLibraries < 5)
|
||||
if (nonSyntheticPlatformLibraries < 5) {
|
||||
throw "Expected to have at least 5 platform libraries "
|
||||
"(actually, the entire sdk), "
|
||||
"but got $nonSyntheticPlatformLibraries.";
|
||||
}
|
||||
} else {
|
||||
if (nonSyntheticPlatformLibraries != 0)
|
||||
if (nonSyntheticPlatformLibraries != 0) {
|
||||
throw "Expected to have 0 platform libraries "
|
||||
"but got $nonSyntheticPlatformLibraries.";
|
||||
}
|
||||
}
|
||||
if (world["expectedLibraryCount"] != null) {
|
||||
if (nonSyntheticLibraries - nonSyntheticPlatformLibraries !=
|
||||
|
|
|
@ -241,8 +241,9 @@ class ScannerTest_Replacement extends ScannerTestBase {
|
|||
fasta.Token token = firstToken;
|
||||
while (!token.isEof) {
|
||||
if (token is analyzer.BeginToken) {
|
||||
if (token.lexeme != '<')
|
||||
if (token.lexeme != '<') {
|
||||
expect(token.endGroup, isNotNull, reason: token.lexeme);
|
||||
}
|
||||
if (token.endGroup != null) openerStack.add(token);
|
||||
} else if (openerStack.isNotEmpty && openerStack.last.endGroup == token) {
|
||||
analyzer.BeginToken beginToken = openerStack.removeLast();
|
||||
|
|
|
@ -104,8 +104,9 @@ void main() {
|
|||
}
|
||||
|
||||
void _expectList(List<String> actual, List<String> expected) {
|
||||
if (actual.length != expected.length)
|
||||
if (actual.length != expected.length) {
|
||||
throw "Not the same ($actual vs $expected)";
|
||||
}
|
||||
for (int i = 0; i < actual.length; i++) {
|
||||
if (actual[i] != expected[i]) throw "Not the same ($actual vs $expected)";
|
||||
}
|
||||
|
|
|
@ -387,7 +387,7 @@
|
|||
|
||||
"analyze": {
|
||||
|
||||
"options": "analysis_options.yaml",
|
||||
"options": "analysis_options_no_lints.yaml",
|
||||
|
||||
"uris": [
|
||||
"lib/",
|
||||
|
|
|
@ -148,7 +148,9 @@ Future<Map<Uri, List<int>>> scanReachableFiles(Uri entryUri) async {
|
|||
|
||||
inputSize = 0;
|
||||
// adjust size because there is a null-terminator on the contents.
|
||||
for (var source in files.values) inputSize += (source.length - 1);
|
||||
for (var source in files.values) {
|
||||
inputSize += (source.length - 1);
|
||||
}
|
||||
print('input size: $inputSize chars');
|
||||
var loadTime = loadTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds;
|
||||
report('load', loadTime);
|
||||
|
|
|
@ -184,7 +184,9 @@ Set<Source> scanReachableFiles(Uri entryUri) {
|
|||
loadTimer.stop();
|
||||
|
||||
inputSize = 0;
|
||||
for (var s in files) inputSize += s.contents.data.length;
|
||||
for (var s in files) {
|
||||
inputSize += s.contents.data.length;
|
||||
}
|
||||
print('input size: ${inputSize} chars');
|
||||
var loadTime = loadTimer.elapsedMicroseconds - scanTimer.elapsedMicroseconds;
|
||||
report('load', loadTime);
|
||||
|
|
Loading…
Reference in a new issue