Skip to content

Commit 85083ca

Browse files
bwilkersoncommit-bot@chromium.org
authored andcommitted
Enable avoid_return_types_on_setters in analysis_server
Change-Id: Idc4a05c30ce153d59d3b9e96b3803b18dc8c6edb Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/133437 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]>
1 parent a86288a commit 85083ca

File tree

5 files changed

+48
-49
lines changed

5 files changed

+48
-49
lines changed

pkg/analysis_server/analysis_options.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@ analyzer:
1212
# Ignoring "style" lint rules from pedantic for now. There are pre-existing
1313
# violations that need to be cleaned up. Each one can be cleaned up and
1414
# enabled according to the value provided.
15-
avoid_return_types_on_setters: ignore
1615
empty_catches: ignore
1716
prefer_contains: ignore
1817
# TODO(srawlins): At the time of writing, 2400 violations in lib/. The fix

pkg/analysis_server/lib/src/context_manager.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ abstract class ContextManager {
265265
/**
266266
* Set the callback interface used to create, destroy, and update contexts.
267267
*/
268-
void set callbacks(ContextManagerCallbacks value);
268+
set callbacks(ContextManagerCallbacks value);
269269

270270
/**
271271
* A table mapping [Folder]s to the [AnalysisDriver]s associated with them.

pkg/analysis_server/lib/src/services/refactoring/extract_method.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ class ExtractMethodRefactoringImpl extends RefactoringImpl
140140
List<RefactoringMethodParameter> get parameters => _parameters;
141141

142142
@override
143-
void set parameters(List<RefactoringMethodParameter> parameters) {
143+
set parameters(List<RefactoringMethodParameter> parameters) {
144144
_parameters = parameters.toList();
145145
}
146146

pkg/analysis_server/lib/src/services/refactoring/refactoring.dart

Lines changed: 44 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ abstract class ExtractLocalRefactoring implements Refactoring {
8787
* variable. The expression used to initiate the refactoring will always be
8888
* replaced.
8989
*/
90-
void set extractAll(bool extractAll);
90+
set extractAll(bool extractAll);
9191

9292
/**
9393
* The lengths of the expressions that would be replaced by a reference to the
@@ -100,7 +100,7 @@ abstract class ExtractLocalRefactoring implements Refactoring {
100100
/**
101101
* The name that the local variable should be given.
102102
*/
103-
void set name(String name);
103+
set name(String name);
104104

105105
/**
106106
* The proposed names for the local variable.
@@ -157,14 +157,14 @@ abstract class ExtractMethodRefactoring implements Refactoring {
157157
/**
158158
* True if a getter should be created rather than a method.
159159
*/
160-
void set createGetter(bool createGetter);
160+
set createGetter(bool createGetter);
161161

162162
/**
163163
* True if all occurrences of the expression or statements should be replaced
164164
* by an invocation of the method. The expression or statements used to
165165
* initiate the refactoring will always be replaced.
166166
*/
167-
void set extractAll(bool extractAll);
167+
set extractAll(bool extractAll);
168168

169169
/**
170170
* The lengths of the expressions or statements that would be replaced by an
@@ -178,7 +178,7 @@ abstract class ExtractMethodRefactoring implements Refactoring {
178178
/**
179179
* The name that the method should be given.
180180
*/
181-
void set name(String name);
181+
set name(String name);
182182

183183
/**
184184
* The proposed names for the method.
@@ -201,7 +201,7 @@ abstract class ExtractMethodRefactoring implements Refactoring {
201201
/**
202202
* The parameters that should be defined for the method.
203203
*/
204-
void set parameters(List<RefactoringMethodParameter> parameters);
204+
set parameters(List<RefactoringMethodParameter> parameters);
205205

206206
/**
207207
* The proposed return type for the method.
@@ -211,7 +211,7 @@ abstract class ExtractMethodRefactoring implements Refactoring {
211211
/**
212212
* The return type that should be defined for the method.
213213
*/
214-
void set returnType(String returnType);
214+
set returnType(String returnType);
215215

216216
/**
217217
* Validates that the [name] is a valid identifier and is appropriate for a
@@ -248,7 +248,7 @@ abstract class ExtractWidgetRefactoring implements Refactoring {
248248
/**
249249
* The name that the class should be given.
250250
*/
251-
void set name(String name);
251+
set name(String name);
252252

253253
/**
254254
* Validates that the [name] is a valid identifier and is appropriate for a
@@ -313,13 +313,13 @@ abstract class InlineMethodRefactoring implements Refactoring {
313313
* True if the method being inlined should be removed.
314314
* It is an error if this field is `true` and [inlineAll] is `false`.
315315
*/
316-
void set deleteSource(bool deleteSource);
316+
set deleteSource(bool deleteSource);
317317

318318
/**
319319
* True if all invocations of the method should be inlined, or false if only
320320
* the invocation site used to create this refactoring should be inlined.
321321
*/
322-
void set inlineAll(bool inlineAll);
322+
set inlineAll(bool inlineAll);
323323

324324
/**
325325
* True if the declaration of the method is selected.
@@ -352,7 +352,7 @@ abstract class MoveFileRefactoring implements Refactoring {
352352
/**
353353
* The new file path to which the given file is being moved.
354354
*/
355-
void set newFile(String newName);
355+
set newFile(String newName);
356356
}
357357

