Enable avoid_redundant_argument_values lint (#91409)

This commit is contained in:
Ian Hickson
2021-10-07 20:13:02 -07:00
committed by GitHub
parent 4bf7179e51
commit 5fd259be24
667 changed files with 1693 additions and 3385 deletions

View File

@@ -250,15 +250,15 @@ ArgParser _createArgsParser() {
final ArgParser parser = ArgParser();
parser.addFlag('help', abbr: 'h', negatable: false,
help: 'Show command help.');
parser.addFlag('verbose', negatable: true, defaultsTo: true,
parser.addFlag('verbose', defaultsTo: true,
help: 'Whether to report all error messages (on) or attempt to '
'filter out some known false positives (off). Shut this off '
'locally if you want to address Flutter-specific issues.');
parser.addFlag('checked', abbr: 'c', negatable: true,
parser.addFlag('checked', abbr: 'c',
help: 'Run dartdoc in checked mode.');
parser.addFlag('json', negatable: true,
parser.addFlag('json',
help: 'Display json-formatted output from dartdoc and skip stdout/stderr prefixing.');
parser.addFlag('validate-links', negatable: true,
parser.addFlag('validate-links',
help: 'Display warnings for broken links generated by dartdoc (slow)');
return parser;
}

View File

@@ -50,7 +50,7 @@ Future<void> cleanUp(File integrationTest) async {
try {
await integrationTest.delete();
// Delete the integration_test directory if it is empty.
await integrationTest.parent.delete(recursive: false);
await integrationTest.parent.delete();
} on FileSystemException {
// Ignore, there might be other files in there preventing it from
// being removed, or it might not exist.
@@ -205,7 +205,6 @@ Future<String> runCommand(
process = await processManager.start(
cmd,
workingDirectory: workingDirectory.absolute.path,
includeParentEnvironment: true,
environment: environment,
);
process.stdout.listen(

View File

@@ -132,7 +132,6 @@ Future<void> main(List<String> rawArguments) async {
);
argParser.addFlag(
'collect',
defaultsTo: false,
negatable: false,
help: 'If this flag is set, then collect and parse header files from '
'Chromium and Android instead of reading pre-parsed data from '
@@ -141,7 +140,6 @@ Future<void> main(List<String> rawArguments) async {
);
argParser.addFlag(
'help',
defaultsTo: false,
negatable: false,
help: 'Print help for this command.',
);

View File

@@ -22,7 +22,7 @@ class MaskConstant {
return name
.split(' ')
.map<String>((String word) => lowerCamelToUpperCamel(word.toLowerCase()))
.join('');
.join();
}
String get lowerCamelName {

View File

@@ -81,7 +81,7 @@ class IOSCodeGenerator extends PlatformCodeGenerator {
buffer.write(wrapString(constant.description, prefix: ' * '));
buffer.writeln(' */');
buffer.writeln('const uint64_t k${constant.upperCamelName} = ${toHex(constant.value, digits: 11)};');
buffer.writeln('');
buffer.writeln();
}
return buffer.toString().trimRight();
}

View File

@@ -61,7 +61,7 @@ class KeyboardKeysCodeGenerator extends BaseCodeGenerator {
'[RawKeyEvent.physicalKey] for more information.');
lines.add(entry.usbHidCode, '''
$firstComment ///
$otherComments static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeyboardKey(${toHex(entry.usbHidCode, digits: 8)});
$otherComments static const PhysicalKeyboardKey ${entry.constantName} = PhysicalKeyboardKey(${toHex(entry.usbHidCode)});
''');
}
return lines.sortedJoin().trimRight();
@@ -71,7 +71,7 @@ $otherComments static const PhysicalKeyboardKey ${entry.constantName} = Physica
final OutputLines<int> lines = OutputLines<int>('Physical debug names');
for (final PhysicalKeyEntry entry in keyData.entries) {
lines.add(entry.usbHidCode, '''
${toHex(entry.usbHidCode, digits: 8)}: '${entry.commentName}',''');
${toHex(entry.usbHidCode)}: '${entry.commentName}',''');
}
return lines.sortedJoin().trimRight();
}

View File

@@ -23,7 +23,7 @@ class KeyCodesCcGenerator extends BaseCodeGenerator {
final OutputLines<int> lines = OutputLines<int>('Physical Key list');
for (final PhysicalKeyEntry entry in keyData.entries) {
lines.add(entry.usbHidCode, '''
constexpr uint64_t kPhysical${_toUpperCammel(entry.constantName)} = ${toHex(entry.usbHidCode, digits: 8)};''');
constexpr uint64_t kPhysical${_toUpperCammel(entry.constantName)} = ${toHex(entry.usbHidCode)};''');
}
return lines.sortedJoin().trimRight();
}

View File

@@ -15,7 +15,7 @@ Future<void> main() async {
final HttpClient client = HttpClient();
final HttpClientRequest request = await client.getUrl(Uri.parse(registry));
final HttpClientResponse response = await request.close();
final String body = (await response.cast<List<int>>().transform<String>(utf8.decoder).toList()).join('');
final String body = (await response.cast<List<int>>().transform<String>(utf8.decoder).toList()).join();
final File subtagRegistry = File('../language_subtag_registry.dart');
final File subtagRegistryFlutterTools = File('../../../../packages/flutter_tools/lib/src/localizations/language_subtag_registry.dart');

View File

@@ -118,7 +118,7 @@ class LocaleInfo implements Comparable<LocaleInfo> {
return originalString
.split('_')
.map<String>((String part) => part.substring(0, 1).toUpperCase() + part.substring(1).toLowerCase())
.join('');
.join();
}
@override
@@ -232,17 +232,14 @@ GeneratorOptions parseArgs(List<String> rawArgs) {
..addFlag(
'overwrite',
abbr: 'w',
defaultsTo: false,
)
..addFlag(
'material',
help: 'Whether to print the generated classes for the Material package only. Ignored when --overwrite is passed.',
defaultsTo: false,
)
..addFlag(
'cupertino',
help: 'Whether to print the generated classes for the Cupertino package only. Ignored when --overwrite is passed.',
defaultsTo: false,
);
final argslib.ArgResults args = argParser.parse(rawArgs);
final bool writeToFile = args['overwrite'] as bool;

View File

@@ -165,7 +165,7 @@ class SourceStats {
SourceStats getStatsFor(Directory dir, [SourceStats? stats]) {
stats ??= SourceStats();
for (final FileSystemEntity entity in dir.listSync(recursive: false, followLinks: false)) {
for (final FileSystemEntity entity in dir.listSync(followLinks: false)) {
final String name = path.basename(entity.path);
if (entity is File && name.endsWith('.dart')) {
stats.files += 1;

View File

@@ -212,7 +212,7 @@ ArgResults _handleArguments(List<String> args) {
..addOption(_iconsClassPathOption,
defaultsTo: _defaultIconsPath,
help: 'Location of the material icons file')
..addFlag(_dryRunOption, defaultsTo: false);
..addFlag(_dryRunOption);
argParser.addFlag('help', abbr: 'h', negatable: false, callback: (bool help) {
if (help) {
print(argParser.usage);
@@ -289,7 +289,7 @@ String _regenerateIconsFile(String iconData, Map<String, String> tokenPairMap) {
// Generate for Icons
if (line.contains(_beginGeneratedMark)) {
generating = true;
final String iconDeclarationsString = newIcons.map((_Icon icon) => icon.fullDeclaration).join('');
final String iconDeclarationsString = newIcons.map((_Icon icon) => icon.fullDeclaration).join();
buf.write(iconDeclarationsString);
} else if (line.contains(_endGeneratedMark)) {
generating = false;