Skip to content
This repository was archived by the owner on Nov 20, 2024. It is now read-only.

Commit c4ce27f

Browse files
author
Olivier Chafik
committed
Add --strong flag for strongMode
1 parent 35bbc6d commit c4ce27f

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

bin/linter.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ void runLinter(List<String> args, LinterOptions initialLintOptions) {
5757
help: 'Print results in a format suitable for parsing.',
5858
defaultsTo: false,
5959
negatable: false)
60+
..addFlag('strong', help: 'Use strong-mode analyzer.')
6061
..addOption('config', abbr: 'c', help: 'Use configuration from this file.')
6162
..addOption('dart-sdk', help: 'Custom path to a Dart SDK.')
6263
..addOption('rules',
@@ -120,6 +121,9 @@ void runLinter(List<String> args, LinterOptions initialLintOptions) {
120121
lintOptions.dartSdkPath = customSdk;
121122
}
122123

124+
var strongMode = options['strong'];
125+
if (strongMode != null) lintOptions.strongMode = strongMode;
126+
123127
var customPackageRoot = options['package-root'];
124128
if (customPackageRoot != null) {
125129
lintOptions.packageRootPath = customPackageRoot;

lib/src/analysis.dart

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ void printAndFail(String message, {int exitCode: 15}) {
4545
AnalysisOptions _buildAnalyzerOptions(DriverOptions options) {
4646
AnalysisOptionsImpl analysisOptions = new AnalysisOptionsImpl();
4747
analysisOptions.cacheSize = options.cacheSize;
48+
analysisOptions.strongMode = options.strongMode;
4849
analysisOptions.hint = false;
4950
analysisOptions.lint = options.enableLints;
5051
analysisOptions.generateSdkErrors = options.showSdkWarnings;
@@ -222,6 +223,9 @@ class DriverOptions {
222223
/// The path to the dart SDK.
223224
String dartSdkPath;
224225

226+
/// Whether to use Dart's Strong Mode analyzer.
227+
bool strongMode = true;
228+
225229
/// Whether to show lint warnings.
226230
bool enableLints = true;
227231

0 commit comments

Comments
 (0)