add includePedanticFixes flag to dartfix protocol

Change-Id: I43c40eacf038beed6245ec873e746dcbb1ed80df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/111980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
danrubel 2019-08-05 20:18:05 +00:00 committed by commit-bot@chromium.org
parent a188b534dc
commit 1c5911982e
11 changed files with 84 additions and 6 deletions

View file

@ -109,7 +109,7 @@ a:focus, a:hover {
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
1.27.1
1.27.2
</h1>
<p>
This document contains a specification of the API provided by the

View file

@ -6,7 +6,7 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/spec/generate_files".
const String PROTOCOL_VERSION = '1.27.1';
const String PROTOCOL_VERSION = '1.27.2';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES = 'analysis.analyzedFiles';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES_DIRECTORIES = 'directories';
@ -168,6 +168,8 @@ const String EDIT_REQUEST_DARTFIX = 'edit.dartfix';
const String EDIT_REQUEST_DARTFIX_EXCLUDED_FIXES = 'excludedFixes';
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_FORMAT = 'edit.format';

View file

@ -8023,6 +8023,7 @@ class DiagnosticGetServerPortResult implements ResponseResult {
* {
* "included": List<FilePath>
* "includedFixes": optional List<String>
* "includePedanticFixes": optional bool
* "includeRequiredFixes": optional bool
* "excludedFixes": optional List<String>
* }
@ -8034,6 +8035,8 @@ class EditDartfixParams implements RequestParams {
List<String> _includedFixes;
bool _includePedanticFixes;
bool _includeRequiredFixes;
List<String> _excludedFixes;
@ -8083,6 +8086,18 @@ class EditDartfixParams implements RequestParams {
this._includedFixes = value;
}
/**
* A flag indicating that "pedantic" fixes should be applied.
*/
bool get includePedanticFixes => _includePedanticFixes;
/**
* A flag indicating that "pedantic" fixes should be applied.
*/
void set includePedanticFixes(bool value) {
this._includePedanticFixes = value;
}
/**
* A flag indicating that "required" fixes should be applied.
*/
@ -8115,10 +8130,12 @@ class EditDartfixParams implements RequestParams {
EditDartfixParams(List<String> included,
{List<String> includedFixes,
bool includePedanticFixes,
bool includeRequiredFixes,
List<String> excludedFixes}) {
this.included = included;
this.includedFixes = includedFixes;
this.includePedanticFixes = includePedanticFixes;
this.includeRequiredFixes = includeRequiredFixes;
this.excludedFixes = excludedFixes;
}
@ -8141,6 +8158,11 @@ class EditDartfixParams implements RequestParams {
includedFixes = jsonDecoder.decodeList(jsonPath + ".includedFixes",
json["includedFixes"], jsonDecoder.decodeString);
}
bool includePedanticFixes;
if (json.containsKey("includePedanticFixes")) {
includePedanticFixes = jsonDecoder.decodeBool(
jsonPath + ".includePedanticFixes", json["includePedanticFixes"]);
}
bool includeRequiredFixes;
if (json.containsKey("includeRequiredFixes")) {
includeRequiredFixes = jsonDecoder.decodeBool(
@ -8153,6 +8175,7 @@ class EditDartfixParams implements RequestParams {
}
return new EditDartfixParams(included,
includedFixes: includedFixes,
includePedanticFixes: includePedanticFixes,
includeRequiredFixes: includeRequiredFixes,
excludedFixes: excludedFixes);
} else {
@ -8172,6 +8195,9 @@ class EditDartfixParams implements RequestParams {
if (includedFixes != null) {
result["includedFixes"] = includedFixes;
}
if (includePedanticFixes != null) {
result["includePedanticFixes"] = includePedanticFixes;
}
if (includeRequiredFixes != null) {
result["includeRequiredFixes"] = includeRequiredFixes;
}
@ -8196,6 +8222,7 @@ class EditDartfixParams implements RequestParams {
included, other.included, (String a, String b) => a == b) &&
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);
@ -8208,6 +8235,7 @@ class EditDartfixParams implements RequestParams {
int hash = 0;
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);
return JenkinsSmiHash.finish(hash);

View file

@ -1744,6 +1744,10 @@ abstract class IntegrationTestMixin {
* If a name is specified that does not match the name of a known fix, an
* error of type UNKNOWN_FIX will be generated.
*
* includePedanticFixes: bool (optional)
*
* A flag indicating that "pedantic" fixes should be applied.
*
* includeRequiredFixes: bool (optional)
*
* A flag indicating that "required" fixes should be applied.
@ -1786,10 +1790,12 @@ abstract class IntegrationTestMixin {
*/
Future<EditDartfixResult> sendEditDartfix(List<String> included,
{List<String> includedFixes,
bool includePedanticFixes,
bool includeRequiredFixes,
List<String> excludedFixes}) async {
var params = new EditDartfixParams(included,
includedFixes: includedFixes,
includePedanticFixes: includePedanticFixes,
includeRequiredFixes: includeRequiredFixes,
excludedFixes: excludedFixes)
.toJson();

View file

@ -2532,6 +2532,7 @@ final Matcher isDiagnosticGetServerPortResult = new LazyMatcher(() =>
* {
* "included": List<FilePath>
* "includedFixes": optional List<String>
* "includePedanticFixes": optional bool
* "includeRequiredFixes": optional bool
* "excludedFixes": optional List<String>
* }
@ -2541,6 +2542,7 @@ final Matcher isEditDartfixParams =
"included": isListOf(isFilePath)
}, optionalFields: {
"includedFixes": isListOf(isString),
"includePedanticFixes": isBool,
"includeRequiredFixes": isBool,
"excludedFixes": isListOf(isString)
}));

View file

@ -493,12 +493,13 @@ public interface AnalysisServer {
* @param includedFixes A list of names indicating which fixes should 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 includePedanticFixes A flag indicating that "pedantic" fixes should be applied.
* @param includeRequiredFixes A flag indicating that "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.
*/
public void edit_dartfix(List<String> included, List<String> includedFixes, boolean includeRequiredFixes, List<String> excludedFixes, DartfixConsumer consumer);
public void edit_dartfix(List<String> included, List<String> includedFixes, boolean includePedanticFixes, boolean includeRequiredFixes, List<String> excludedFixes, DartfixConsumer consumer);
/**
* {@code edit.format}

View file

@ -7,7 +7,7 @@
<body>
<h1>Analysis Server API Specification</h1>
<h1 style="color:#999999">Version
<version>1.27.1</version>
<version>1.27.2</version>
</h1>
<p>
This document contains a specification of the API provided by the
@ -2201,6 +2201,12 @@
an error of type <tt>UNKNOWN_FIX</tt> will be generated.
</p>
</field>
<field name="includePedanticFixes" optional="true">
<ref>bool</ref>
<p>
A flag indicating that "pedantic" fixes should be applied.
</p>
</field>
<field name="includeRequiredFixes" optional="true">
<ref>bool</ref>
<p>

View file

@ -1,3 +1,6 @@
# 1.1.3
* update dartfix protocol to include --pedantic
# 1.1.1
* Update ConnectionHandler to call checkServerProtocolVersion

View file

@ -6,7 +6,7 @@
// To regenerate the file, use the script
// "pkg/analysis_server/tool/spec/generate_files".
const String PROTOCOL_VERSION = '1.27.1';
const String PROTOCOL_VERSION = '1.27.2';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES = 'analysis.analyzedFiles';
const String ANALYSIS_NOTIFICATION_ANALYZED_FILES_DIRECTORIES = 'directories';
@ -168,6 +168,8 @@ const String EDIT_REQUEST_DARTFIX = 'edit.dartfix';
const String EDIT_REQUEST_DARTFIX_EXCLUDED_FIXES = 'excludedFixes';
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_FORMAT = 'edit.format';

View file

@ -8023,6 +8023,7 @@ class DiagnosticGetServerPortResult implements ResponseResult {
* {
* "included": List<FilePath>
* "includedFixes": optional List<String>
* "includePedanticFixes": optional bool
* "includeRequiredFixes": optional bool
* "excludedFixes": optional List<String>
* }
@ -8034,6 +8035,8 @@ class EditDartfixParams implements RequestParams {
List<String> _includedFixes;
bool _includePedanticFixes;
bool _includeRequiredFixes;
List<String> _excludedFixes;
@ -8083,6 +8086,18 @@ class EditDartfixParams implements RequestParams {
this._includedFixes = value;
}
/**
* A flag indicating that "pedantic" fixes should be applied.
*/
bool get includePedanticFixes => _includePedanticFixes;
/**
* A flag indicating that "pedantic" fixes should be applied.
*/
void set includePedanticFixes(bool value) {
this._includePedanticFixes = value;
}
/**
* A flag indicating that "required" fixes should be applied.
*/
@ -8115,10 +8130,12 @@ class EditDartfixParams implements RequestParams {
EditDartfixParams(List<String> included,
{List<String> includedFixes,
bool includePedanticFixes,
bool includeRequiredFixes,
List<String> excludedFixes}) {
this.included = included;
this.includedFixes = includedFixes;
this.includePedanticFixes = includePedanticFixes;
this.includeRequiredFixes = includeRequiredFixes;
this.excludedFixes = excludedFixes;
}
@ -8141,6 +8158,11 @@ class EditDartfixParams implements RequestParams {
includedFixes = jsonDecoder.decodeList(jsonPath + ".includedFixes",
json["includedFixes"], jsonDecoder.decodeString);
}
bool includePedanticFixes;
if (json.containsKey("includePedanticFixes")) {
includePedanticFixes = jsonDecoder.decodeBool(
jsonPath + ".includePedanticFixes", json["includePedanticFixes"]);
}
bool includeRequiredFixes;
if (json.containsKey("includeRequiredFixes")) {
includeRequiredFixes = jsonDecoder.decodeBool(
@ -8153,6 +8175,7 @@ class EditDartfixParams implements RequestParams {
}
return new EditDartfixParams(included,
includedFixes: includedFixes,
includePedanticFixes: includePedanticFixes,
includeRequiredFixes: includeRequiredFixes,
excludedFixes: excludedFixes);
} else {
@ -8172,6 +8195,9 @@ class EditDartfixParams implements RequestParams {
if (includedFixes != null) {
result["includedFixes"] = includedFixes;
}
if (includePedanticFixes != null) {
result["includePedanticFixes"] = includePedanticFixes;
}
if (includeRequiredFixes != null) {
result["includeRequiredFixes"] = includeRequiredFixes;
}
@ -8196,6 +8222,7 @@ class EditDartfixParams implements RequestParams {
included, other.included, (String a, String b) => a == b) &&
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);
@ -8208,6 +8235,7 @@ class EditDartfixParams implements RequestParams {
int hash = 0;
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);
return JenkinsSmiHash.finish(hash);

View file

@ -1,5 +1,5 @@
name: analysis_server_client
version: 1.1.2
version: 1.1.3
author: Dart Team <misc@dartlang.org>
description:
A client wrapper over analysis_server.