Use --fatal-infos when analyzing on CI (#184)
Fix some lints.
diff --git a/.github/workflows/test-package.yml b/.github/workflows/test-package.yml
index 8bc4bac..6b79b39 100644
--- a/.github/workflows/test-package.yml
+++ b/.github/workflows/test-package.yml
@@ -32,7 +32,7 @@
if: always() && steps.install.outcome == 'success'
run: dart format --output=none --set-exit-if-changed .
- name: Analyze code
- run: dart analyze
+ run: dart analyze --fatal-infos
if: always() && steps.install.outcome == 'success'
# Run tests on a matrix consisting of three dimensions:
diff --git a/lib/src/usage.dart b/lib/src/usage.dart
index 8b788c5..d37a2f2 100644
--- a/lib/src/usage.dart
+++ b/lib/src/usage.dart
@@ -153,7 +153,8 @@
abbr = math.max(abbr, _abbreviation(option).length);
// Make room for the option.
- title = math.max(title, _longOption(option).length + _mandatoryOption(option).length);
+ title = math.max(
+ title, _longOption(option).length + _mandatoryOption(option).length);
// Make room for the allowed help.
if (option.allowedHelp != null) {
diff --git a/test/allow_anything_test.dart b/test/allow_anything_test.dart
index 2addd26..40bb95b 100644
--- a/test/allow_anything_test.dart
+++ b/test/allow_anything_test.dart
@@ -58,7 +58,7 @@
test('works as a subcommand in a CommandRunner', () async {
var commandRunner = CommandRunner('command', 'Description of command');
var command = AllowAnythingCommand();
- commandRunner..addCommand(command);
+ commandRunner.addCommand(command);
await commandRunner.run([command.name, '--foo', '--bar', '-b', 'qux']);
});
diff --git a/test/command_parse_test.dart b/test/command_parse_test.dart
index c0a2cf2..fd91470 100644
--- a/test/command_parse_test.dart
+++ b/test/command_parse_test.dart
@@ -190,7 +190,7 @@
test('remaining arguments are given to the innermost command', () {
var parser = ArgParser();
- parser.addCommand('cmd')..addCommand('subcmd');
+ parser.addCommand('cmd').addCommand('subcmd');
var args = parser.parse(['cmd', 'subcmd', 'other', 'stuff']);
expect(args.command!.name, equals('cmd'));
diff --git a/test/usage_test.dart b/test/usage_test.dart
index dbcef78..6999724 100644
--- a/test/usage_test.dart
+++ b/test/usage_test.dart
@@ -5,8 +5,6 @@
import 'package:args/args.dart';
import 'package:test/test.dart';
-import 'test_utils.dart';
-
void main() {
group('ArgParser.usage', () {
test('negatable flags show "no-" in title', () {
@@ -414,12 +412,12 @@
''');
});
- test('throw argument error if option is mandatory with a default value', () {
+ test('throw argument error if option is mandatory with a default value',
+ () {
var parser = ArgParser();
expect(
- () => parser.addOption('test', mandatory: true, defaultsTo: 'test'),
- throwsArgumentError
- );
+ () => parser.addOption('test', mandatory: true, defaultsTo: 'test'),
+ throwsArgumentError);
});
group('separators', () {