Uncomments avoid_redundant_argument_values in analysis_options.yaml (#6163)

This commit is contained in:
Rodrigues
2022-08-09 02:52:06 +03:00
committed by GitHub
parent 2b712593b4
commit d20563f6f4
17 changed files with 29 additions and 46 deletions

View File

@ -44,7 +44,6 @@ abstract class PluginCommand extends Command<void> {
}) : _gitDir = gitDir { }) : _gitDir = gitDir {
argParser.addMultiOption( argParser.addMultiOption(
_packagesArg, _packagesArg,
splitCommas: true,
help: help:
'Specifies which packages the command should run on (before sharding).\n', 'Specifies which packages the command should run on (before sharding).\n',
valueHelp: 'package1,package2,...', valueHelp: 'package1,package2,...',

View File

@ -335,7 +335,7 @@ class FirebaseTestLabCommand extends PackageLoopingCommand {
} }
yield* integrationTestDir yield* integrationTestDir
.listSync(recursive: true, followLinks: true) .listSync(recursive: true)
.where((FileSystemEntity file) => .where((FileSystemEntity file) =>
file is File && file.basename.endsWith('_test.dart')) file is File && file.basename.endsWith('_test.dart'))
.cast<File>(); .cast<File>();

View File

@ -35,7 +35,7 @@ class LintAndroidCommand extends PackageLoopingCommand {
if (!pluginSupportsPlatform(platformAndroid, package, if (!pluginSupportsPlatform(platformAndroid, package,
requiredMode: PlatformSupport.inline)) { requiredMode: PlatformSupport.inline)) {
return PackageResult.skip( return PackageResult.skip(
'Plugin does not have an Android implemenatation.'); 'Plugin does not have an Android implementation.');
} }
bool failed = false; bool failed = false;

View File

@ -33,16 +33,13 @@ class PublishCheckCommand extends PackageLoopingCommand {
help: 'Allows the pre-release SDK warning to pass.\n' help: 'Allows the pre-release SDK warning to pass.\n'
'When enabled, a pub warning, which asks to publish the package as a pre-release version when ' 'When enabled, a pub warning, which asks to publish the package as a pre-release version when '
'the SDK constraint is a pre-release version, is ignored.', 'the SDK constraint is a pre-release version, is ignored.',
defaultsTo: false,
); );
argParser.addFlag(_machineFlag, argParser.addFlag(_machineFlag,
help: 'Switch outputs to a machine readable JSON. \n' help: 'Switch outputs to a machine readable JSON. \n'
'The JSON contains a "status" field indicating the final status of the command, the possible values are:\n' 'The JSON contains a "status" field indicating the final status of the command, the possible values are:\n'
' $_statusNeedsPublish: There is at least one package need to be published. They also passed all publish checks.\n' ' $_statusNeedsPublish: There is at least one package need to be published. They also passed all publish checks.\n'
' $_statusMessageNoPublish: There are no packages needs to be published. Either no pubspec change detected or all versions have already been published.\n' ' $_statusMessageNoPublish: There are no packages needs to be published. Either no pubspec change detected or all versions have already been published.\n'
' $_statusMessageError: Some error has occurred.', ' $_statusMessageError: Some error has occurred.');
defaultsTo: false,
negatable: true);
} }
static const String _allowPrereleaseFlag = 'allow-pre-release'; static const String _allowPrereleaseFlag = 'allow-pre-release';

View File

