Enable avoid_escaping_inner_quotes lint (#81153)

This commit is contained in:
Hattomo (TomohiroHattori)
2021-05-20 01:54:02 +09:00
committed by GitHub
parent 0c5f2f4ab9
commit 08a70e7ac8
81 changed files with 192 additions and 192 deletions

View File

@@ -1031,7 +1031,7 @@ class AdbLogReader extends DeviceLogReader {
final String lastLogcatTimestamp = await device.lastLogcatTimestamp();
args.addAll(<String>[
'-T',
if (lastLogcatTimestamp != null) '\'$lastLogcatTimestamp\'' else '0',
if (lastLogcatTimestamp != null) "'$lastLogcatTimestamp'" else '0',
]);
}
final Process process = await processManager.start(device.adbCommandForDevice(args));

View File

@@ -80,7 +80,7 @@ class DeferredComponentsGenSnapshotValidator extends DeferredComponentsValidator
if (!appManifestFile.existsSync()) {
invalidFiles[appManifestFile.path] = 'Error: $appManifestFile does not '
'exist or could not be found. Please ensure an AndroidManifest.xml '
'exists for the app\'s base module.';
"exists for the app's base module.";
return false;
}
XmlDocument document;
@@ -222,37 +222,37 @@ class DeferredComponentsGenSnapshotValidator extends DeferredComponentsValidator
final YamlMap data = loadYaml(cacheFile.readAsStringSync()) as YamlMap;
// validate yaml format.
if (!data.containsKey('loading-units')) {
invalidFiles[cacheFile.path] = 'Invalid loading units yaml file, \'loading-units\' '
invalidFiles[cacheFile.path] = "Invalid loading units yaml file, 'loading-units' "
'entry did not exist.';
return loadingUnits;
} else {
if (data['loading-units'] is! YamlList && data['loading-units'] != null) {
invalidFiles[cacheFile.path] = 'Invalid loading units yaml file, \'loading-units\' '
invalidFiles[cacheFile.path] = "Invalid loading units yaml file, 'loading-units' "
'is not a list.';
return loadingUnits;
}
if (data['loading-units'] != null) {
for (final dynamic loadingUnitData in data['loading-units']) {
if (loadingUnitData is! YamlMap) {
invalidFiles[cacheFile.path] = 'Invalid loading units yaml file, \'loading-units\' '
invalidFiles[cacheFile.path] = "Invalid loading units yaml file, 'loading-units' "
'is not a list of maps.';
return loadingUnits;
}
final YamlMap loadingUnitDataMap = loadingUnitData as YamlMap;
if (loadingUnitDataMap['id'] == null) {
invalidFiles[cacheFile.path] = 'Invalid loading units yaml file, all '
'loading units must have an \'id\'';
"loading units must have an 'id'";
return loadingUnits;
}
if (loadingUnitDataMap['libraries'] != null) {
if (loadingUnitDataMap['libraries'] is! YamlList) {
invalidFiles[cacheFile.path] = 'Invalid loading units yaml file, \'libraries\' '
invalidFiles[cacheFile.path] = "Invalid loading units yaml file, 'libraries' "
'is not a list.';
return loadingUnits;
}
for (final dynamic node in loadingUnitDataMap['libraries'] as YamlList) {
if (node is! String) {
invalidFiles[cacheFile.path] = 'Invalid loading units yaml file, \'libraries\' '
invalidFiles[cacheFile.path] = "Invalid loading units yaml file, 'libraries' "
'is not a list of strings.';
return loadingUnits;
}

View File

@@ -388,7 +388,7 @@ final GradleHandledError minSdkVersion = GradleHandledError(
' }\n'
'}\n\n'
)+
'Note that your app won\'t be available to users running Android SDKs below ${minSdkVersionMatch.group(2)}.\n'
"Note that your app won't be available to users running Android SDKs below ${minSdkVersionMatch.group(2)}.\n"
'Alternatively, try to find a version of this plugin that supports these lower versions of the Android SDK.'
);
return GradleBuildStatus.exit;

View File

@@ -110,13 +110,13 @@ distributionUrl=https\\://services.gradle.org/distributions/gradle-$gradleVersio
String getGradleVersionForAndroidPlugin(Directory directory, Logger logger) {
final File buildFile = directory.childFile('build.gradle');
if (!buildFile.existsSync()) {
logger.printTrace('$buildFile doesn\'t exist, assuming AGP version: $_defaultGradleVersion');
logger.printTrace("$buildFile doesn't exist, assuming AGP version: $_defaultGradleVersion");
return _defaultGradleVersion;
}
final String buildFileContent = buildFile.readAsStringSync();
final Iterable<Match> pluginMatches = _androidPluginRegExp.allMatches(buildFileContent);
if (pluginMatches.isEmpty) {
logger.printTrace('$buildFile doesn\'t provide an AGP version, assuming AGP version: $_defaultGradleVersion');
logger.printTrace("$buildFile doesn't provide an AGP version, assuming AGP version: $_defaultGradleVersion");
return _defaultGradleVersion;
}
final String androidPluginVersion = pluginMatches.first.group(1);

View File

@@ -90,7 +90,7 @@ class ErrorHandlingFileSystem extends ForwardingFileSystem {
if (file.existsSync()) {
throwToolExit(
'The Flutter tool tried to delete the file or directory ${file.path} but was '
'unable to. This may be due to the file and/or project\'s location on a read-only '
"unable to. This may be due to the file and/or project's location on a read-only "
'volume. Consider relocating the project and trying again',
);
}

View File

@@ -351,7 +351,7 @@ class _LinuxUtils extends _PosixUtils {
final String value = entryKeyValuePair[1];
// Remove quotes from either end of the value if they exist
final String quote = value[0];
if (quote == '\'' || quote == '"') {
if (quote == "'" || quote == '"') {
return value.substring(0, value.length - 1).substring(1);
} else {
return value;

View File

@@ -63,7 +63,7 @@ class BuildApkCommand extends BuildSubCommand {
"This command can build debug and release versions of your application. 'debug' builds support "
"debugging and a quick development cycle. 'release' builds don't support debugging and are "
'suitable for deploying to app stores. If you are deploying the app to the Play Store, '
'it\'s recommended to use app bundles or split the APK to reduce the APK size. Learn more at:\n\n'
"it's recommended to use app bundles or split the APK to reduce the APK size. Learn more at:\n\n"
' * https://developer.android.com/guide/app-bundle\n'
' * https://developer.android.com/studio/build/configure-apk-splits#configure-abi-split';

View File

@@ -128,11 +128,11 @@ class GenerateLocalizationsCommand extends FlutterCommand {
'gen-inputs-and-outputs-list',
valueHelp: 'path-to-output-directory',
help: 'When specified, the tool generates a JSON file containing the '
'tool\'s inputs and outputs named gen_l10n_inputs_and_outputs.json.\n'
"tool's inputs and outputs named gen_l10n_inputs_and_outputs.json.\n"
'\n'
'This can be useful for keeping track of which files of the Flutter '
'project were used when generating the latest set of localizations. '
'For example, the Flutter tool\'s build system uses this file to '
"For example, the Flutter tool's build system uses this file to "
'keep track of when to call gen_l10n during hot reload.\n'
'\n'
'The value of this option is the directory where the JSON file will be '

View File

@@ -23,7 +23,7 @@ import '../runner/flutter_command.dart';
class PackagesCommand extends FlutterCommand {
PackagesCommand() {
addSubcommand(PackagesGetCommand('get', false));
addSubcommand(PackagesInteractiveGetCommand('upgrade', 'Upgrade the current package\'s dependencies to latest versions.'));
addSubcommand(PackagesInteractiveGetCommand('upgrade', "Upgrade the current package's dependencies to latest versions."));
addSubcommand(PackagesInteractiveGetCommand('add', 'Add a dependency to pubspec.yaml.'));
addSubcommand(PackagesInteractiveGetCommand('remove', 'Removes a dependency from the current package.'));
addSubcommand(PackagesTestCommand());

View File

@@ -261,7 +261,7 @@ class RunCommand extends RunCommandBase {
'or just dump the trace as soon as the application is running. The first frame '
'is detected by looking for a Timeline event with the name '
'"${Tracing.firstUsefulFrameEventName}". '
'By default, the widgets library\'s binding takes care of sending this event.',
"By default, the widgets library's binding takes care of sending this event.",
)
..addFlag('use-test-fonts',
negatable: true,

View File

@@ -44,7 +44,7 @@ class ScreenshotCommand extends FlutterCommand {
help: 'The type of screenshot to retrieve.',
allowed: const <String>[_kDeviceType, _kSkiaType, _kRasterizerType],
allowedHelp: const <String, String>{
_kDeviceType: 'Delegate to the device\'s native screenshot capabilities. This '
_kDeviceType: "Delegate to the device's native screenshot capabilities. This "
'screenshots the entire screen currently being displayed (including content '
'not rendered by Flutter, like the device status bar).',
_kSkiaType: 'Render the Flutter app as a Skia picture. Requires "--$_kObservatoryUrl".',

View File

@@ -246,15 +246,15 @@ class UpgradeCommandRunner {
if (errorString.contains('fatal: HEAD does not point to a branch')) {
throwToolExit(
'You are not currently on a release branch. Use git to '
'check out an official branch (\'stable\', \'beta\', \'dev\', or \'master\') '
"check out an official branch ('stable', 'beta', 'dev', or 'master') "
'and retry, for example:\n'
' git checkout stable'
);
} else if (errorString.contains('fatal: no upstream configured for branch')) {
throwToolExit(
'Unable to upgrade Flutter: no origin repository configured. '
'Run \'git remote add origin '
'https://github.com/flutter/flutter\' in $workingDirectory');
"Run 'git remote add origin "
"https://github.com/flutter/flutter' in $workingDirectory");
} else {
throwToolExit(errorString);
}

View File

@@ -1098,7 +1098,7 @@ List<PluginInterfaceResolution> resolvePlatformImplementation(
if (defaultImplementation == null) {
if (throwOnPluginPubspecError) {
globals.printError(
'Plugin `${plugin.name}` doesn\'t implement a plugin interface, nor sets '
"Plugin `${plugin.name}` doesn't implement a plugin interface, nor sets "
'a default implementation in pubspec.yaml.\n\n'
'To set a default implementation, use:\n'
'flutter:\n'

View File

@@ -106,7 +106,7 @@ class WebExpressionCompiler implements ExpressionCompiler {
}
return ExpressionCompilationResult(
'InternalError: frontend server failed to compile \'$expression\'',
"InternalError: frontend server failed to compile '$expression'",
true);
}

View File

@@ -107,7 +107,7 @@ String generateDateFormattingLogic(Message message) {
'the "${placeholder.type}" type. To properly resolve for the right '
'${placeholder.type} format, the "format" attribute needs to be set '
'to determine which DateFormat to use. \n'
'Check the intl library\'s DateFormat class constructors for allowed '
"Check the intl library's DateFormat class constructors for allowed "
'date formats.'
);
}
@@ -115,7 +115,7 @@ String generateDateFormattingLogic(Message message) {
throw L10nException(
'Date format "$placeholderFormat" for placeholder '
'${placeholder.name} does not have a corresponding DateFormat '
'constructor\n. Check the intl library\'s DateFormat class '
"constructor\n. Check the intl library's DateFormat class "
'constructors for allowed date formats.'
);
}
@@ -140,7 +140,7 @@ String generateNumberFormattingLogic(Message message) {
throw L10nException(
'Number format $placeholderFormat for the ${placeholder.name} '
'placeholder does not have a corresponding NumberFormat constructor.\n'
'Check the intl library\'s NumberFormat class constructors for allowed '
"Check the intl library's NumberFormat class constructors for allowed "
'number formats.'
);
}
@@ -765,7 +765,7 @@ class LocalizationsGenerator {
if (!directory.existsSync()) {
throw L10nException(
'Directory does not exist: $directory.\n'
'Please select a directory that contains the project\'s localizations '
"Please select a directory that contains the project's localizations "
'resource files.'
);
}
@@ -1078,18 +1078,18 @@ class LocalizationsGenerator {
final String? scriptCode = locale.scriptCode;
if (countryCode == null && scriptCode == null) {
return 'Locale(\'$languageCode\')';
return "Locale('$languageCode')";
} else if (countryCode != null && scriptCode == null) {
return 'Locale(\'$languageCode\', \'$countryCode\')';
return "Locale('$languageCode', '$countryCode')";
} else if (countryCode != null && scriptCode != null) {
return 'Locale.fromSubtags(languageCode: \'$languageCode\', countryCode: \'$countryCode\', scriptCode: \'$scriptCode\')';
return "Locale.fromSubtags(languageCode: '$languageCode', countryCode: '$countryCode', scriptCode: '$scriptCode')";
} else {
return 'Locale.fromSubtags(languageCode: \'$languageCode\', scriptCode: \'$scriptCode\')';
return "Locale.fromSubtags(languageCode: '$languageCode', scriptCode: '$scriptCode')";
}
});
final Set<String> supportedLanguageCodes = Set<String>.from(
_allBundles.locales.map<String>((LocaleInfo locale) => '\'${locale.languageCode}\'')
_allBundles.locales.map<String>((LocaleInfo locale) => "'${locale.languageCode}'")
);
final List<LocaleInfo> allLocales = _allBundles.locales.toList()..sort();

View File

@@ -408,7 +408,7 @@ class CocoaPods {
// the old parsed .flutter-plugins file, prompt the regeneration. Old line was:
// plugin_pods = parse_KV_file('../.flutter-plugins')
if (xcodeProject.podfile.existsSync() &&
xcodeProject.podfile.readAsStringSync().contains('.flutter-plugins\'')) {
xcodeProject.podfile.readAsStringSync().contains(".flutter-plugins'")) {
const String error = 'Warning: Podfile is out of date\n'
'$outOfDatePluginsPodfileConsequence\n'
'To regenerate the Podfile, run:\n';