analysis_server: Bump to pedantic 1.9

Change-Id: Iec6c21abe09ecfbd74c4e1b18c0f519c0416467b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/163304
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Sam Rawlins 2020-10-07 13:41:35 +00:00 committed by commit-bot@chromium.org
parent e933e91aaa
commit ae466ef7d5
14 changed files with 27 additions and 52 deletions

View file

@ -1,4 +1,4 @@
include: package:pedantic/analysis_options.1.8.0.yaml
include: package:pedantic/analysis_options.1.9.0.yaml
analyzer:
# This currently finds ~1,200 implicit-casts issues when enabled.
@ -16,25 +16,11 @@ analyzer:
linter:
rules:
- await_only_futures
- avoid_single_cascade_in_expression_statements
- empty_statements
- iterable_contains_unrelated_type
- list_remove_unrelated_type
- prefer_initializing_formals
- unnecessary_brace_in_string_interps
#
# Delta from pedantic 1.8.0 to 1.9.0
#
- always_declare_return_types
- always_require_non_null_named_parameters
- annotate_overrides
- avoid_null_checks_in_equality_operators
- camel_case_extensions
- omit_local_variable_types
- prefer_adjacent_string_concatenation
- prefer_collection_literals
- prefer_conditional_assignment
- prefer_final_fields
- prefer_for_elements_to_map_fromIterable
- prefer_generic_function_type_aliases
- prefer_if_null_operators
- prefer_single_quotes
- prefer_spread_collections
- unnecessary_this
- use_function_type_syntax_for_parameters
- unnecessary_overrides
- void_checks

View file