@ -74,7 +74,6 @@ class PublishPluginCommand extends PackageLoopingCommand {
help: help:
'Release all packages that contains pubspec changes at the current commit compares to the base-sha.\n' 'Release all packages that contains pubspec changes at the current commit compares to the base-sha.\n'
'The --packages option is ignored if this is on.', 'The --packages option is ignored if this is on.',
defaultsTo: false,
); );
argParser.addFlag( argParser.addFlag(
_dryRunFlag, _dryRunFlag,
@ -82,14 +81,10 @@ class PublishPluginCommand extends PackageLoopingCommand {
'Skips the real `pub publish` and `git tag` commands and assumes both commands are successful.\n' 'Skips the real `pub publish` and `git tag` commands and assumes both commands are successful.\n'
'This does not run `pub publish --dry-run`.\n' 'This does not run `pub publish --dry-run`.\n'
'If you want to run the command with `pub publish --dry-run`, use `pub-publish-flags=--dry-run`', 'If you want to run the command with `pub publish --dry-run`, use `pub-publish-flags=--dry-run`',
defaultsTo: false,
negatable: true,
); );
argParser.addFlag(_skipConfirmationFlag, argParser.addFlag(_skipConfirmationFlag,
help: 'Run the command without asking for Y/N inputs.\n' help: 'Run the command without asking for Y/N inputs.\n'
'This command will add a `--force` flag to the `pub publish` command if it is not added with $_pubFlagsOption\n', 'This command will add a `--force` flag to the `pub publish` command if it is not added with $_pubFlagsOption\n');
defaultsTo: false,
negatable: true);
} }
static const String _pubFlagsOption = 'pub-publish-flags'; static const String _pubFlagsOption = 'pub-publish-flags';

View File

