unnecessary escapes fixes (#50178)

* unnecessary escapes fixes

* replace some strings with raw strings

* update regexp

* address review comments
This commit is contained in:
Alexandre Ardhuin
2020-02-07 06:35:50 +01:00
committed by GitHub
parent b8199abd15
commit 5c28e3eeea
19 changed files with 39 additions and 39 deletions

View File

@@ -128,7 +128,7 @@ void main() {
// If the next line fails, your device may not support regexp search.
final String observatoryLine = await device.adb(<String>['logcat', '-e', 'Observatory listening on http:', '-m', '1', '-T', currentTime]);
print('Found observatory line: $observatoryLine');
final String observatoryUri = RegExp('Observatory listening on ((http|\/\/)[a-zA-Z0-9:/=_\\-\.\\[\\]]+)').firstMatch(observatoryLine)[1];
final String observatoryUri = RegExp(r'Observatory listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)').firstMatch(observatoryLine)[1];
print('Extracted observatory port: $observatoryUri');
section('Launching attach with given port');

View File

@@ -47,7 +47,7 @@ void main() {
await device.shellExec('am', <String>['start', '-n', _kActivityId]);
final String observatoryLine = await device.adb(<String>['logcat', '-e', 'Observatory listening on http:', '-m', '1', '-T', currentTime]);
print('Found observatory line: $observatoryLine');
final String observatoryUri = RegExp('Observatory listening on ((http|\/\/)[a-zA-Z0-9:/=_\\-\.\\[\\]]+)').firstMatch(observatoryLine)[1];
final String observatoryUri = RegExp(r'Observatory listening on ((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)').firstMatch(observatoryLine)[1];
print('Extracted observatory port: $observatoryUri');
final Process attachProcess =
await _run(device: device, command: <String>['attach', '--debug-uri',

View File

@@ -589,7 +589,7 @@ String extractCloudAuthTokenArg(List<String> rawArgs) {
final RegExp _obsRegExp =
RegExp('An Observatory debugger .* is available at: ');
final RegExp _obsPortRegExp = RegExp('(\\S+:(\\d+)/\\S*)\$');
final RegExp _obsUriRegExp = RegExp('((http|\/\/)[a-zA-Z0-9:/=_\\-\.\\[\\]]+)');
final RegExp _obsUriRegExp = RegExp(r'((http|//)[a-zA-Z0-9:/=_\-\.\[\]]+)');
/// Tries to extract a port from the string.
///

View File

@@ -55,7 +55,7 @@ TaskFunction createHotModeTest({String deviceIdOverride, Map<String, String> env
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
if (line.contains('\] Reloaded ')) {
if (line.contains('] Reloaded ')) {
if (hotReloadCount == 0) {
// Update the file and reload again.
final File appDartSource = file(path.join(
@@ -108,7 +108,7 @@ TaskFunction createHotModeTest({String deviceIdOverride, Map<String, String> env
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
if (line.contains('\] Reloaded ')) {
if (line.contains('] Reloaded ')) {
process.stdin.writeln('q');
}
print('stdout: $line');

View File

@@ -32,7 +32,7 @@ TaskFunction createRunWithoutLeakTest(dynamic dir) {
.transform<String>(utf8.decoder)
.transform<String>(const LineSplitter())
.listen((String line) {
if (line.contains('\] For a more detailed help message, press "h". To detach, press "d"; to quit, press "q"')) {
if (line.contains('] For a more detailed help message, press "h". To detach, press "d"; to quit, press "q"')) {
process.stdin.writeln('q');
}
print('stdout: $line');

View File

@@ -168,7 +168,7 @@ String getFullTag() {
}
Match parseFullTag(String version) {
final RegExp versionPattern = RegExp('^v([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)-g([a-f0-9]+)\$');
final RegExp versionPattern = RegExp(r'^v([0-9]+)\.([0-9]+)\.([0-9]+)-([0-9]+)-g([a-f0-9]+)$');
return versionPattern.matchAsPrefix(version);
}

View File

@@ -75,7 +75,7 @@ bool isPluralVariation(String key, Map<String, dynamic> bundle) {
void updateMissingResources(String localizationPath, String groupPrefix) {
final Directory localizationDir = Directory(localizationPath);
final RegExp filenamePattern = RegExp('${groupPrefix}_(\\w+)\.arb');
final RegExp filenamePattern = RegExp('${groupPrefix}_(\\w+)\\.arb');
final Set<String> requiredKeys = resourceKeys(loadBundle(File(path.join(localizationPath, '${groupPrefix}_en.arb'))));

View File

@@ -66,8 +66,8 @@ import 'messages_all.dart';
/// Callers can lookup localized strings with an instance of @(className) returned
/// by `@(className).of(context)`.
///
/// Applications need to include `@(className).delegate()` in their app\'s
/// localizationDelegates list, and the locales they support in the app\'s
/// Applications need to include `@(className).delegate()` in their app's
/// localizationDelegates list, and the locales they support in the app's
/// supportedLocales list. For example:
///
/// ```

View File

@@ -952,12 +952,12 @@ void main() {
return Intl.plural(
count,
locale: _localeName,
name: \'helloWorlds\',
name: 'helloWorlds',
args: <Object>[count, currentDate],
one: \'Hello World, today is \${currentDateString}\',
two: \'Hello two worlds, today is \${currentDateString}\',
many: \'Hello all \${count} worlds, today is \${currentDateString}\',
other: \'Hello other \${count} worlds, today is \${currentDateString}\'
one: 'Hello World, today is \${currentDateString}',
two: 'Hello two worlds, today is \${currentDateString}',
many: 'Hello all \${count} worlds, today is \${currentDateString}',
other: 'Hello other \${count} worlds, today is \${currentDateString}'
);
}
return helloWorlds(count, currentDateString);
@@ -1334,12 +1334,12 @@ void main() {
return Intl.plural(
count,
locale: _localeName,
name: \'helloWorlds\',
name: 'helloWorlds',
args: <Object>[count, currentDate],
one: \'Hello World, today is \${currentDateString}\',
two: \'Hello two worlds, today is \${currentDateString}\',
many: \'Hello all \${count} worlds, today is \${currentDateString}\',
other: \'Hello other \${count} worlds, today is \${currentDateString}\'
one: 'Hello World, today is \${currentDateString}',
two: 'Hello two worlds, today is \${currentDateString}',
many: 'Hello all \${count} worlds, today is \${currentDateString}',
other: 'Hello other \${count} worlds, today is \${currentDateString}'
);
}
return helloWorlds(count, currentDateString);
@@ -1393,12 +1393,12 @@ void main() {
return Intl.plural(
count,
locale: _localeName,
name: \'helloWorlds\',
name: 'helloWorlds',
args: <Object>[count, population],
one: \'Hello World of \${populationString} citizens\',
two: \'Hello two worlds with \${populationString} total citizens\',
many: \'Hello all \${count} worlds, with a total of \${populationString} citizens\',
other: \'Hello other \${count} worlds, with a total of \${populationString} citizens\'
one: 'Hello World of \${populationString} citizens',
two: 'Hello two worlds with \${populationString} total citizens',
many: 'Hello all \${count} worlds, with a total of \${populationString} citizens',
other: 'Hello other \${count} worlds, with a total of \${populationString} citizens'
);
}
return helloWorlds(count, populationString);

View File

@@ -292,7 +292,7 @@ class SvgPath {
final List<SvgPathCommand> commands;
final double opacity;
static const String _pathCommandAtom = ' *([a-zA-Z]) *([\-\.0-9 ,]*)';
static const String _pathCommandAtom = r' *([a-zA-Z]) *([\-\.0-9 ,]*)';
static final RegExp _pathCommandValidator = RegExp('^($_pathCommandAtom)*\$');
static final RegExp _pathCommandMatcher = RegExp(_pathCommandAtom);