Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Remove unnecessary null checks in dev/conductor #118843

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jan 20, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion dev/conductor/core/lib/src/globals.dart
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ List<String> getValuesFromEnvOrArgs(
if (env[envName] != null && env[envName] != '') {
return env[envName]!.split(',');
}
final List<String> argValues = argResults[name] as List<String>;
final List<String>? argValues = argResults[name] as List<String>?;
if (argValues != null) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually, I think the bug here is that the cast on 129 should be nullable:

  final List<String> argValues = argResults[name] as List<String>?;

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh, totally. Fixed. Thanks for the catch!

return argValues;
}
Expand Down
2 changes: 0 additions & 2 deletions dev/conductor/core/lib/src/repository.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ class Remote {
required RemoteName name,
required this.url,
}) : _name = name,
assert(url != null),
assert(url != '');

factory Remote.mirror(String url) {
Expand Down Expand Up @@ -241,7 +240,6 @@ abstract class Repository {

/// The URL of the remote named [remoteName].
Future<String> remoteUrl(String remoteName) async {
assert(remoteName != null);
return git.getOutput(
<String>['remote', 'get-url', remoteName],
'verify the URL of the $remoteName remote',
Expand Down
4 changes: 1 addition & 3 deletions dev/conductor/core/lib/src/state.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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!');
Expand Down
1 change: 0 additions & 1 deletion dev/conductor/core/lib/src/version.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down