@ -115,8 +115,6 @@ class VersionCheckCommand extends PackageLoopingCommand {
help: 'Whether the version check should run against the version on pub.\n' help: 'Whether the version check should run against the version on pub.\n'
'Defaults to false, which means the version check only run against ' 'Defaults to false, which means the version check only run against '
'the previous version in code.', 'the previous version in code.',
defaultsTo: false,
negatable: true,
); );
argParser.addOption(_changeDescriptionFile, argParser.addOption(_changeDescriptionFile,
help: 'The path to a file containing the description of the change ' help: 'The path to a file containing the description of the change '

View File

@ -504,7 +504,7 @@ void main() {
}); });
test('skips non-Flutter examples', () async { test('skips non-Flutter examples', () async {
createFakePackage('package', packagesDir, isFlutter: false); createFakePackage('package', packagesDir);
final List<String> output = await runCapturingPrint( final List<String> output = await runCapturingPrint(
runner, <String>['build-examples', '--ios']); runner, <String>['build-examples', '--ios']);

View File

@ -10,7 +10,7 @@ import 'package:test/test.dart';
void main() { void main() {
test('works on Posix', () async { test('works on Posix', () async {
final FileSystem fileSystem = final FileSystem fileSystem =
MemoryFileSystem(style: FileSystemStyle.posix); MemoryFileSystem();
final Directory base = fileSystem.directory('/').childDirectory('base'); final Directory base = fileSystem.directory('/').childDirectory('base');
final File file = final File file =

View File

@ -373,11 +373,9 @@ void main() {
test('skips unsupported Dart versions when requested', () async { test('skips unsupported Dart versions when requested', () async {
final RepositoryPackage excluded = createFakePackage( final RepositoryPackage excluded = createFakePackage(
'excluded_package', packagesDir, 'excluded_package', packagesDir, dartConstraint: '>=2.17.0 <3.0.0');
isFlutter: false, dartConstraint: '>=2.17.0 <3.0.0');
final RepositoryPackage included = createFakePackage( final RepositoryPackage included = createFakePackage(
'a_package', packagesDir, 'a_package', packagesDir);
isFlutter: false, dartConstraint: '>=2.14.0 <3.0.0');
final TestPackageLoopingCommand command = createTestCommand( final TestPackageLoopingCommand command = createTestCommand(
packageLoopingType: PackageLoopingType.includeAllSubpackages, packageLoopingType: PackageLoopingType.includeAllSubpackages,
@ -409,7 +407,7 @@ void main() {
createFakePackage('package_b', packagesDir); createFakePackage('package_b', packagesDir);
final TestPackageLoopingCommand command = final TestPackageLoopingCommand command =
createTestCommand(hasLongOutput: true); createTestCommand();
final List<String> output = await runCommand(command); final List<String> output = await runCommand(command);
const String separator = const String separator =
@ -443,7 +441,7 @@ void main() {
createFakePackage('package_b', packagesDir); createFakePackage('package_b', packagesDir);
final TestPackageLoopingCommand command = final TestPackageLoopingCommand command =
createTestCommand(hasLongOutput: true); createTestCommand();
final List<String> output = final List<String> output =
await runCommand(command, arguments: <String>['--log-timing']); await runCommand(command, arguments: <String>['--log-timing']);
@ -595,7 +593,7 @@ void main() {
createFakePackage('package_b', packagesDir); createFakePackage('package_b', packagesDir);
final TestPackageLoopingCommand command = final TestPackageLoopingCommand command =
createTestCommand(hasLongOutput: true, captureOutput: true); createTestCommand(captureOutput: true);
final List<String> output = await runCommand(command); final List<String> output = await runCommand(command);
expect(output, isEmpty); expect(output, isEmpty);
@ -786,7 +784,7 @@ void main() {
createFakePackage('package_f', packagesDir); createFakePackage('package_f', packagesDir);
final TestPackageLoopingCommand command = final TestPackageLoopingCommand command =
createTestCommand(hasLongOutput: true); createTestCommand();
final List<String> output = await runCommand(command); final List<String> output = await runCommand(command);
expect( expect(
@ -812,7 +810,7 @@ void main() {
createFakePackage('package_a', packagesDir); createFakePackage('package_a', packagesDir);
final TestPackageLoopingCommand command = final TestPackageLoopingCommand command =
createTestCommand(hasLongOutput: true); createTestCommand();
final List<String> output = final List<String> output =
await runCommand(command, arguments: <String>['--exclude=package_a']); await runCommand(command, arguments: <String>['--exclude=package_a']);

View File

@ -223,12 +223,9 @@ void main() {
'plugin', 'plugin',
packagesDir, packagesDir,
platformSupport: <String, PlatformDetails>{ platformSupport: <String, PlatformDetails>{
platformLinux: const PlatformDetails(PlatformSupport.inline, platformLinux: const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
hasNativeCode: true, hasDartCode: true), platformMacOS: const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
platformMacOS: const PlatformDetails(PlatformSupport.inline, platformWindows: const PlatformDetails(PlatformSupport.inline, hasDartCode: true),
hasNativeCode: true, hasDartCode: true),
platformWindows: const PlatformDetails(PlatformSupport.inline,
hasNativeCode: true, hasDartCode: true),
}, },
); );

View File

@ -213,7 +213,7 @@ void main() {
test('returns false for non-Flutter package', () async { test('returns false for non-Flutter package', () async {
final RepositoryPackage package = final RepositoryPackage package =
createFakePackage('a_package', packagesDir, isFlutter: false); createFakePackage('a_package', packagesDir);
expect(package.requiresFlutter(), false); expect(package.requiresFlutter(), false);
}); });
}); });

View File

@ -146,7 +146,7 @@ void main() {
]); ]);
processRunner.mockProcessesForExecutable['dart'] = <io.Process>[ processRunner.mockProcessesForExecutable['dart'] = <io.Process>[
MockProcess(exitCode: 0), // pub get MockProcess(), // pub get
MockProcess(exitCode: 1), // test script MockProcess(exitCode: 1), // test script
]; ];
@ -306,7 +306,7 @@ void main() {
]); ]);
processRunner.mockProcessesForExecutable['dart'] = <io.Process>[ processRunner.mockProcessesForExecutable['dart'] = <io.Process>[
MockProcess(exitCode: 0), // pub get MockProcess(), // pub get
MockProcess(exitCode: 1), // test script MockProcess(exitCode: 1), // test script
]; ];

View File

@ -200,7 +200,7 @@ void main() {
test('handles the comment styles for all supported languages', () async { test('handles the comment styles for all supported languages', () async {
final File fileA = root.childFile('file_a.cc'); final File fileA = root.childFile('file_a.cc');
fileA.createSync(); fileA.createSync();
_writeLicense(fileA, comment: '// '); _writeLicense(fileA);
final File fileB = root.childFile('file_b.sh'); final File fileB = root.childFile('file_b.sh');
fileB.createSync(); fileB.createSync();
_writeLicense(fileB, comment: '# '); _writeLicense(fileB, comment: '# ');

View File

@ -24,7 +24,7 @@ void main() {
late RecordingProcessRunner processRunner; late RecordingProcessRunner processRunner;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem(style: FileSystemStyle.posix); fileSystem = MemoryFileSystem();
packagesDir = createPackagesDirectory(fileSystem: fileSystem); packagesDir = createPackagesDirectory(fileSystem: fileSystem);
mockPlatform = MockPlatform(); mockPlatform = MockPlatform();
processRunner = RecordingProcessRunner(); processRunner = RecordingProcessRunner();
@ -178,7 +178,7 @@ void main() {
containsAllInOrder( containsAllInOrder(
<Matcher>[ <Matcher>[
contains( contains(
'SKIPPING: Plugin does not have an Android implemenatation.') 'SKIPPING: Plugin does not have an Android implementation.')
], ],
)); ));
}); });
@ -197,7 +197,7 @@ void main() {
containsAllInOrder( containsAllInOrder(
<Matcher>[ <Matcher>[
contains( contains(
'SKIPPING: Plugin does not have an Android implemenatation.') 'SKIPPING: Plugin does not have an Android implementation.')
], ],
)); ));
}); });

View File

@ -23,7 +23,7 @@ void main() {
late RecordingProcessRunner processRunner; late RecordingProcessRunner processRunner;
setUp(() { setUp(() {
fileSystem = MemoryFileSystem(style: FileSystemStyle.posix); fileSystem = MemoryFileSystem();
packagesDir = createPackagesDirectory(fileSystem: fileSystem); packagesDir = createPackagesDirectory(fileSystem: fileSystem);
mockPlatform = MockPlatform(isMacOS: true); mockPlatform = MockPlatform(isMacOS: true);

View File

@ -186,7 +186,7 @@ void main() {
extraFiles: <String>['example/build.excerpt.yaml']); extraFiles: <String>['example/build.excerpt.yaml']);
processRunner.mockProcessesForExecutable['dart'] = <io.Process>[ processRunner.mockProcessesForExecutable['dart'] = <io.Process>[
MockProcess(exitCode: 0), // dart pub get MockProcess(), // dart pub get
MockProcess(exitCode: 1), // dart run build_runner ... MockProcess(exitCode: 1), // dart run build_runner ...
]; ];
@ -211,8 +211,8 @@ void main() {
extraFiles: <String>['example/build.excerpt.yaml']); extraFiles: <String>['example/build.excerpt.yaml']);
processRunner.mockProcessesForExecutable['dart'] = <io.Process>[ processRunner.mockProcessesForExecutable['dart'] = <io.Process>[
MockProcess(exitCode: 0), // dart pub get MockProcess(), // dart pub get
MockProcess(exitCode: 0), // dart run build_runner ... MockProcess(), // dart run build_runner ...
MockProcess(exitCode: 1), // dart run code_excerpt_updater ... MockProcess(exitCode: 1), // dart run code_excerpt_updater ...
]; ];

View File

@ -117,7 +117,6 @@ RepositoryPackage createFakePlugin(
createFakePubspec( createFakePubspec(
package, package,
name: name, name: name,
isFlutter: true,
isPlugin: true, isPlugin: true,
platformSupport: platformSupport, platformSupport: platformSupport,
version: version, version: version,
@ -399,10 +398,10 @@ class RecordingProcessRunner extends ProcessRunner {
final io.Process? process = _getProcessToReturn(executable); final io.Process? process = _getProcessToReturn(executable);
final List<String>? processStdout = final List<String>? processStdout =
await process?.stdout.transform(stdoutEncoding.decoder).toList(); await process?.stdout.transform(stdoutEncoding.decoder).toList();
final String stdout = processStdout?.join('') ?? ''; final String stdout = processStdout?.join() ?? '';
final List<String>? processStderr = final List<String>? processStderr =
await process?.stderr.transform(stderrEncoding.decoder).toList(); await process?.stderr.transform(stderrEncoding.decoder).toList();
final String stderr = processStderr?.join('') ?? ''; final String stderr = processStderr?.join() ?? '';
final io.ProcessResult result = process == null final io.ProcessResult result = process == null
? io.ProcessResult(1, 0, '', '') ? io.ProcessResult(1, 0, '', '')