diff --git a/pkg/analysis_server/lib/protocol/protocol_constants.dart b/pkg/analysis_server/lib/protocol/protocol_constants.dart index 42921521db9..6e51b614d9f 100644 --- a/pkg/analysis_server/lib/protocol/protocol_constants.dart +++ b/pkg/analysis_server/lib/protocol/protocol_constants.dart @@ -170,8 +170,6 @@ const String EDIT_REQUEST_DARTFIX_INCLUDED = 'included'; const String EDIT_REQUEST_DARTFIX_INCLUDED_FIXES = 'includedFixes'; const String EDIT_REQUEST_DARTFIX_INCLUDE_PEDANTIC_FIXES = 'includePedanticFixes'; -const String EDIT_REQUEST_DARTFIX_INCLUDE_REQUIRED_FIXES = - 'includeRequiredFixes'; const String EDIT_REQUEST_DARTFIX_OUTPUT_DIR = 'outputDir'; const String EDIT_REQUEST_DARTFIX_PORT = 'port'; const String EDIT_REQUEST_FORMAT = 'edit.format'; diff --git a/pkg/analysis_server/lib/protocol/protocol_generated.dart b/pkg/analysis_server/lib/protocol/protocol_generated.dart index 36ec236924b..1905a6e8b3d 100644 --- a/pkg/analysis_server/lib/protocol/protocol_generated.dart +++ b/pkg/analysis_server/lib/protocol/protocol_generated.dart @@ -6747,7 +6747,6 @@ class ConvertMethodToGetterOptions extends RefactoringOptions /// { /// "name": String /// "description": optional String -/// "isRequired": optional bool /// } /// /// Clients may not extend, implement or mix-in this class. @@ -6756,8 +6755,6 @@ class DartFix implements HasToJson { String _description; - bool _isRequired; - /// The name of the fix. String get name => _name; @@ -6775,18 +6772,9 @@ class DartFix implements HasToJson { _description = value; } - /// `true` if the fix is in the "required" fixes group. - bool get isRequired => _isRequired; - - /// `true` if the fix is in the "required" fixes group. - set isRequired(bool value) { - _isRequired = value; - } - - DartFix(String name, {String description, bool isRequired}) { + DartFix(String name, {String description}) { this.name = name; this.description = description; - this.isRequired = isRequired; } factory DartFix.fromJson( @@ -6804,12 +6792,7 @@ class DartFix implements HasToJson { description = jsonDecoder.decodeString( jsonPath + '.description', json['description']); } - bool isRequired; - if (json.containsKey('isRequired')) { - isRequired = jsonDecoder.decodeBool( - jsonPath + '.isRequired', json['isRequired']); - } - return DartFix(name, description: description, isRequired: isRequired); + return DartFix(name, description: description); } else { throw jsonDecoder.mismatch(jsonPath, 'DartFix', json); } @@ -6822,9 +6805,6 @@ class DartFix implements HasToJson { if (description != null) { result['description'] = description; } - if (isRequired != null) { - result['isRequired'] = isRequired; - } return result; } @@ -6834,9 +6814,7 @@ class DartFix implements HasToJson { @override bool operator ==(other) { if (other is DartFix) { - return name == other.name && - description == other.description && - isRequired == other.isRequired; + return name == other.name && description == other.description; } return false; } @@ -6846,7 +6824,6 @@ class DartFix implements HasToJson { int hash = 0; hash = JenkinsSmiHash.combine(hash, name.hashCode); hash = JenkinsSmiHash.combine(hash, description.hashCode); - hash = JenkinsSmiHash.combine(hash, isRequired.hashCode); return JenkinsSmiHash.finish(hash); } } @@ -7158,7 +7135,6 @@ class DiagnosticGetServerPortResult implements ResponseResult { /// "included": List /// "includedFixes": optional List /// "includePedanticFixes": optional bool -/// "includeRequiredFixes": optional bool /// "excludedFixes": optional List /// "port": optional int /// "outputDir": optional FilePath @@ -7172,8 +7148,6 @@ class EditDartfixParams implements RequestParams { bool _includePedanticFixes; - bool _includeRequiredFixes; - List _excludedFixes; int _port; @@ -7225,14 +7199,6 @@ class EditDartfixParams implements RequestParams { _includePedanticFixes = value; } - /// A flag indicating whether "required" fixes should be applied. - bool get includeRequiredFixes => _includeRequiredFixes; - - /// A flag indicating whether "required" fixes should be applied. - set includeRequiredFixes(bool value) { - _includeRequiredFixes = value; - } - /// A list of names indicating which fixes should not be applied. /// /// If a name is specified that does not match the name of a known fix, an @@ -7266,14 +7232,12 @@ class EditDartfixParams implements RequestParams { EditDartfixParams(List included, {List includedFixes, bool includePedanticFixes, - bool includeRequiredFixes, List excludedFixes, int port, String outputDir}) { this.included = included; this.includedFixes = includedFixes; this.includePedanticFixes = includePedanticFixes; - this.includeRequiredFixes = includeRequiredFixes; this.excludedFixes = excludedFixes; this.port = port; this.outputDir = outputDir; @@ -7300,11 +7264,6 @@ class EditDartfixParams implements RequestParams { includePedanticFixes = jsonDecoder.decodeBool( jsonPath + '.includePedanticFixes', json['includePedanticFixes']); } - bool includeRequiredFixes; - if (json.containsKey('includeRequiredFixes')) { - includeRequiredFixes = jsonDecoder.decodeBool( - jsonPath + '.includeRequiredFixes', json['includeRequiredFixes']); - } List excludedFixes; if (json.containsKey('excludedFixes')) { excludedFixes = jsonDecoder.decodeList(jsonPath + '.excludedFixes', @@ -7322,7 +7281,6 @@ class EditDartfixParams implements RequestParams { return EditDartfixParams(included, includedFixes: includedFixes, includePedanticFixes: includePedanticFixes, - includeRequiredFixes: includeRequiredFixes, excludedFixes: excludedFixes, port: port, outputDir: outputDir); @@ -7346,9 +7304,6 @@ class EditDartfixParams implements RequestParams { if (includePedanticFixes != null) { result['includePedanticFixes'] = includePedanticFixes; } - if (includeRequiredFixes != null) { - result['includeRequiredFixes'] = includeRequiredFixes; - } if (excludedFixes != null) { result['excludedFixes'] = excludedFixes; } @@ -7377,7 +7332,6 @@ class EditDartfixParams implements RequestParams { listEqual(includedFixes, other.includedFixes, (String a, String b) => a == b) && includePedanticFixes == other.includePedanticFixes && - includeRequiredFixes == other.includeRequiredFixes && listEqual(excludedFixes, other.excludedFixes, (String a, String b) => a == b) && port == other.port && @@ -7392,7 +7346,6 @@ class EditDartfixParams implements RequestParams { hash = JenkinsSmiHash.combine(hash, included.hashCode); hash = JenkinsSmiHash.combine(hash, includedFixes.hashCode); hash = JenkinsSmiHash.combine(hash, includePedanticFixes.hashCode); - hash = JenkinsSmiHash.combine(hash, includeRequiredFixes.hashCode); hash = JenkinsSmiHash.combine(hash, excludedFixes.hashCode); hash = JenkinsSmiHash.combine(hash, port.hashCode); hash = JenkinsSmiHash.combine(hash, outputDir.hashCode); diff --git a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart index 8f7faee715f..df735e544d2 100644 --- a/pkg/analysis_server/lib/src/edit/edit_dartfix.dart +++ b/pkg/analysis_server/lib/src/edit/edit_dartfix.dart @@ -37,9 +37,6 @@ class EditDartFix // Determine the fixes to be applied final fixInfo = []; - if (params.includeRequiredFixes == true) { - fixInfo.addAll(allFixes.where((i) => i.isRequired)); - } if (params.includePedanticFixes == true) { for (var fix in allFixes) { if (fix.isPedantic && !fixInfo.contains(fix)) { diff --git a/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart b/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart index 58a111c9634..b8fd266beb4 100644 --- a/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart +++ b/pkg/analysis_server/lib/src/edit/fix/dartfix_info.dart @@ -24,13 +24,11 @@ final allFixes = [ 'fix-named-constructor-type-arguments', 'Move named constructor type arguments from the name to the type.', FixErrorTask.fixNamedConstructorTypeArgs, - isRequired: true, ), DartFixInfo( 'use-mixin', 'Convert classes used as a mixin to the new mixin syntax.', PreferMixinFix.task, - isRequired: true, ), // // Pedantic lint fixes. @@ -150,9 +148,6 @@ class DartFixInfo { /// lint set. final bool isPedantic; - /// A flag indicating whether this fix is in the set of required fixes. - final bool isRequired; - final void Function(DartFixRegistrar registrar, DartFixListener listener, EditDartfixParams params) _setup; @@ -161,13 +156,11 @@ class DartFixInfo { this.description, this._setup, { this.isDefault = true, - this.isRequired = false, this.isPedantic = false, }); /// Return a newly created fix generated from this fix info. - DartFix asDartFix() => - DartFix(key, description: description, isRequired: isRequired); + DartFix asDartFix() => DartFix(key, description: description); /// Register this fix with the [registrar] and report progress to the /// [listener]. @@ -618,12 +611,9 @@ class LintFixInfo extends DartFixInfo { this.fixKind, String description, { bool isDefault = true, - bool isRequired = false, bool isPedantic = false, }) : super(lintName.replaceAll('_', '-'), description, null, - isDefault: isDefault, - isRequired: isRequired, - isPedantic: isPedantic); + isDefault: isDefault, isPedantic: isPedantic); @override void setup(DartFixRegistrar registrar, DartFixListener listener, diff --git a/pkg/analysis_server/test/integration/edit/dartfix_test.dart b/pkg/analysis_server/test/integration/edit/dartfix_test.dart index d389950a8f5..e963bf850ce 100644 --- a/pkg/analysis_server/test/integration/edit/dartfix_test.dart +++ b/pkg/analysis_server/test/integration/edit/dartfix_test.dart @@ -68,13 +68,4 @@ class C with B {} expect(result.suggestions.length, 0); expect(result.edits.length, 0); } - - test_dartfix_required() async { - setupTarget(); - EditDartfixResult result = await sendEditDartfix([(sourceDirectory.path)], - includeRequiredFixes: true); - expect(result.hasErrors, isFalse); - expect(result.suggestions.length, greaterThanOrEqualTo(1)); - expect(result.edits.length, greaterThanOrEqualTo(1)); - } } diff --git a/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart b/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart index 2d92b6ad6de..b62ed771230 100644 --- a/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart +++ b/pkg/analysis_server/test/integration/edit/get_dartfix_info_test.dart @@ -20,7 +20,5 @@ class GetDartfixInfoTest extends AbstractAnalysisServerIntegrationTest { standardAnalysisSetup(); EditGetDartfixInfoResult info = await sendEditGetDartfixInfo(); expect(info.fixes.length, greaterThanOrEqualTo(3)); - var fix = info.fixes.firstWhere((f) => f.name == 'use-mixin'); - expect(fix.isRequired, isTrue); } } diff --git a/pkg/analysis_server/test/integration/support/integration_test_methods.dart b/pkg/analysis_server/test/integration/support/integration_test_methods.dart index b4320eee656..eb1ad52a823 100644 --- a/pkg/analysis_server/test/integration/support/integration_test_methods.dart +++ b/pkg/analysis_server/test/integration/support/integration_test_methods.dart @@ -1576,12 +1576,12 @@ abstract class IntegrationTestMixin { /// source requires it. /// /// If includedFixes is specified, then those fixes will be applied. If - /// includeRequiredFixes is specified, then "required" fixes will be applied - /// in addition to whatever fixes are specified in includedFixes if any. If - /// neither includedFixes nor includeRequiredFixes is specified, then all - /// fixes will be applied. If excludedFixes is specified, then those fixes - /// will not be applied regardless of whether they are "required" or - /// specified in includedFixes. + /// includePedanticFixes is specified, then fixes associated with the + /// pedantic rule set will be applied in addition to whatever fixes are + /// specified in includedFixes if any. If neither includedFixes nor + /// includePedanticFixes is specified, then no fixes will be applied. If + /// excludedFixes is specified, then those fixes will not be applied + /// regardless of whether they are specified in includedFixes. /// /// Parameters /// @@ -1609,10 +1609,6 @@ abstract class IntegrationTestMixin { /// /// A flag indicating whether "pedantic" fixes should be applied. /// - /// includeRequiredFixes: bool (optional) - /// - /// A flag indicating whether "required" fixes should be applied. - /// /// excludedFixes: List (optional) /// /// A list of names indicating which fixes should not be applied. @@ -1670,14 +1666,12 @@ abstract class IntegrationTestMixin { Future sendEditDartfix(List included, {List includedFixes, bool includePedanticFixes, - bool includeRequiredFixes, List excludedFixes, int port, String outputDir}) async { var params = EditDartfixParams(included, includedFixes: includedFixes, includePedanticFixes: includePedanticFixes, - includeRequiredFixes: includeRequiredFixes, excludedFixes: excludedFixes, port: port, outputDir: outputDir) diff --git a/pkg/analysis_server/test/integration/support/protocol_matchers.dart b/pkg/analysis_server/test/integration/support/protocol_matchers.dart index 5a4f9149099..6cf2b8a552a 100644 --- a/pkg/analysis_server/test/integration/support/protocol_matchers.dart +++ b/pkg/analysis_server/test/integration/support/protocol_matchers.dart @@ -325,11 +325,10 @@ final Matcher isContextData = /// { /// "name": String /// "description": optional String -/// "isRequired": optional bool /// } final Matcher isDartFix = LazyMatcher(() => MatchesJsonObject( 'DartFix', {'name': isString}, - optionalFields: {'description': isString, 'isRequired': isBool})); + optionalFields: {'description': isString})); /// DartFixSuggestion /// @@ -2208,7 +2207,6 @@ final Matcher isDiagnosticGetServerPortResult = LazyMatcher(() => /// "included": List /// "includedFixes": optional List /// "includePedanticFixes": optional bool -/// "includeRequiredFixes": optional bool /// "excludedFixes": optional List /// "port": optional int /// "outputDir": optional FilePath @@ -2219,7 +2217,6 @@ final Matcher isEditDartfixParams = }, optionalFields: { 'includedFixes': isListOf(isString), 'includePedanticFixes': isBool, - 'includeRequiredFixes': isBool, 'excludedFixes': isListOf(isString), 'port': isInt, 'outputDir': isFilePath diff --git a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java index 1bd0430c2bd..7f9bbc7981f 100644 --- a/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java +++ b/pkg/analysis_server/tool/spec/generated/java/AnalysisServer.java @@ -480,11 +480,11 @@ public interface AnalysisServer { * those sources. These edits may include changes to sources outside the set of specified sources * if a change in a specified source requires it. * - * If includedFixes is specified, then those fixes will be applied. If includeRequiredFixes is - * specified, then "required" fixes will be applied in addition to whatever fixes are specified in - * includedFixes if any. If neither includedFixes nor includeRequiredFixes is specified, then all - * fixes will be applied. If excludedFixes is specified, then those fixes will not be applied - * regardless of whether they are "required" or specified in includedFixes. + * If includedFixes is specified, then those fixes will be applied. If includePedanticFixes is + * specified, then fixes associated with the pedantic rule set will be applied in addition to + * whatever fixes are specified in includedFixes if any. If neither includedFixes nor + * includePedanticFixes is specified, then no fixes will be applied. If excludedFixes is specified, + * then those fixes will not be applied regardless of whether they are specified in includedFixes. * * @param included A list of the files and directories for which edits should be suggested. If a * request is made with a path that is invalid, e.g. is not absolute and normalized, an @@ -496,14 +496,13 @@ public interface AnalysisServer { * specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will * be generated. * @param includePedanticFixes A flag indicating whether "pedantic" fixes should be applied. - * @param includeRequiredFixes A flag indicating whether "required" fixes should be applied. * @param excludedFixes A list of names indicating which fixes should not be applied. If a name is * specified that does not match the name of a known fix, an error of type UNKNOWN_FIX will * be generated. * @param port Deprecated: This field is now ignored by server. * @param outputDir Deprecated: This field is now ignored by server. */ - public void edit_dartfix(List included, List includedFixes, boolean includePedanticFixes, boolean includeRequiredFixes, List excludedFixes, int port, String outputDir, DartfixConsumer consumer); + public void edit_dartfix(List included, List includedFixes, boolean includePedanticFixes, List excludedFixes, int port, String outputDir, DartfixConsumer consumer); /** * {@code edit.format} diff --git a/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java b/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java index 066980563bc..1d2dde1ee9d 100644 --- a/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java +++ b/pkg/analysis_server/tool/spec/generated/java/types/DartFix.java @@ -45,18 +45,12 @@ public class DartFix { */ private final String description; - /** - * `true` if the fix is in the "required" fixes group. - */ - private final Boolean isRequired; - /** * Constructor for {@link DartFix}. */ - public DartFix(String name, String description, Boolean isRequired) { + public DartFix(String name, String description) { this.name = name; this.description = description; - this.isRequired = isRequired; } @Override @@ -65,8 +59,7 @@ public class DartFix { DartFix other = (DartFix) obj; return ObjectUtilities.equals(other.name, name) && - ObjectUtilities.equals(other.description, description) && - ObjectUtilities.equals(other.isRequired, isRequired); + ObjectUtilities.equals(other.description, description); } return false; } @@ -74,8 +67,7 @@ public class DartFix { public static DartFix fromJson(JsonObject jsonObject) { String name = jsonObject.get("name").getAsString(); String description = jsonObject.get("description") == null ? null : jsonObject.get("description").getAsString(); - Boolean isRequired = jsonObject.get("isRequired") == null ? null : jsonObject.get("isRequired").getAsBoolean(); - return new DartFix(name, description, isRequired); + return new DartFix(name, description); } public static List fromJsonArray(JsonArray jsonArray) { @@ -97,13 +89,6 @@ public class DartFix { return description; } - /** - * `true` if the fix is in the "required" fixes group. - */ - public Boolean getIsRequired() { - return isRequired; - } - /** * The name of the fix. */ @@ -116,7 +101,6 @@ public class DartFix { HashCodeBuilder builder = new HashCodeBuilder(); builder.append(name); builder.append(description); - builder.append(isRequired); return builder.toHashCode(); } @@ -126,9 +110,6 @@ public class DartFix { if (description != null) { jsonObject.addProperty("description", description); } - if (isRequired != null) { - jsonObject.addProperty("isRequired", isRequired); - } return jsonObject; } @@ -139,9 +120,7 @@ public class DartFix { builder.append("name="); builder.append(name + ", "); builder.append("description="); - builder.append(description + ", "); - builder.append("isRequired="); - builder.append(isRequired); + builder.append(description); builder.append("]"); return builder.toString(); } diff --git a/pkg/analysis_server/tool/spec/spec_input.html b/pkg/analysis_server/tool/spec/spec_input.html index 02f944c59f3..b422873eb3f 100644 --- a/pkg/analysis_server/tool/spec/spec_input.html +++ b/pkg/analysis_server/tool/spec/spec_input.html @@ -2171,13 +2171,13 @@ of specified sources if a change in a specified source requires it.

