Re-sync analysis_options.yaml with flutter/flutter (#5695)

The analysis options have gotten behind; this re-syncs to the current state of flutter/flutter. For options that are non-trivial to enable, either because they are non-trivial to fix, or touch a very large number of files, they are locally disabled with clear "LOCAL CHANGE" markers so that it's obvious where we are out of sync. For options that are simple to resolve, they are enabled in the PR.

Part of https://github.com/flutter/flutter/issues/76229
This commit is contained in:
stuartmorgan
2022-05-11 11:48:47 -04:00
committed by GitHub
parent 9544f04a50
commit e8b4147fcc
14 changed files with 28 additions and 31 deletions

View File

@ -110,7 +110,7 @@ class CreateAllPluginsAppCommand extends PluginCommand {
newGradle.writeln(' multiDexEnabled true'); newGradle.writeln(' multiDexEnabled true');
} else if (line.contains('dependencies {')) { } else if (line.contains('dependencies {')) {
newGradle.writeln( newGradle.writeln(
' implementation \'com.google.guava:guava:27.0.1-android\'\n', " implementation 'com.google.guava:guava:27.0.1-android'\n",
); );
// Tests for https://github.com/flutter/flutter/issues/43383 // Tests for https://github.com/flutter/flutter/issues/43383
newGradle.writeln( newGradle.writeln(

View File

@ -30,7 +30,7 @@ class CustomTestCommand extends PackageLoopingCommand {
@override @override
final String description = 'Runs package-specific custom tests defined in ' final String description = 'Runs package-specific custom tests defined in '
'a package\'s tool/$_scriptName file.\n\n' "a package's tool/$_scriptName file.\n\n"
'This command requires "dart" to be in your path.'; 'This command requires "dart" to be in your path.';
@override @override

View File

@ -130,8 +130,7 @@ class FormatCommand extends PluginCommand {
if (clangFiles.isNotEmpty) { if (clangFiles.isNotEmpty) {
final String clangFormat = getStringArg('clang-format'); final String clangFormat = getStringArg('clang-format');
if (!await _hasDependency(clangFormat)) { if (!await _hasDependency(clangFormat)) {
printError( printError('Unable to run "clang-format". Make sure that it is in your '
'Unable to run \'clang-format\'. Make sure that it is in your '
'path, or provide a full path with --clang-format.'); 'path, or provide a full path with --clang-format.');
throw ToolExit(_exitDependencyMissing); throw ToolExit(_exitDependencyMissing);
} }
@ -156,7 +155,7 @@ class FormatCommand extends PluginCommand {
final String java = getStringArg('java'); final String java = getStringArg('java');
if (!await _hasDependency(java)) { if (!await _hasDependency(java)) {
printError( printError(
'Unable to run \'java\'. Make sure that it is in your path, or ' 'Unable to run "java". Make sure that it is in your path, or '
'provide a full path with --java.'); 'provide a full path with --java.');
throw ToolExit(_exitDependencyMissing); throw ToolExit(_exitDependencyMissing);
} }

View File

@ -241,8 +241,7 @@ class LicenseCheckCommand extends PluginCommand {
} }
// Sort by path for more usable output. // Sort by path for more usable output.
final int Function(File, File) pathCompare = int pathCompare(File a, File b) => a.path.compareTo(b.path);
(File a, File b) => a.path.compareTo(b.path);
incorrectFirstPartyFiles.sort(pathCompare); incorrectFirstPartyFiles.sort(pathCompare);
unrecognizedThirdPartyFiles.sort(pathCompare); unrecognizedThirdPartyFiles.sort(pathCompare);

View File

@ -169,8 +169,8 @@ class MakeDepsPathBasedCommand extends PluginCommand {
// then re-serialiazing so that it's a localized change, rather than // then re-serialiazing so that it's a localized change, rather than
// rewriting the whole file (e.g., destroying comments), which could be // rewriting the whole file (e.g., destroying comments), which could be
// more disruptive for local use. // more disruptive for local use.
String newPubspecContents = pubspecContents + String newPubspecContents = '''
''' $pubspecContents
$_dependencyOverrideWarningComment $_dependencyOverrideWarningComment
dependency_overrides: dependency_overrides:

View File

@ -225,8 +225,8 @@ class PubspecCheckCommand extends PackageLoopingCommand {
bool _checkIssueLink(Pubspec pubspec) { bool _checkIssueLink(Pubspec pubspec) {
return pubspec.issueTracker return pubspec.issueTracker
?.toString() ?.toString()
.startsWith(_expectedIssueLinkFormat) == .startsWith(_expectedIssueLinkFormat) ??
true; false;
} }
// Validates the "implements" keyword for a plugin, returning an error // Validates the "implements" keyword for a plugin, returning an error
@ -287,8 +287,8 @@ class PubspecCheckCommand extends PackageLoopingCommand {
.where((String package) => !dependencies.contains(package)); .where((String package) => !dependencies.contains(package));
if (missingPackages.isNotEmpty) { if (missingPackages.isNotEmpty) {
return 'The following default_packages are missing ' return 'The following default_packages are missing '
'corresponding dependencies:\n ' + 'corresponding dependencies:\n'
missingPackages.join('\n '); ' ${missingPackages.join('\n ')}';
} }
return null; return null;

View File

@ -403,7 +403,7 @@ ${indentation}HTTP response: ${pubVersionFinderResponse.httpResponse.body}
final String badNextErrorMessage = '${indentation}When bumping the version ' final String badNextErrorMessage = '${indentation}When bumping the version '
'for release, the NEXT section should be incorporated into the new ' 'for release, the NEXT section should be incorporated into the new '
'version\'s release notes.'; "version's release notes.";
// Skip validation for the special NEXT version that's used to accumulate // Skip validation for the special NEXT version that's used to accumulate
// changes that don't warrant publishing on their own. // changes that don't warrant publishing on their own.
@ -531,7 +531,7 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog.
final Directory gitRoot = final Directory gitRoot =
packagesDir.fileSystem.directory((await gitDir).path); packagesDir.fileSystem.directory((await gitDir).path);
final String relativePackagePath = final String relativePackagePath =
getRelativePosixPath(package.directory, from: gitRoot) + '/'; '${getRelativePosixPath(package.directory, from: gitRoot)}/';
bool hasChanges = false; bool hasChanges = false;
bool needsVersionChange = false; bool needsVersionChange = false;
bool hasChangelogChange = false; bool hasChangelogChange = false;
@ -594,7 +594,7 @@ ${indentation}The first version listed in CHANGELOG.md is $fromChangeLog.
'change description.'); 'change description.');
} else { } else {
printError( printError(
'No CHANGELOG change found. If this PR needs an exemption from' 'No CHANGELOG change found. If this PR needs an exemption from '
'the standard policy of listing all changes in the CHANGELOG, ' 'the standard policy of listing all changes in the CHANGELOG, '
'please add a line starting with\n' 'please add a line starting with\n'
'$_missingChangelogChangeJustificationMarker\n' '$_missingChangelogChangeJustificationMarker\n'

View File

@ -93,7 +93,7 @@ void main() {
])); ]));
}); });
test('don\'t elide a non-contained example package', () async { test("don't elide a non-contained example package", () async {
final RepositoryPackage plugin1 = createFakePlugin('a', packagesDir); final RepositoryPackage plugin1 = createFakePlugin('a', packagesDir);
final RepositoryPackage plugin2 = createFakePlugin('example', packagesDir); final RepositoryPackage plugin2 = createFakePlugin('example', packagesDir);

View File

@ -162,7 +162,7 @@ void main() {
expect(command.plugins, unorderedEquals(<String>[plugin2.path])); expect(command.plugins, unorderedEquals(<String>[plugin2.path]));
}); });
test('exclude packages when packages flag isn\'t specified', () async { test("exclude packages when packages flag isn't specified", () async {
createFakePlugin('plugin1', packagesDir); createFakePlugin('plugin1', packagesDir);
createFakePlugin('plugin2', packagesDir); createFakePlugin('plugin2', packagesDir);
await runCapturingPrint( await runCapturingPrint(

View File

@ -218,7 +218,7 @@ void main() {
output, output,
containsAllInOrder(<Matcher>[ containsAllInOrder(<Matcher>[
contains( contains(
'Unable to run \'java\'. Make sure that it is in your path, or ' 'Unable to run "java". Make sure that it is in your path, or '
'provide a full path with --java.'), 'provide a full path with --java.'),
])); ]));
}); });
@ -330,8 +330,7 @@ void main() {
expect( expect(
output, output,
containsAllInOrder(<Matcher>[ containsAllInOrder(<Matcher>[
contains( contains('Unable to run "clang-format". Make sure that it is in your '
'Unable to run \'clang-format\'. Make sure that it is in your '
'path, or provide a full path with --clang-format.'), 'path, or provide a full path with --clang-format.'),
])); ]));
}); });

View File

@ -103,7 +103,7 @@ void main() {
expect( expect(
output, output,
containsAllInOrder(<Matcher>[ containsAllInOrder(<Matcher>[
contains('There are files in the package directory that haven\'t ' contains("There are files in the package directory that haven't "
'been saved in git. Refusing to publish these files:\n\n' 'been saved in git. Refusing to publish these files:\n\n'
'?? /packages/foo/tmp\n\n' '?? /packages/foo/tmp\n\n'
'If the directory should be clean, you can run `git clean -xdf && ' 'If the directory should be clean, you can run `git clean -xdf && '
@ -113,7 +113,7 @@ void main() {
])); ]));
}); });
test('fails immediately if the remote doesn\'t exist', () async { test("fails immediately if the remote doesn't exist", () async {
createFakePlugin('foo', packagesDir, examples: <String>[]); createFakePlugin('foo', packagesDir, examples: <String>[]);
processRunner.mockProcessesForExecutable['git-remote'] = <io.Process>[ processRunner.mockProcessesForExecutable['git-remote'] = <io.Process>[
@ -877,8 +877,8 @@ class MockStdin extends Mock implements io.Stdin {
} }
@override @override
StreamSubscription<List<int>> listen(void onData(List<int> event)?, StreamSubscription<List<int>> listen(void Function(List<int> event)? onData,
{Function? onError, void onDone()?, bool? cancelOnError}) { {Function? onError, void Function()? onDone, bool? cancelOnError}) {
return _controller.stream.listen(onData, return _controller.stream.listen(onData,
onError: onError, onDone: onDone, cancelOnError: cancelOnError); onError: onError, onDone: onDone, cancelOnError: cancelOnError);
} }

View File

@ -43,7 +43,7 @@ String _headerSection(
repositoryPath, repositoryPath,
]; ];
final String repoLink = final String repoLink =
'https://github.com/' + repoLinkPathComponents.join('/'); 'https://github.com/${repoLinkPathComponents.join('/')}';
final String issueTrackerLink = 'https://github.com/flutter/flutter/issues?' final String issueTrackerLink = 'https://github.com/flutter/flutter/issues?'
'q=is%3Aissue+is%3Aopen+label%3A%22p%3A+$name%22'; 'q=is%3Aissue+is%3Aopen+label%3A%22p%3A+$name%22';
description ??= 'A test package for validating that the pubspec.yaml ' description ??= 'A test package for validating that the pubspec.yaml '
@ -55,7 +55,7 @@ ${includeRepository ? 'repository: $repoLink' : ''}
${includeHomepage ? 'homepage: $repoLink' : ''} ${includeHomepage ? 'homepage: $repoLink' : ''}
${includeIssueTracker ? 'issue_tracker: $issueTrackerLink' : ''} ${includeIssueTracker ? 'issue_tracker: $issueTrackerLink' : ''}
version: 1.0.0 version: 1.0.0
${publishable ? '' : 'publish_to: \'none\''} ${publishable ? '' : "publish_to: 'none'"}
'''; ''';
} }

View File

@ -313,7 +313,7 @@ String _pluginPlatformSection(
assert(false, 'Unrecognized platform: $platform'); assert(false, 'Unrecognized platform: $platform');
break; break;
} }
entry = lines.join('\n') + '\n'; entry = '${lines.join('\n')}\n';
} }
return entry; return entry;

