Skip to content
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

Use lint unreachable_from_main #4244

Merged
merged 1 commit into from
May 14, 2024
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions analysis_options.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,4 +45,5 @@ linter:
- unnecessary_library_directive
- unnecessary_parenthesis
- unnecessary_statements
- unreachable_from_main
- use_enums
5 changes: 0 additions & 5 deletions test/ascii_tree_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,6 @@ import 'descriptor.dart';
import 'golden_file.dart';
import 'test_pub.dart';

/// Removes ansi color codes from [s].
String stripColors(String s) {
return s.replaceAll(RegExp('\u001b\\[.*?m'), '');
}

void main() {
setUp(() {
forceColors = ForceColorOption.always;
Expand Down
8 changes: 6 additions & 2 deletions test/golden_file.dart
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import 'package:pub/src/io.dart';
import 'package:stack_trace/stack_trace.dart' show Trace;
import 'package:test/test.dart';

import 'ascii_tree_test.dart';
import 'descriptor.dart' as d;
import 'test_pub.dart';

Expand Down Expand Up @@ -176,6 +175,11 @@ class GoldenTestContext {
_expectSection(sectionIndex, s.toString());
}

/// Removes ansi color codes from [s].
String _stripColors(String s) {
return s.replaceAll(RegExp('\u001b\\[.*?m'), '');
}

/// Log directory tree structure under [directory] to golden file.
Future<void> tree([String? directory]) async {
// Create new section index number (before doing anything async)
Expand All @@ -194,7 +198,7 @@ class GoldenTestContext {
baseDir: target,
showFileSizes: false,
);
s.writeln(colors ? tree : stripColors(tree));
s.writeln(colors ? tree : _stripColors(tree));

_expectSection(sectionIndex, s.toString());
}
Expand Down
2 changes: 0 additions & 2 deletions test/validator/file_case_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ Future<void> expectValidation(Matcher error, int exitCode) async {
);
}

late d.DirectoryDescriptor fakeFlutterRoot;

void main() {
test('Recognizes files that only differ in capitalization.', () async {
await d.validPackage().create();
Expand Down
2 changes: 0 additions & 2 deletions tool/test-bin/pub_command_runner.dart
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ class ThrowingCommand extends PubCommand {
@override
String get description => 'Throws an exception';

bool get hide => true;

@override
Future<int> runProtected() async {
throw StateError('Pub has crashed');
Expand Down