Deprecate and ignore the --strong flag on dartanalyzer.
Change-Id: Icb5adae9a628b96394a4249d6326c24acc40a8fc
Reviewed-on: https://dart-review.googlesource.com/63700
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
diff --git a/pkg/analyzer/lib/src/command_line/arguments.dart b/pkg/analyzer/lib/src/command_line/arguments.dart
index a0a3140..26a8e34 100644
--- a/pkg/analyzer/lib/src/command_line/arguments.dart
+++ b/pkg/analyzer/lib/src/command_line/arguments.dart
@@ -169,9 +169,9 @@
'This option cannot be used with --packages.',
hide: ddc && hide);
parser.addFlag(strongModeFlag,
- help: 'Enable strong static checks (https://goo.gl/DqcBsw).',
+ help: 'Enable strong mode (deprecated); this option is now ignored.',
defaultsTo: true,
- hide: ddc,
+ hide: true,
negatable: true);
parser.addFlag(declarationCastsFlag,
negatable: true,
diff --git a/pkg/analyzer/test/src/command_line/arguments_test.dart b/pkg/analyzer/test/src/command_line/arguments_test.dart
index 8cbef81..1634449 100644
--- a/pkg/analyzer/test/src/command_line/arguments_test.dart
+++ b/pkg/analyzer/test/src/command_line/arguments_test.dart
@@ -40,7 +40,6 @@
'--options=$defaultAnalysisOptionsFilePath',
'--packages=$defaultPackageFilePath',
'--package-root=$defaultPackagesDirectoryPath',
- '--strong',
'--supermixin',
];
ArgResults result = parse(provider, parser, args);
diff --git a/pkg/analyzer_cli/lib/src/options.dart b/pkg/analyzer_cli/lib/src/options.dart
index d0521d3..2fcf27e 100644
--- a/pkg/analyzer_cli/lib/src/options.dart
+++ b/pkg/analyzer_cli/lib/src/options.dart
@@ -142,7 +142,9 @@
final bool infosAreFatal;
/// Whether to use strong static checking.
- final bool strongMode;
+ ///
+ /// This flag is deprecated and hard-coded to `true`.
+ final bool strongMode = true;
/// Whether implicit casts are enabled (in strong mode)
final bool implicitCasts;
@@ -202,7 +204,6 @@
infosAreFatal = args['fatal-infos'] || args['fatal-hints'],
warningsAreFatal = args['fatal-warnings'],
lintsAreFatal = args['fatal-lints'],
- strongMode = args['strong'],
implicitCasts = args[implicitCastsFlag],
implicitDynamic = !args['no-implicit-dynamic'],
verbose = args['verbose'],
@@ -589,6 +590,13 @@
return null; // Only reachable in testing.
}
}
+
+ if (results.wasParsed(strongModeFlag)) {
+ errorSink.writeln(
+ 'Note: the --strong flag is deprecated and will be removed in an '
+ 'future release.\n');
+ }
+
return new CommandLineOptions._fromArgs(results);
} on FormatException catch (e) {
errorSink.writeln(e.message);
diff --git a/pkg/analyzer_cli/test/driver_test.dart b/pkg/analyzer_cli/test/driver_test.dart
index 6619bc3..e832287 100644
--- a/pkg/analyzer_cli/test/driver_test.dart
+++ b/pkg/analyzer_cli/test/driver_test.dart
@@ -245,7 +245,6 @@
await new Driver(isTesting: true).start([
'--dart-sdk',
_findSdkDirForSummaries(),
- '--strong',
'--build-mode',
'--build-summary-unlinked-input=$aUnlinked,$bUnlinked',
'--build-summary-output=$abLinked'
@@ -372,7 +371,6 @@
await _doDrive(testDart,
additionalArgs: [
- '--strong',
'--build-summary-only',
'--build-summary-output=$testSum'
],
@@ -959,7 +957,7 @@
test_strongSdk() async {
String testDir = path.join(testDirectory, 'data', 'strong_sdk');
- await drive(path.join(testDir, 'main.dart'), args: ['--strong']);
+ await drive(path.join(testDir, 'main.dart'));
expect(analysisOptions.strongMode, isTrue);
expect(outSink.toString(), contains('No issues found'));
}
diff --git a/pkg/analyzer_cli/test/options_test.dart b/pkg/analyzer_cli/test/options_test.dart
index 4ffddfe..712f212 100644
--- a/pkg/analyzer_cli/test/options_test.dart
+++ b/pkg/analyzer_cli/test/options_test.dart
@@ -195,12 +195,6 @@
expect(options.sourceFiles, equals(['foo.dart']));
});
- test('strong mode', () {
- CommandLineOptions options =
- CommandLineOptions.parse(['--strong', 'foo.dart']);
- expect(options.strongMode, isTrue);
- });
-
test('hintsAreFatal', () {
CommandLineOptions options = CommandLineOptions
.parse(['--dart-sdk', '.', '--fatal-lints', 'foo.dart']);
diff --git a/pkg/analyzer_cli/test/strong_mode_test.dart b/pkg/analyzer_cli/test/strong_mode_test.dart
index 51c647c..30f7815 100644
--- a/pkg/analyzer_cli/test/strong_mode_test.dart
+++ b/pkg/analyzer_cli/test/strong_mode_test.dart
@@ -16,7 +16,7 @@
defineReflectiveTests(StrongModeTest);
}
-/// End-to-end test for --strong checking.
+/// End-to-end test for strong checking.
///
/// Most strong mode tests are in Analyzer, but this verifies the option is
/// working and producing extra errors as expected.
@@ -26,7 +26,7 @@
@reflectiveTest
class StrongModeTest extends BaseTest {
test_producesStricterErrors() async {
- await drive('data/strong_example.dart', args: ['--strong']);
+ await drive('data/strong_example.dart');
expect(exitCode, 3);
var stdout = bulletToDash(outSink);