View File

@ -561,7 +561,7 @@ This is necessary because of X, Y, and Z
output, output,
containsAllInOrder(<Matcher>[ containsAllInOrder(<Matcher>[
contains('When bumping the version for release, the NEXT section ' contains('When bumping the version for release, the NEXT section '
'should be incorporated into the new version\'s release notes.') "should be incorporated into the new version's release notes.")
]), ]),
); );
}); });
@ -595,7 +595,7 @@ This is necessary because of X, Y, and Z
output, output,
containsAllInOrder(<Matcher>[ containsAllInOrder(<Matcher>[
contains('When bumping the version for release, the NEXT section ' contains('When bumping the version for release, the NEXT section '
'should be incorporated into the new version\'s release notes.'), "should be incorporated into the new version's release notes."),
contains('plugin:\n' contains('plugin:\n'
' CHANGELOG.md failed validation.'), ' CHANGELOG.md failed validation.'),
]), ]),
@ -627,7 +627,7 @@ This is necessary because of X, Y, and Z
output, output,
containsAllInOrder(<Matcher>[ containsAllInOrder(<Matcher>[
contains('When bumping the version for release, the NEXT section ' contains('When bumping the version for release, the NEXT section '
'should be incorporated into the new version\'s release notes.') "should be incorporated into the new version's release notes.")
]), ]),
); );
}); });