Skip to content

Commit d259ffd

Browse files
authored
Develop (#18)
Project cleanup.
1 parent 5e7de92 commit d259ffd

8 files changed

+14
-13
lines changed

lib/src/common/project.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,7 @@ extension on File {
229229
final endIndex = content.indexOf("pluginClass:");
230230

231231
if (startIndex == -1 || endIndex == -1) {
232-
throw KlutterException(
232+
throw const KlutterException(
233233
"Failed to find tag plugin:platforms:android:package in pubspec.yaml",
234234
);
235235
}

test/src/cli/cli_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ void main() {
3232
});
3333

3434
test("Execute task using main execute entrypoint", () async {
35-
final task = TaskName.gradle;
35+
const task = TaskName.gradle;
3636
final context = Context(Directory.systemTemp, {});
3737
final result = await execute(task, context);
3838
expect(result.contains("Received invalid command"), true);

test/src/cli/option_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import "package:test/test.dart";
2323

2424
void main() {
2525
test("Verify InputException toString", () {
26-
expect(InputException("splash!").toString(),
26+
expect(const InputException("splash!").toString(),
2727
"InputException with cause: 'splash!'");
2828
});
2929

@@ -77,7 +77,7 @@ void main() {
7777
});
7878

7979
group("GroupNameOption throws exception if input is not a bool", () {
80-
final option = GroupNameOption();
80+
const option = GroupNameOption();
8181
void testThrowing(String groupName, String message) {
8282
test("$groupName throws $message", () {
8383
expect(

test/src/cli/task_project_clean_cache_test.dart

+2-2
Original file line numberDiff line numberDiff line change
@@ -128,12 +128,12 @@ class DirectoryStub implements Directory {
128128

129129
@override
130130
Future<FileSystemEntity> delete({bool recursive = false}) {
131-
throw KlutterException("BOOM!");
131+
throw const KlutterException("BOOM!");
132132
}
133133

134134
@override
135135
void deleteSync({bool recursive = false}) {
136-
throw KlutterException("BOOM!");
136+
throw const KlutterException("BOOM!");
137137
}
138138

139139
@override

test/src/cli/task_service_test.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ void main() {
3939
expect(
4040
tasks.getTask(TaskName.add).toString(),
4141
"add\n lib (Required) name of the library to add.\n"
42-
" root (Optional) klutter project root directory. Defaults to \'current working directory\'.\n",
42+
" root (Optional) klutter project root directory. Defaults to 'current working directory'.\n",
4343
);
4444

4545
expect(
4646
tasks.getTask(TaskName.init).toString(),
47-
"init\n bom (Optional) klutter gradle version. Defaults to '2024.1.1.beta'.\n flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n root (Optional) klutter project root directory. Defaults to \'current working directory\'.\n ios (Optional) ios version. Defaults to \'13.0\'.\n",
47+
"init\n bom (Optional) klutter gradle version. Defaults to '2024.1.1.beta'.\n flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n root (Optional) klutter project root directory. Defaults to 'current working directory'.\n ios (Optional) ios version. Defaults to '13.0'.\n",
4848
);
4949
});
5050

@@ -78,7 +78,7 @@ void main() {
7878
" bom (Optional) klutter gradle version. Defaults to '2024.1.1.beta'.\n"
7979
" flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n"
8080
" root (Optional) klutter project root directory. Defaults to 'current working directory'.\n"
81-
" ios (Optional) ios version. Defaults to \'13.0\'.\n"
81+
" ios (Optional) ios version. Defaults to '13.0'.\n"
8282
"\n"
8383
"get\n"
8484
" flutter (Optional) flutter sdk version in format major.minor.patch. Defaults to '3.10.6'.\n"

test/src/cli/task_test.dart

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ void main() {
3636
final result =
3737
await _InvalidTask().execute(Context(Directory.systemTemp, {}));
3838
expect(result.isOk, false);
39-
expect(result.message, "unsupported value: Instance of \'FakeInput\'");
39+
expect(result.message, "unsupported value: Instance of 'FakeInput'");
4040
});
4141

4242
test("An exception is thrown when unsupported options are present", () async {
@@ -48,9 +48,9 @@ void main() {
4848
});
4949

5050
test("Verify toTaskOptionOrNull for valid options", () async {
51-
TaskOption.values.forEach((value) {
51+
for (final value in TaskOption.values) {
5252
expect(value.name.toTaskOptionOrNull, value, reason: "roundtrip $value");
53-
});
53+
}
5454
});
5555
}
5656

test/src/common/exception_test.dart

+1-1
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ import "package:test/test.dart";
2424
void main() {
2525
test("Verify exception toString returns a readable message", () {
2626
expect(
27-
() => throw KlutterException("BOOM!"),
27+
() => throw const KlutterException("BOOM!"),
2828
throwsA(predicate((e) =>
2929
e is KlutterException &&
3030
e.toString() == "KlutterException with cause: 'BOOM!'")));

test/src/systemtest/e2e_test.dart

+1
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,7 @@ void main() {
238238
}
239239
});
240240
} catch (e, s) {
241+
// ignore: avoid_print
241242
print(s);
242243
}
243244

0 commit comments

Comments
 (0)