- If includedFixes is specified, then those fixes will be applied. - If includeRequiredFixes is specified, then "required" fixes will be applied - in addition to whatever fixes are specified in includedFixes if any. - If neither includedFixes nor includeRequiredFixes is specified, - then all fixes will be applied. - If excludedFixes is specified, then those fixes will not be applied - regardless of whether they are "required" or specified in includedFixes. + If includedFixes is specified, then those fixes will be applied. If + includePedanticFixes is specified, then fixes associated with the pedantic + rule set will be applied in addition to whatever fixes are specified in + includedFixes if any. If neither includedFixes nor includePedanticFixes is + specified, then no fixes will be applied. If excludedFixes is specified, + then those fixes will not be applied regardless of whether they are + specified in includedFixes.

@@ -2216,12 +2216,6 @@ A flag indicating whether "pedantic" fixes should be applied.

- - bool -

- A flag indicating whether "required" fixes should be applied. -

-
String @@ -5166,12 +5160,6 @@ A human readable description of the fix.

- - bool -

- `true` if the fix is in the "required" fixes group. -

-
diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart index 42921521db9..6e51b614d9f 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_constants.dart @@ -170,8 +170,6 @@ const String EDIT_REQUEST_DARTFIX_INCLUDED = 'included'; const String EDIT_REQUEST_DARTFIX_INCLUDED_FIXES = 'includedFixes'; const String EDIT_REQUEST_DARTFIX_INCLUDE_PEDANTIC_FIXES = 'includePedanticFixes'; -const String EDIT_REQUEST_DARTFIX_INCLUDE_REQUIRED_FIXES = - 'includeRequiredFixes'; const String EDIT_REQUEST_DARTFIX_OUTPUT_DIR = 'outputDir'; const String EDIT_REQUEST_DARTFIX_PORT = 'port'; const String EDIT_REQUEST_FORMAT = 'edit.format'; diff --git a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart index 176c55752ab..0a1a206350d 100644 --- a/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart +++ b/pkg/analysis_server_client/lib/src/protocol/protocol_generated.dart @@ -6747,7 +6747,6 @@ class ConvertMethodToGetterOptions extends RefactoringOptions /// { /// "name": String /// "description": optional String -/// "isRequired": optional bool /// } /// /// Clients may not extend, implement or mix-in this class. @@ -6756,8 +6755,6 @@ class DartFix implements HasToJson { String _description; - bool _isRequired; - /// The name of the fix. String get name => _name; @@ -6775,18 +6772,9 @@ class DartFix implements HasToJson { _description = value; } - /// `true` if the fix is in the "required" fixes group. - bool get isRequired => _isRequired; - - /// `true` if the fix is in the "required" fixes group. - set isRequired(bool value) { - _isRequired = value; - } - - DartFix(String name, {String description, bool isRequired}) { + DartFix(String name, {String description}) { this.name = name; this.description = description; - this.isRequired = isRequired; } factory DartFix.fromJson( @@ -6804,12 +6792,7 @@ class DartFix implements HasToJson { description = jsonDecoder.decodeString( jsonPath + '.description', json['description']); } - bool isRequired; - if (json.containsKey('isRequired')) { - isRequired = jsonDecoder.decodeBool( - jsonPath + '.isRequired', json['isRequired']); - } - return DartFix(name, description: description, isRequired: isRequired); + return DartFix(name, description: description); } else { throw jsonDecoder.mismatch(jsonPath, 'DartFix', json); } @@ -6822,9 +6805,6 @@ class DartFix implements HasToJson { if (description != null) { result['description'] = description; } - if (isRequired != null) { - result['isRequired'] = isRequired; - } return result; } @@ -6834,9 +6814,7 @@ class DartFix implements HasToJson { @override bool operator ==(other) { if (other is DartFix) { - return name == other.name && - description == other.description && - isRequired == other.isRequired; + return name == other.name && description == other.description; } return false; } @@ -6846,7 +6824,6 @@ class DartFix implements HasToJson { int hash = 0; hash = JenkinsSmiHash.combine(hash, name.hashCode); hash = JenkinsSmiHash.combine(hash, description.hashCode); - hash = JenkinsSmiHash.combine(hash, isRequired.hashCode); return JenkinsSmiHash.finish(hash); } } @@ -7158,7 +7135,6 @@ class DiagnosticGetServerPortResult implements ResponseResult { /// "included": List /// "includedFixes": optional List /// "includePedanticFixes": optional bool -/// "includeRequiredFixes": optional bool /// "excludedFixes": optional List /// "port": optional int /// "outputDir": optional FilePath @@ -7172,8 +7148,6 @@ class EditDartfixParams implements RequestParams { bool _includePedanticFixes; - bool _includeRequiredFixes; - List _excludedFixes; int _port; @@ -7225,14 +7199,6 @@ class EditDartfixParams implements RequestParams { _includePedanticFixes = value; } - /// A flag indicating whether "required" fixes should be applied. - bool get includeRequiredFixes => _includeRequiredFixes; - - /// A flag indicating whether "required" fixes should be applied. - set includeRequiredFixes(bool value) { - _includeRequiredFixes = value; - } - /// A list of names indicating which fixes should not be applied. /// /// If a name is specified that does not match the name of a known fix, an @@ -7266,14 +7232,12 @@ class EditDartfixParams implements RequestParams { EditDartfixParams(List included, {List includedFixes, bool includePedanticFixes, - bool includeRequiredFixes, List excludedFixes, int port, String outputDir}) { this.included = included; this.includedFixes = includedFixes; this.includePedanticFixes = includePedanticFixes; - this.includeRequiredFixes = includeRequiredFixes; this.excludedFixes = excludedFixes; this.port = port; this.outputDir = outputDir; @@ -7300,11 +7264,6 @@ class EditDartfixParams implements RequestParams { includePedanticFixes = jsonDecoder.decodeBool( jsonPath + '.includePedanticFixes', json['includePedanticFixes']); } - bool includeRequiredFixes; - if (json.containsKey('includeRequiredFixes')) { - includeRequiredFixes = jsonDecoder.decodeBool( - jsonPath + '.includeRequiredFixes', json['includeRequiredFixes']); - } List excludedFixes; if (json.containsKey('excludedFixes')) { excludedFixes = jsonDecoder.decodeList(jsonPath + '.excludedFixes', @@ -7322,7 +7281,6 @@ class EditDartfixParams implements RequestParams { return EditDartfixParams(included, includedFixes: includedFixes, includePedanticFixes: includePedanticFixes, - includeRequiredFixes: includeRequiredFixes, excludedFixes: excludedFixes, port: port, outputDir: outputDir); @@ -7346,9 +7304,6 @@ class EditDartfixParams implements RequestParams { if (includePedanticFixes != null) { result['includePedanticFixes'] = includePedanticFixes; } - if (includeRequiredFixes != null) { - result['includeRequiredFixes'] = includeRequiredFixes; - } if (excludedFixes != null) { result['excludedFixes'] = excludedFixes; } @@ -7377,7 +7332,6 @@ class EditDartfixParams implements RequestParams { listEqual(includedFixes, other.includedFixes, (String a, String b) => a == b) && includePedanticFixes == other.includePedanticFixes && - includeRequiredFixes == other.includeRequiredFixes && listEqual(excludedFixes, other.excludedFixes, (String a, String b) => a == b) && port == other.port && @@ -7392,7 +7346,6 @@ class EditDartfixParams implements RequestParams { hash = JenkinsSmiHash.combine(hash, included.hashCode); hash = JenkinsSmiHash.combine(hash, includedFixes.hashCode); hash = JenkinsSmiHash.combine(hash, includePedanticFixes.hashCode); - hash = JenkinsSmiHash.combine(hash, includeRequiredFixes.hashCode); hash = JenkinsSmiHash.combine(hash, excludedFixes.hashCode); hash = JenkinsSmiHash.combine(hash, port.hashCode); hash = JenkinsSmiHash.combine(hash, outputDir.hashCode); diff --git a/pkg/dartfix/lib/src/driver.dart b/pkg/dartfix/lib/src/driver.dart index 04e102a8492..458b4f884b8 100644 --- a/pkg/dartfix/lib/src/driver.dart +++ b/pkg/dartfix/lib/src/driver.dart @@ -80,10 +80,6 @@ class Driver { _unsupportedOption(includeFixOption); return false; } - if (options.requiredFixes) { - _unsupportedOption(requiredOption); - return false; - } if (options.showHelp) { return false; } @@ -126,9 +122,6 @@ class Driver { if (options.includeFixes.isNotEmpty) { params.includedFixes = options.includeFixes; } - if (options.requiredFixes) { - params.includeRequiredFixes = true; - } if (options.pedanticFixes) { params.includePedanticFixes = true; } @@ -221,16 +214,9 @@ Analysis Details: logger.stdout(''' -The following fixes are automatically applied unless at least one --$includeFixOption option is specified -(and --$requiredOption is not specified). They may be individually disabled using --$excludeFixOption.'''); +These fixes can be enabled using --$includeFixOption:'''); - fixes.where((fix) => fix.isRequired).forEach(showFix); - - logger.stdout(''' - -These fixes are NOT automatically applied, but may be enabled using --$includeFixOption:'''); - - fixes.where((fix) => !fix.isRequired).toList() + fixes ..sort(compareFixes) ..forEach(showFix); diff --git a/pkg/dartfix/lib/src/options.dart b/pkg/dartfix/lib/src/options.dart index 38b9e46ddbd..24a5d376ef1 100644 --- a/pkg/dartfix/lib/src/options.dart +++ b/pkg/dartfix/lib/src/options.dart @@ -17,30 +17,19 @@ const overwriteOption = 'overwrite'; const pedanticOption = 'pedantic'; const previewDirOption = 'preview-dir'; const previewPortOption = 'preview-port'; -const requiredOption = 'required'; const sdkOption = 'sdk'; const _binaryName = 'dartfix'; const _colorOption = 'color'; -const _helpOption = 'help'; - -// options only supported by server 1.22.2 and greater -const _previewOption = 'preview'; -const _serverSnapshot = 'server'; -const _verboseOption = 'verbose'; - -// options not supported yet by any server const _dependencies = 'migrate-dependencies'; -/// Command line options for `dartfix upgrade`. -class UpgradeOptions { - final bool dependencies; - final bool preview; +// options only supported by server 1.22.2 and greater +const _helpOption = 'help'; +const _previewOption = 'preview'; +const _serverSnapshot = 'server'; - UpgradeOptions._fromCommand(ArgResults results) - : dependencies = results[_dependencies] as bool, - preview = results[_previewOption] as bool; -} +// options not supported yet by any server +const _verboseOption = 'verbose'; /// Command line options for `dartfix`. class Options { @@ -53,7 +42,6 @@ class Options { final String serverSnapshot; final bool pedanticFixes; - final bool requiredFixes; final List includeFixes; final List excludeFixes; @@ -69,7 +57,6 @@ class Options { excludeFixes = (results[excludeFixOption] as List ?? []).cast(), overwrite = results[overwriteOption] as bool, pedanticFixes = results[pedanticOption] as bool, - requiredFixes = results[requiredOption] as bool, sdkPath = results[sdkOption] as String ?? _getSdkPath(), serverSnapshot = results[_serverSnapshot] as String, showHelp = results[_helpOption] as bool || results.arguments.isEmpty, @@ -97,8 +84,6 @@ class Options { help: 'Exclude a specific fix.', valueHelp: 'name-of-fix') ..addFlag(pedanticOption, help: 'Apply pedantic fixes.', defaultsTo: false, negatable: false) - ..addFlag(requiredOption, - help: 'Apply required fixes.', defaultsTo: false, negatable: false) ..addSeparator('Modifying files:') ..addFlag(overwriteOption, abbr: 'w', @@ -211,10 +196,6 @@ class Options { logger.stderr('Cannot use pedanticFixes when using upgrade.'); context.exit(22); } - if (results.wasParsed(requiredOption) && options.requiredFixes) { - logger.stderr('Cannot use requiredFixes when using upgrade.'); - context.exit(22); - } // TODO(jcollins-g): prevent non-nullable outside of upgrade // command. options.includeFixes.add('non-nullable'); @@ -284,3 +265,13 @@ Use --$_helpOption to display the fixes that can be specified using either : ''); } } + +/// Command line options for `dartfix upgrade`. +class UpgradeOptions { + final bool dependencies; + final bool preview; + + UpgradeOptions._fromCommand(ArgResults results) + : dependencies = results[_dependencies] as bool, + preview = results[_previewOption] as bool; +} diff --git a/pkg/dartfix/test/src/driver_help_test.dart b/pkg/dartfix/test/src/driver_help_test.dart index fa0326d09d6..d8a633048ce 100644 --- a/pkg/dartfix/test/src/driver_help_test.dart +++ b/pkg/dartfix/test/src/driver_help_test.dart @@ -28,7 +28,6 @@ void main() { expect(errText, isEmpty); expect(outText, contains('--$excludeFixOption')); expect(outText, isNot(contains('Use --help to display the fixes'))); - expect(outText, contains('use-mixin')); }); test('help implicit', () async { @@ -52,6 +51,5 @@ void main() { expect(errText, isEmpty); expect(outText, contains('--$excludeFixOption')); expect(outText, isNot(contains('Use --help to display the fixes'))); - expect(outText, contains('use-mixin')); }); } diff --git a/pkg/dartfix/test/src/driver_required_test.dart b/pkg/dartfix/test/src/driver_required_test.dart deleted file mode 100644 index 2d4e115f968..00000000000 --- a/pkg/dartfix/test/src/driver_required_test.dart +++ /dev/null @@ -1,13 +0,0 @@ -// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file -// for details. All rights reserved. Use of this source code is governed by a -// BSD-style license that can be found in the LICENSE file. - -import 'driver_test.dart' show defineDriverTests; - -void main() { - defineDriverTests( - name: 'required', - options: ['--required'], - expectedSuggestions: ['Convert MyMixin to a mixin'], - ); -} diff --git a/pkg/dartfix/test/src/options_test.dart b/pkg/dartfix/test/src/options_test.dart index d04faa57e40..ff912503e3f 100644 --- a/pkg/dartfix/test/src/options_test.dart +++ b/pkg/dartfix/test/src/options_test.dart @@ -55,7 +55,6 @@ void main() { } expect(options.force, force); expect(options.pedanticFixes, pedanticFixes); - expect(options.requiredFixes, requiredFixes); expect(options.overwrite, overwrite); expect(options.serverSnapshot, serverSnapshot); expect(options.showHelp, showHelp); @@ -124,10 +123,6 @@ void main() { parse(['--pedantic', 'foo'], pedanticFixes: true); }); - test('required fixes', () { - parse(['--required', 'foo'], requiredFixes: true); - }); - test('server snapshot', () { parse(['--server', 'some/path', 'foo'], serverSnapshot: 'some/path'); }); diff --git a/pkg/dartfix/test/test_all.dart b/pkg/dartfix/test/test_all.dart index f03ce9ce498..54dc9cefbab 100644 --- a/pkg/dartfix/test/test_all.dart +++ b/pkg/dartfix/test/test_all.dart @@ -11,7 +11,6 @@ import 'src/driver_help_test.dart' as driver_help; import 'src/driver_include_test.dart' as driver_include; import 'src/driver_pedantic_test.dart' as driver_pedantic; import 'src/driver_prefer_is_empty_test.dart' as driver_prefer_is_empty; -import 'src/driver_required_test.dart' as driver_required; import 'src/driver_test.dart' as driver; import 'src/options_test.dart' as options_test; @@ -23,7 +22,6 @@ void main() { group('driver', driver_include.main); group('driver', driver_pedantic.main); group('driver', driver_prefer_is_empty.main); - group('driver', driver_required.main); group('driver', driver.main); group('options', options_test.main); }