Enforce lint unnecessary_parenthesis in analysis_server.
Change-Id: Ib68c124988743b45807015e7274f429fff67fe44 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/189384 Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
f81be2cd8b
commit
c8d6f85d0f
@@ -24,4 +24,5 @@ linter:
|
||||
- prefer_typing_uninitialized_variables
|
||||
- unnecessary_brace_in_string_interps
|
||||
- unnecessary_overrides
|
||||
- unnecessary_parenthesis
|
||||
- void_checks
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: unused_import
|
||||
// ignore_for_file: unused_shown_name
|
||||
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: unused_import
|
||||
// ignore_for_file: unused_shown_name
|
||||
|
||||
|
||||
@@ -643,7 +643,7 @@ ErrorOr<String> pathOfUri(Uri uri) {
|
||||
message: 'Document URI was not supplied',
|
||||
));
|
||||
}
|
||||
final isValidFileUri = (uri?.isScheme('file') ?? false);
|
||||
final isValidFileUri = uri?.isScheme('file') ?? false;
|
||||
if (!isValidFileUri) {
|
||||
return ErrorOr<String>.error(ResponseError(
|
||||
code: lsp.ServerErrorCodes.InvalidFilePath,
|
||||
|
||||
@@ -575,12 +575,12 @@ class ResultMerger {
|
||||
lengths.addAll(feedback.lengths);
|
||||
}
|
||||
return ExtractLocalVariableFeedback(names.toList(), offsets, lengths,
|
||||
coveringExpressionOffsets: (coveringExpressionOffsets.isEmpty
|
||||
coveringExpressionOffsets: coveringExpressionOffsets.isEmpty
|
||||
? null
|
||||
: coveringExpressionOffsets),
|
||||
coveringExpressionLengths: (coveringExpressionLengths.isEmpty
|
||||
: coveringExpressionOffsets,
|
||||
coveringExpressionLengths: coveringExpressionLengths.isEmpty
|
||||
? null
|
||||
: coveringExpressionLengths));
|
||||
: coveringExpressionLengths);
|
||||
} else if (first is ExtractMethodFeedback) {
|
||||
var offset = first.offset;
|
||||
var length = first.length;
|
||||
|
||||
@@ -55,7 +55,7 @@ class SdkConfiguration {
|
||||
|
||||
/// Return a string describing the contents of this SDK configuration.
|
||||
String get displayString {
|
||||
return _values.keys.map((key) => '$key: ${_values[key]}').join(('\n'));
|
||||
return _values.keys.map((key) => '$key: ${_values[key]}').join('\n');
|
||||
}
|
||||
|
||||
/// Returns whether this SDK configuration has any configured values.
|
||||
|
||||
@@ -115,7 +115,7 @@ class _UriSuggestionBuilder extends SimpleAstVisitor<void> {
|
||||
var source = request.source;
|
||||
|
||||
String parentUri;
|
||||
if ((partialUri.endsWith('/'))) {
|
||||
if (partialUri.endsWith('/')) {
|
||||
parentUri = partialUri;
|
||||
} else {
|
||||
parentUri = posix.dirname(partialUri);
|
||||
|
||||
@@ -1231,10 +1231,10 @@ class StatementCompletionProcessor {
|
||||
}
|
||||
if (body is Block) {
|
||||
var block = body;
|
||||
return (!(block.leftBracket.isSynthetic));
|
||||
return !block.leftBracket.isSynthetic;
|
||||
}
|
||||
return (lineInfo.getLocation(keyword.offset) ==
|
||||
lineInfo.getLocation(body.offset));
|
||||
return lineInfo.getLocation(keyword.offset) ==
|
||||
lineInfo.getLocation(body.offset);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class ConvertToContains extends CorrectionProducer {
|
||||
expression.operator.type == TokenType.MINUS) {
|
||||
var operand = expression.operand;
|
||||
if (operand is IntegerLiteral) {
|
||||
return -(operand.value);
|
||||
return -operand.value;
|
||||
}
|
||||
}
|
||||
throw StateError('invalid integer value');
|
||||
|
||||
+1
-1
@@ -429,7 +429,7 @@ class _CodeFragmentScanner {
|
||||
}
|
||||
|
||||
/// Return `true` if the [char] is a digit.
|
||||
bool _isDigit(int char) => (char >= $0 && char <= $9);
|
||||
bool _isDigit(int char) => char >= $0 && char <= $9;
|
||||
|
||||
/// Return `true` if the [char] is a letter.
|
||||
bool _isLetter(int char) =>
|
||||
|
||||
@@ -777,8 +777,8 @@ class DiagnosticsSite extends Site implements AbstractGetHandler {
|
||||
pages.add(MemoryAndCpuPage(this, profiler));
|
||||
}
|
||||
|
||||
pages.sort(((Page a, Page b) =>
|
||||
a.title.toLowerCase().compareTo(b.title.toLowerCase())));
|
||||
pages.sort((Page a, Page b) =>
|
||||
a.title.toLowerCase().compareTo(b.title.toLowerCase()));
|
||||
|
||||
// Add the status page at the beginning.
|
||||
pages.insert(0, StatusPage(this));
|
||||
|
||||
@@ -38,7 +38,7 @@ class ByteStreamClientChannelTest {
|
||||
inputSink = IOSink(inputStream);
|
||||
var outputStream = StreamController<List<int>>();
|
||||
outputLineStream = outputStream.stream
|
||||
.transform((Utf8Codec()).decoder)
|
||||
.transform(Utf8Codec().decoder)
|
||||
.transform(LineSplitter());
|
||||
outputSink = IOSink(outputStream);
|
||||
channel = ByteStreamClientChannel(inputStream.stream, outputSink);
|
||||
@@ -124,7 +124,7 @@ class ByteStreamServerChannelTest {
|
||||
inputSink = IOSink(inputStream);
|
||||
var outputStream = StreamController<List<int>>();
|
||||
outputLineStream = outputStream.stream
|
||||
.transform((Utf8Codec()).decoder)
|
||||
.transform(Utf8Codec().decoder)
|
||||
.transform(LineSplitter());
|
||||
var outputSink = IOSink(outputStream);
|
||||
channel = ByteStreamServerChannel(
|
||||
|
||||
@@ -518,7 +518,7 @@ class Server {
|
||||
}
|
||||
});
|
||||
_process.stderr
|
||||
.transform((Utf8Codec()).decoder)
|
||||
.transform(Utf8Codec().decoder)
|
||||
.transform(LineSplitter())
|
||||
.listen((String line) {
|
||||
var trimmedLine = line.trim();
|
||||
|
||||
@@ -786,7 +786,7 @@ class Server {
|
||||
void installHandler(
|
||||
Stream<List<int>> stream, void Function(String) handler) {
|
||||
stream
|
||||
.transform((Utf8Codec()).decoder)
|
||||
.transform(Utf8Codec().decoder)
|
||||
.transform(LineSplitter())
|
||||
.listen(handler);
|
||||
}
|
||||
|
||||
@@ -79,7 +79,7 @@ class TimingResult {
|
||||
var diff = values[i] - average;
|
||||
sumOfDiffSquared += diff * diff;
|
||||
}
|
||||
return sqrt((sumOfDiffSquared / (count - 1)));
|
||||
return sqrt(sumOfDiffSquared / (count - 1));
|
||||
}
|
||||
|
||||
/// Convert the given [times], expressed in nanoseconds, to times expressed in
|
||||
|
||||
@@ -830,8 +830,8 @@ class CompletionMetricsComputer {
|
||||
var lines = <LocationTableLine>[];
|
||||
for (var entry in metrics.locationMrrComputers.entries) {
|
||||
var count = entry.value.count;
|
||||
var mrr = (1 / entry.value.mrr);
|
||||
var mrr_5 = (1 / entry.value.mrr_5);
|
||||
var mrr = 1 / entry.value.mrr;
|
||||
var mrr_5 = 1 / entry.value.mrr_5;
|
||||
var product = count * mrr;
|
||||
lines.add(LocationTableLine(
|
||||
label: entry.key,
|
||||
|
||||
@@ -163,6 +163,7 @@ String generatedFileHeader(int year, {bool importCustom = false}) => '''
|
||||
// ignore_for_file: deprecated_member_use
|
||||
// ignore_for_file: deprecated_member_use_from_same_package
|
||||
// ignore_for_file: unnecessary_brace_in_string_interps
|
||||
// ignore_for_file: unnecessary_parenthesis
|
||||
// ignore_for_file: unused_import
|
||||
// ignore_for_file: unused_shown_name
|
||||
|
||||
|
||||
Reference in New Issue
Block a user