[analyzer] remove unused command line options

Change-Id: I2bb415fefe7e1ebe95cea533f4979ca5f8cff4fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164180
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
Devon Carew 2020-09-23 19:21:59 +00:00 committed by commit-bot@chromium.org
parent a4637cd81d
commit feb482abb5
9 changed files with 38 additions and 86 deletions

View file

@ -8,6 +8,12 @@
### Tools
#### Dartanalyzer
* Removed the `--use-fasta-parser`, `--preview-dart-2`, and
`--enable-assert-initializers` command line options. These options haven't
been supported in a while and were no-ops.
#### Linter
Updated the Linter to `0.1.119`, which includes:
@ -55,7 +61,7 @@ Updated the Linter to `0.1.119`, which includes:
deferred loading of types, pass `--no-defer-class-types`. See the original
post on the [unsoundness in the deferred loading algorithm][].
* Enables a new sound deferred splitting algorithm. To explicitly disable
the new deferred splitting algorithm, pass `--no-new-deferred-split'.
the new deferred splitting algorithm, pass `--no-new-deferred-split`.
See the original post on the
[unsoundness in the deferred loading algorithm][].

View file

@ -639,9 +639,6 @@ class AnalysisServerOptions {
/// ML completion is enabled if this is non-null.
String completionModelFolder;
/// Whether to enable parsing via the Fasta parser.
bool useFastaParser = true;
/// Return `true` if the new relevance computations should be used when
/// computing code completion suggestions.
bool useNewRelevance = true;

View file

@ -162,7 +162,6 @@ abstract class AbstractAnalysisServer {
sdkLanguageVersion: analyzer_features.ExperimentStatus.currentVersion,
flags: options.enabledExperiments,
);
defaultContextOptions.useFastaParser = options.useFastaParser;
{
var name = options.newAnalysisDriverLog;

View file

@ -110,6 +110,7 @@ class CommandLineParser {
void addOption(String name,
{String abbr,
String help,
String valueHelp,
List<String> allowed,
Map<String, String> allowedHelp,
String defaultsTo,
@ -118,6 +119,7 @@ class CommandLineParser {
_parser.addOption(name,
abbr: abbr,
help: help,
valueHelp: valueHelp,
allowed: allowed,
allowedHelp: allowedHelp,
defaultsTo: defaultsTo,
@ -276,9 +278,6 @@ class Driver implements ServerStarter {
/// The path to the data cache.
static const String CACHE_FOLDER = 'cache';
/// Whether to enable parsing via the Fasta parser.
static const String USE_FASTA_PARSER = 'use-fasta-parser';
/// The name of the flag to use the Language Server Protocol (LSP).
static const String USE_LSP = 'lsp';
@ -341,7 +340,6 @@ class Driver implements ServerStarter {
analysisServerOptions.enabledExperiments =
(results[ENABLE_EXPERIMENT_OPTION] as List).cast<String>().toList();
}
analysisServerOptions.useFastaParser = results[USE_FASTA_PARSER];
analysisServerOptions.useNewRelevance = results[USE_NEW_RELEVANCE];
// Read in any per-SDK overrides specified in <sdk>/config/settings.json.
@ -747,9 +745,15 @@ class Driver implements ServerStarter {
/// Create and return the parser used to parse the command-line arguments.
CommandLineParser _createArgParser() {
var parser = CommandLineParser();
parser.addFlag(HELP_OPTION,
help: 'print this help message without starting a server',
abbr: 'h',
defaultsTo: false,
negatable: false);
parser.addOption(CLIENT_ID,
help: 'an identifier used to identify the client');
parser.addOption(CLIENT_VERSION, help: 'the version of the client');
valueHelp: 'name', help: 'an identifier used to identify the client');
parser.addOption(CLIENT_VERSION,
valueHelp: 'version', help: 'the version of the client');
parser.addFlag(DARTPAD_OPTION,
help: 'enable DartPad specific functionality',
defaultsTo: false,
@ -774,18 +778,15 @@ class Driver implements ServerStarter {
help: 'enable sending instrumentation information to a server',
defaultsTo: false,
negatable: false);
parser.addFlag(HELP_OPTION,
help: 'print this help message without starting a server',
abbr: 'h',
defaultsTo: false,
negatable: false);
parser.addOption(INSTRUMENTATION_LOG_FILE,
valueHelp: 'file path',
help: 'write instrumentation data to the given file');
parser.addFlag(INTERNAL_PRINT_TO_CONSOLE,
help: 'enable sending `print` output to the console',
defaultsTo: false,
negatable: false);
parser.addOption(NEW_ANALYSIS_DRIVER_LOG,
valueHelp: 'path',
help: "set a destination for the new analysis driver's log");
parser.addFlag(ANALYTICS_FLAG,
help: 'enable or disable sending analytics information to Google',
@ -795,9 +796,11 @@ class Driver implements ServerStarter {
help: 'suppress analytics for this session',
hide: !telemetry.SHOW_ANALYTICS_UI);
parser.addOption(PORT_OPTION,
valueHelp: 'port',
help: 'the http diagnostic port on which the server provides'
' status and performance information');
parser.addOption(SDK_OPTION, help: '[path] the path to the sdk');
parser.addOption(SDK_OPTION,
valueHelp: 'path', help: 'Path to the Dart sdk');
parser.addFlag(USE_ANALYSIS_HIGHLIGHT2,
help: 'enable version 2 of semantic highlight',
defaultsTo: false,
@ -806,6 +809,7 @@ class Driver implements ServerStarter {
help: 'an option for reading files (some clients normalize eol '
'characters, which make the file offset and range information '
'incorrect)',
valueHelp: 'mode',
allowed: ['as-is', 'normalize-eol-always'],
allowedHelp: {
'as-is': 'file contents are read as-is',
@ -814,21 +818,21 @@ class Driver implements ServerStarter {
},
defaultsTo: 'as-is');
parser.addOption(CACHE_FOLDER,
help: '[path] path to the location where to cache data');
parser.addFlag('preview-dart-2',
help: 'Enable the Dart 2.0 preview (deprecated)', hide: true);
parser.addFlag(USE_FASTA_PARSER,
defaultsTo: true,
help: 'Whether to enable parsing via the Fasta parser');
valueHelp: 'path', help: 'Path to the location to write cache data');
parser.addFlag(USE_LSP,
defaultsTo: false, help: 'Whether to use the Language Server Protocol');
defaultsTo: false,
negatable: false,
help: 'Whether to use the Language Server Protocol');
parser.addFlag(ENABLE_COMPLETION_MODEL,
help: 'Whether or not to turn on ML ranking for code completion');
parser.addOption(COMPLETION_MODEL_FOLDER,
help: '[path] path to the location of a code completion model');
valueHelp: 'path',
help: 'Path to the location of a code completion model');
parser.addOption(TRAIN_USING,
valueHelp: 'path',
help: 'Pass in a directory to analyze for purposes of training an '
'analysis server snapshot.');
//
// Temporary flags.
//
@ -836,6 +840,12 @@ class Driver implements ServerStarter {
defaultsTo: true,
help: 'Use the new relevance computation for code completion.');
//
// Deprecated options - no longer read from.
//
parser.addFlag('use-fasta-parser', defaultsTo: true, hide: true);
parser.addFlag('preview-dart-2', hide: true);
return parser;
}

View file

@ -145,8 +145,7 @@ class Parser {
/// A flag indicating whether the analyzer [Parser] factory method
/// will return a fasta based parser or an analyzer based parser.
static const bool useFasta =
bool.fromEnvironment("useFastaParser", defaultValue: true);
static const bool useFasta = true;
/// The source being parsed.
final Source _source;

View file

@ -111,7 +111,6 @@ class ContextCacheEntry {
_buildContextFeatureSet(contextOptions);
contextOptions.hint = !clOptions.disableHints;
contextOptions.useFastaParser = clOptions.useFastaParser;
return contextOptions;
}

View file

@ -104,9 +104,6 @@ class CommandLineOptions {
/// (Or null if not enabled.)
final String perfReport;
/// Whether to enable parsing via the Fasta parser.
final bool useFastaParser;
/// Batch mode (for unit testing)
final bool batchMode;
@ -177,7 +174,6 @@ class CommandLineOptions {
log = cast(args['log']),
machineFormat = args['format'] == 'machine',
perfReport = cast(args['x-perf-report']),
useFastaParser = cast(args['use-fasta-parser']),
batchMode = cast(args['batch']),
showPackageWarnings = cast(args['show-package-warnings']) ||
cast(args['package-warnings']) ||
@ -443,14 +439,6 @@ class CommandLineOptions {
defaultsTo: false,
negatable: false,
hide: true)
// TODO(brianwilkerson) Remove the following option after we're sure that
// it's no longer being used.
..addFlag('enable-assert-initializers',
help:
'Enable parsing of asserts in constructor initializers (deprecated).',
defaultsTo: null,
negatable: false,
hide: hide)
..addFlag('use-analysis-driver-memory-byte-store',
help: 'Use memory byte store, not the file system cache.',
defaultsTo: false,
@ -477,15 +465,6 @@ class CommandLineOptions {
'of "libraryUri".',
splitCommas: false,
hide: hide)
..addFlag('use-fasta-parser',
help: 'Whether to enable parsing via the Fasta parser.',
defaultsTo: true,
hide: hide)
..addFlag('preview-dart-2',
help: 'Enable the Dart 2.0 preview.',
defaultsTo: true,
hide: hide,
negatable: true)
..addFlag('train-snapshot',
help: 'Analyze the given source for the purposes of training a '
'dartanalyzer snapshot.',

View file

@ -27,12 +27,9 @@ void main() {
defineReflectiveTests(BuildModeTest);
defineReflectiveTests(BuildModeSummaryDependenciesTest);
defineReflectiveTests(ExitCodesTest);
defineReflectiveTests(ExitCodesTest_PreviewDart2);
defineReflectiveTests(LinterTest);
defineReflectiveTests(LinterTest_PreviewDart2);
defineReflectiveTests(NonDartFilesTest);
defineReflectiveTests(OptionsTest);
defineReflectiveTests(OptionsTest_PreviewDart2);
}, name: 'Driver');
}
@ -93,8 +90,6 @@ class BaseTest {
AnalysisOptions get analysisOptions => driver.analysisDriver.analysisOptions;
bool get usePreviewDart2 => false;
/// Normalize text with bullets.
String bulletToDash(StringSink item) => '$item'.replaceAll('', '-');
@ -127,9 +122,6 @@ class BaseTest {
];
}
cmd..addAll(sources.map(_adjustFileSpec))..addAll(args);
if (usePreviewDart2) {
cmd.insert(0, '--preview-dart-2');
}
await driver.start(cmd);
}
@ -772,12 +764,6 @@ class ExitCodesTest extends BaseTest {
});
}
Future<void> test_enableAssertInitializer() async {
await drive('data/file_with_assert_initializers.dart',
args: ['--enable-assert-initializers']);
expect(exitCode, 0);
}
Future<void> test_fatalErrors() async {
await drive('data/file_with_error.dart');
expect(exitCode, 3);
@ -835,12 +821,6 @@ class ExitCodesTest extends BaseTest {
}
}
@reflectiveTest
class ExitCodesTest_PreviewDart2 extends ExitCodesTest {
@override
bool get usePreviewDart2 => true;
}
@reflectiveTest
class LinterTest extends BaseTest {
String get optionsFileName => AnalysisEngine.ANALYSIS_OPTIONS_YAML_FILE;
@ -937,12 +917,6 @@ linter:
}
}
@reflectiveTest
class LinterTest_PreviewDart2 extends LinterTest {
@override
bool get usePreviewDart2 => true;
}
@reflectiveTest
class NonDartFilesTest extends BaseTest {
Future<void> test_analysisOptionsYaml() async {
@ -1133,12 +1107,6 @@ class OptionsTest extends BaseTest {
}
}
@reflectiveTest
class OptionsTest_PreviewDart2 extends OptionsTest {
@override
bool get usePreviewDart2 => true;
}
class TestSource implements Source {
TestSource();

View file

@ -257,11 +257,6 @@ void main() {
expect(failureMessage, equals('Invalid Dart SDK path: &&&&&'));
});
test('--use-fasta-parser', () {
var options = parse(['--use-fasta-parser', 'foo.dart']);
expect(options.useFastaParser, isTrue);
});
test('--train-snapshot', () {
var options = parse(['--train-snapshot', 'foo.dart']);
expect(options.trainSnapshot, isTrue);