358358
/**
@@ -436,14 +436,6 @@ class RefactoringWorkspace {
436436
}
437437
}
438438

439-
class RenameRefactoringElement {
440-
final Element element;
441-
final int offset;
442-
final int length;
443-
444-
RenameRefactoringElement(this.element, this.offset, this.length);
445-
}
446-
447439
/**
448440
* Abstract [Refactoring] for renaming some [Element].
449441
*/
@@ -489,6 +481,33 @@ abstract class RenameRefactoring implements Refactoring {
489481
return null;
490482
}
491483

484+
/**
485+
* Returns the human-readable description of the kind of element being renamed
486+
* (such as “class” or “function type alias”).
487+
*/
488+
String get elementKindName;
489+
490+
/**
491+
* Sets the new name for the [Element].
492+
*/
493+
set newName(String newName);
494+
495+
/**
496+
* Returns the old name of the [Element] being renamed.
497+
*/
498+
String get oldName;
499+
500+
/**
501+
* Validates that the [newName] is a valid identifier and is appropriate for
502+
* the type of the [Element] being renamed.
503+
*
504+
* It does not perform all the checks (such as checking for conflicts with any
505+
* existing names in any of the scopes containing the current name), as many
506+
* of these checks require search engine. Use [checkFinalConditions] for this
507+
* level of checking.
508+
*/
509+
RefactoringStatus checkNewName();
510+
492511
/// Given a node/element, finds the best element to rename (for example
493512
/// the class when on the `new` keyword).
494513
static RenameRefactoringElement getElementToRename(
@@ -523,31 +542,12 @@ abstract class RenameRefactoring implements Refactoring {
523542

524543
return RenameRefactoringElement(element, offset, length);
525544
}
545+
}
526546

527-
/**
528-
* Returns the human-readable description of the kind of element being renamed
529-
* (such as “class” or “function type alias”).
530-
*/
531-
String get elementKindName;
532-
533-
/**
534-
* Sets the new name for the [Element].
535-
*/
536-
void set newName(String newName);
537-
538-
/**
539-
* Returns the old name of the [Element] being renamed.
540-
*/
541-
String get oldName;
547+
class RenameRefactoringElement {
548+
final Element element;
549+
final int offset;
550+
final int length;
542551

543-
/**
544-
* Validates that the [newName] is a valid identifier and is appropriate for
545-
* the type of the [Element] being renamed.
546-
*
547-
* It does not perform all the checks (such as checking for conflicts with any
548-
* existing names in any of the scopes containing the current name), as many
549-
* of these checks require search engine. Use [checkFinalConditions] for this
550-
* level of checking.
551-
*/
552-
RefactoringStatus checkNewName();
552+
RenameRefactoringElement(this.element, this.offset, this.length);
553553
}

pkg/analysis_server/lib/starter.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ abstract class ServerStarter {
2222
* An optional manager to handle file systems which may not always be
2323
* available.
2424
*/
25-
void set detachableFileSystemManager(DetachableFileSystemManager manager);
25+
set detachableFileSystemManager(DetachableFileSystemManager manager);
2626

2727
/**
2828
* Set the instrumentation [service] that is to be used by the analysis server.
2929
*/
30-
void set instrumentationService(InstrumentationService service);
30+
set instrumentationService(InstrumentationService service);
3131

3232
/**
3333
* Use the given command-line [arguments] to start this server.

0 commit comments

Comments
 (0)