From ec51d3271e8f7ec5089bb5d23c57c8450881c9d5 Mon Sep 17 00:00:00 2001 From: Michael Goderbauer Date: Thu, 19 Jan 2023 20:04:08 -0800 Subject: [PATCH] =?UTF-8?q?Remove=20unnecessary=20null=20checks=20in=20?= =?UTF-8?q?=E2=80=98dev/conductor=E2=80=99=20(#118843)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Remove unnecessary null checks in dev/conductor * review --- dev/conductor/core/lib/src/globals.dart | 2 +- dev/conductor/core/lib/src/repository.dart | 2 -- dev/conductor/core/lib/src/state.dart | 4 +--- dev/conductor/core/lib/src/version.dart | 1 - 4 files changed, 2 insertions(+), 7 deletions(-) diff --git a/dev/conductor/core/lib/src/globals.dart b/dev/conductor/core/lib/src/globals.dart index 52d31b753910..4cde3004b81c 100644 --- a/dev/conductor/core/lib/src/globals.dart +++ b/dev/conductor/core/lib/src/globals.dart @@ -126,7 +126,7 @@ List getValuesFromEnvOrArgs( if (env[envName] != null && env[envName] != '') { return env[envName]!.split(','); } - final List argValues = argResults[name] as List; + final List? argValues = argResults[name] as List?; if (argValues != null) { return argValues; } diff --git a/dev/conductor/core/lib/src/repository.dart b/dev/conductor/core/lib/src/repository.dart index eff3fa1add4e..e047d5b6be4f 100644 --- a/dev/conductor/core/lib/src/repository.dart +++ b/dev/conductor/core/lib/src/repository.dart @@ -28,7 +28,6 @@ class Remote { required RemoteName name, required this.url, }) : _name = name, - assert(url != null), assert(url != ''); factory Remote.mirror(String url) { @@ -241,7 +240,6 @@ abstract class Repository { /// The URL of the remote named [remoteName]. Future remoteUrl(String remoteName) async { - assert(remoteName != null); return git.getOutput( ['remote', 'get-url', remoteName], 'verify the URL of the $remoteName remote', diff --git a/dev/conductor/core/lib/src/state.dart b/dev/conductor/core/lib/src/state.dart index a7e850d14efc..729e02446c24 100644 --- a/dev/conductor/core/lib/src/state.dart +++ b/dev/conductor/core/lib/src/state.dart @@ -86,8 +86,7 @@ String presentState(pb.ConductorState state) { } else { buffer.writeln('0 Engine cherrypicks.'); } - if (state.engine.dartRevision != null && - state.engine.dartRevision.isNotEmpty) { + if (state.engine.dartRevision.isNotEmpty) { buffer.writeln('New Dart SDK revision: ${state.engine.dartRevision}'); } buffer.writeln('Framework Repo'); @@ -271,7 +270,6 @@ String githubAccount(String remoteUrl) { /// Will throw a [ConductorException] if [ReleasePhase.RELEASE_COMPLETED] is /// passed as an argument, as there is no next phase. ReleasePhase getNextPhase(ReleasePhase currentPhase) { - assert(currentPhase != null); final ReleasePhase? nextPhase = ReleasePhase.valueOf(currentPhase.value + 1); if (nextPhase == null) { throw globals.ConductorException('There is no next ReleasePhase!'); diff --git a/dev/conductor/core/lib/src/version.dart b/dev/conductor/core/lib/src/version.dart index dc61f74dfa0f..3b16e1511062 100644 --- a/dev/conductor/core/lib/src/version.dart +++ b/dev/conductor/core/lib/src/version.dart @@ -77,7 +77,6 @@ class Version { /// `flutter --version` and match one of `stablePattern`, `developmentPattern` /// and `latestPattern`. factory Version.fromString(String versionString) { - assert(versionString != null); versionString = versionString.trim(); // stable tag