@ -305,7 +305,7 @@ class Response {
/// with the given [id]. If [_result] is provided, it will be used as the
/// result; otherwise an empty result will be used. If an [error] is provided
/// then the response will represent an error condition.
Response(this.id, {Map<String, Object> result, this.error}) : result = result;
Response(this.id, {this.result, this.error});
/// Create and return the `DEBUG_PORT_COULD_NOT_BE_OPENED` error response.
Response.debugPortCouldNotBeOpened(Request request, dynamic error)

View file

@ -108,10 +108,9 @@ class ContextInfo {
/// added to the context.
Map<String, Source> sources = HashMap<String, Source>();
ContextInfo(ContextManagerImpl contextManager, this.parent, Folder folder,
ContextInfo(ContextManagerImpl contextManager, this.parent, this.folder,
File packagespecFile, this.disposition)
: folder = folder,
pathFilter = PathFilter(
: pathFilter = PathFilter(
folder.path, null, contextManager.resourceProvider.pathContext) {
packageDescriptionPath = packagespecFile.path;
parent.children.add(this);

View file

@ -25,9 +25,7 @@ class SearchDomainHandler implements protocol.RequestHandler {
/// Initialize a newly created handler to handle requests for the given
/// [server].
SearchDomainHandler(AnalysisServer server)
: server = server,
searchEngine = server.searchEngine;
SearchDomainHandler(this.server) : searchEngine = server.searchEngine;
Future findElementReferences(protocol.Request request) async {
var params =

View file

@ -40,9 +40,8 @@ class CompletionRequestImpl implements CompletionRequest {
/// Initialize a newly created completion request based on the given
/// arguments.
CompletionRequestImpl(
this.result, int offset, this.useNewRelevance, this.performance)
: offset = offset,
replacementOffset = offset,
this.result, this.offset, this.useNewRelevance, this.performance)
: replacementOffset = offset,
replacementLength = 0;
@override

View file

@ -451,7 +451,7 @@ class _LocalVisitor extends LocalDeclarationVisitor {
@override
void visitExtendsClause(ExtendsClause node) {
inExtendsClause = true;
return super.visitExtendsClause(node);
super.visitExtendsClause(node);
}
/// Return `true` if the [identifier] is composed of one or more underscore

View file

@ -253,7 +253,7 @@ class DartFixContributor implements FixContributor {
List.from(fixList[0].change.linkedEditGroups);
for (var i = 1; i < fixList.length; i++) {
edits.addAll(fixList[i].change.edits[0].edits);
sourceChange.linkedEditGroups..addAll(fixList[i].change.linkedEditGroups);
sourceChange.linkedEditGroups.addAll(fixList[i].change.linkedEditGroups);
}
// Sort the list of SourceEdits so that when the edits are applied, they
// are applied from the end of the file to the top of the file.

View file

@ -262,10 +262,8 @@ class _MemberInfo {
final int end;
final String text;
_MemberInfo(this.item, this.name, int offset, int length, this.text)
: offset = offset,
length = length,
end = offset + length;
_MemberInfo(this.item, this.name, this.offset, this.length, this.text)
: end = offset + length;
@override
String toString() {

View file

@ -1083,7 +1083,7 @@ class KytheDartVisitor extends GeneralizingAstVisitor<void> with OutputUtils {
_enclosingVName =
_vNameFromElement(_enclosingElement, schema.FUNCTION_KIND);
}
return f();
f();
} finally {
_enclosingElement = outerEnclosingElement;
_enclosingClassElement = outerEnclosingClassElement;

View file

@ -148,10 +148,9 @@ class _ClassMemberValidator {
elementKind = ElementKind.METHOD;
_ClassMemberValidator.forRename(
this.searchEngine, this.sessionHelper, Element element, this.name)
this.searchEngine, this.sessionHelper, this.element, this.name)
: isRename = true,
library = element.library,
element = element,
elementClass = element.enclosingElement,
elementKind = element.kind;

View file

@ -104,10 +104,9 @@ class _ExtensionMemberValidator {
final List<SearchMatch> references = <SearchMatch>[];
_ExtensionMemberValidator.forRename(
this.searchEngine, this.sessionHelper, Element element, this.name)
this.searchEngine, this.sessionHelper, this.element, this.name)
: isRename = true,
library = element.library,
element = element,
elementExtension = element.enclosingElement,
elementKind = element.kind;

View file

@ -35,5 +35,5 @@ dev_dependencies:
logging: any
matcher: any
mockito: any
pedantic: ^1.8.0
pedantic: ^1.9.0
test_reflective_loader: any

View file

@ -690,9 +690,7 @@ class _ListOf extends Matcher {
/// Iterable matcher which we use to test the contents of the list.
final Matcher iterableMatcher;
_ListOf(elementMatcher)
: elementMatcher = elementMatcher,
iterableMatcher = everyElement(elementMatcher);
_ListOf(this.elementMatcher) : iterableMatcher = everyElement(elementMatcher);
@override
Description describe(Description description) =>

View file

@ -365,7 +365,7 @@ void _writeEnumClass(IndentableStringBuffer buffer, Namespace namespace) {
..writeIndentedln('switch (obj) {')
..indent();
consts.forEach((cons) {
buffer..writeIndentedln('case ${cons.valueAsLiteral}:');
buffer.writeIndentedln('case ${cons.valueAsLiteral}:');
});
buffer
..indent()
@ -380,9 +380,8 @@ void _writeEnumClass(IndentableStringBuffer buffer, Namespace namespace) {
..writeIndentedln('}');
namespace.members.whereType<Const>().forEach((cons) {
_writeDocCommentsAndAnnotations(buffer, cons);
buffer
..writeIndentedln(
'static const ${_makeValidIdentifier(cons.name)} = ${namespace.name}$constructorName(${cons.valueAsLiteral});');
buffer.writeIndentedln(
'static const ${_makeValidIdentifier(cons.name)} = ${namespace.name}$constructorName(${cons.valueAsLiteral});');
});
buffer
..writeln()
@ -662,7 +661,7 @@ void _writeJsonMapAssignment(
final nullOp = shouldBeOmittedIfNoValue ? '' : '?';
final valueCode =
_isSpecType(field.type) ? '${field.name}$nullOp.toJson()' : field.name;
buffer..writeIndented('''$mapName['${field.name}'] = $valueCode''');
buffer.writeIndented('''$mapName['${field.name}'] = $valueCode''');
if (!field.allowsUndefined && !field.allowsNull) {
buffer.write(''' ?? (throw '${field.name} is required but was not set')''');
}
@ -792,7 +791,7 @@ void _writeTypeCheckCondition(IndentableStringBuffer buffer,
buffer..write(' && (')..write('$valueCode.keys.every((item) => ');
_writeTypeCheckCondition(
buffer, interface, 'item', type.indexType, reporter);
buffer..write('&& $valueCode.values.every((item) => ');
buffer.write('&& $valueCode.values.every((item) => ');
_writeTypeCheckCondition(
buffer, interface, 'item', type.valueType, reporter);
buffer.write(')))');