Skip to content

Commit 76c35b2

Browse files
srawlinsCommit Queue
authored andcommitted
DAS: Rename constants in code_completion tool to use lowerCamelCase
Change-Id: I993d9386c63766471dd8d5ae7f1e63f3f9bf8ce3 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/459844 Auto-Submit: Samuel Rawlins <[email protected]> Reviewed-by: Keerti Parthasarathy <[email protected]> Commit-Queue: Keerti Parthasarathy <[email protected]>
1 parent 76d56d7 commit 76c35b2

File tree

4 files changed

+52
-49
lines changed

4 files changed

+52
-49
lines changed

pkg/analysis_server/tool/code_completion/completion_metrics.dart

Lines changed: 27 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ ArgParser createArgParser() {
153153
)
154154
..addFlag('help', abbr: 'h', help: 'Print this help message.')
155155
..addOption(
156-
CompletionMetricsOptions.OVERLAY,
156+
CompletionMetricsOptions.overlayOption,
157157
allowed: [
158158
OverlayMode.none.flag,
159159
OverlayMode.removeRestOfFile.flag,
@@ -167,38 +167,38 @@ ArgParser createArgParser() {
167167
'complete at the start of the token without modifying the file.',
168168
)
169169
..addOption(
170-
CompletionMetricsOptions.PREFIX_LENGTH,
170+
CompletionMetricsOptions.prefixLengthOption,
171171
defaultsTo: '0',
172172
help:
173173
'The number of characters to include in the prefix. Each '
174174
'completion will be requested this many characters in from the '
175175
'start of the token being completed.',
176176
)
177177
..addFlag(
178-
CompletionMetricsQualityOptions.PRINT_MISSED_COMPLETION_DETAILS,
178+
CompletionMetricsQualityOptions._printMissedCompletionDetails,
179179
help:
180180
'Print detailed information every time a completion request fails '
181181
'to produce a suggestions matching the expected suggestion.',
182182
negatable: false,
183183
)
184184
..addFlag(
185-
CompletionMetricsQualityOptions.PRINT_MISSED_COMPLETION_SUMMARY,
185+
CompletionMetricsQualityOptions._printMissedCompletionSummary,
186186
help:
187187
'Print summary information about the times that a completion '
188188
'request failed to produce a suggestions matching the expected '
189189
'suggestion.',
190190
negatable: false,
191191
)
192192
..addFlag(
193-
CompletionMetricsQualityOptions.PRINT_MISSING_INFORMATION,
193+
CompletionMetricsQualityOptions._printMissingInformation,
194194
help:
195195
'Print information about places where no completion location was '
196196
'computed and about information that is missing in the completion '
197197
'tables.',
198198
negatable: false,
199199
)
200200
..addFlag(
201-
CompletionMetricsQualityOptions.PRINT_MRR_BY_LOCATION,
201+
CompletionMetricsQualityOptions._printMrrByLocation,
202202
help:
203203
'Print information about the mrr score achieved at each completion '
204204
'location. This can help focus efforts to improve the overall '
@@ -207,22 +207,22 @@ ArgParser createArgParser() {
207207
negatable: false,
208208
)
209209
..addFlag(
210-
CompletionMetricsQualityOptions.PRINT_SHADOWED_COMPLETION_DETAILS,
210+
CompletionMetricsQualityOptions._printShadowedCompletionDetails,
211211
help:
212212
'Print detailed information every time a completion request '
213213
'produces a suggestion whose name matches the expected suggestion '
214214
'but that is referencing a different element',
215215
negatable: false,
216216
)
217217
..addFlag(
218-
CompletionMetricsOptions.PRINT_SLOWEST_RESULTS,
218+
CompletionMetricsOptions.printSlowestResultsFlag,
219219
help:
220220
'Print information about the completion requests that were the '
221221
'slowest to return suggestions.',
222222
negatable: false,
223223
)
224224
..addFlag(
225-
CompletionMetricsQualityOptions.PRINT_WORST_RESULTS,
225+
CompletionMetricsQualityOptions._printWorstResults,
226226
help:
227227
'Print information about the completion requests that had the '
228228
'worst mrr scores.',
@@ -691,34 +691,34 @@ class CompletionMetricsQualityOptions extends CompletionMetricsOptions {
691691
/// A flag that causes detailed information to be printed every time a
692692
/// completion request fails to produce a suggestions matching the expected
693693
/// suggestion.
694-
static const String PRINT_MISSED_COMPLETION_DETAILS =
694+
static const String _printMissedCompletionDetails =
695695
'print-missed-completion-details';
696696

697697
/// A flag that causes summary information to be printed about the times that
698698
/// a completion request failed to produce a suggestions matching the expected
699699
/// suggestion.
700-
static const String PRINT_MISSED_COMPLETION_SUMMARY =
700+
static const String _printMissedCompletionSummary =
701701
'print-missed-completion-summary';
702702

703703
/// A flag that causes information to be printed about places where no
704704
/// completion location was computed and about information that's missing in
705705
/// the completion tables.
706-
static const String PRINT_MISSING_INFORMATION = 'print-missing-information';
706+
static const String _printMissingInformation = 'print-missing-information';
707707

708708
/// A flag that causes information to be printed about the mrr score achieved
709709
/// at each completion location.
710-
static const String PRINT_MRR_BY_LOCATION = 'print-mrr-by-location';
710+
static const String _printMrrByLocation = 'print-mrr-by-location';
711711

712712
/// A flag that causes detailed information to be printed every time a
713713
/// completion request produce a suggestions whose name matches the expected
714714
/// suggestion but that is referencing a different element (one that's
715715
/// shadowed by the correct element).
716-
static const String PRINT_SHADOWED_COMPLETION_DETAILS =
716+
static const String _printShadowedCompletionDetails =
717717
'print-shadowed-completion-details';
718718

719719
/// A flag that causes information to be printed about the completion requests
720720
/// that had the worst mrr scores.
721-
static const String PRINT_WORST_RESULTS = 'print-worst-results';
721+
static const String _printWorstResults = 'print-worst-results';
722722

723723
/// A flag indicating whether information should be printed every time a
724724
/// completion request fails to produce a suggestions matching the expected
@@ -749,15 +749,18 @@ class CompletionMetricsQualityOptions extends CompletionMetricsOptions {
749749
final bool printWorstResults;
750750

751751
CompletionMetricsQualityOptions(super.results)
752-
: printMissedCompletionDetails =
753-
results[PRINT_MISSED_COMPLETION_DETAILS] as bool,
754-
printMissedCompletionSummary =
755-
results[PRINT_MISSED_COMPLETION_SUMMARY] as bool,
756-
printMissingInformation = results[PRINT_MISSING_INFORMATION] as bool,
757-
printMrrByLocation = results[PRINT_MRR_BY_LOCATION] as bool,
758-
printShadowedCompletionDetails =
759-
results[PRINT_SHADOWED_COMPLETION_DETAILS] as bool,
760-
printWorstResults = results[PRINT_WORST_RESULTS] as bool;
752+
: printMissedCompletionDetails = results.flag(
753+
_printMissedCompletionDetails,
754+
),
755+
printMissedCompletionSummary = results.flag(
756+
_printMissedCompletionSummary,
757+
),
758+
printMissingInformation = results.flag(_printMissingInformation),
759+
printMrrByLocation = results.flag(_printMrrByLocation),
760+
printShadowedCompletionDetails = results.flag(
761+
_printShadowedCompletionDetails,
762+
),
763+
printWorstResults = results.flag(_printWorstResults);
761764
}
762765

763766
/// This is the main metrics computer class for code completions. After the

pkg/analysis_server/tool/code_completion/completion_metrics_base.dart

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -190,17 +190,17 @@ abstract class CompletionMetricsComputer {
190190
/// The options specified on the command-line.
191191
class CompletionMetricsOptions {
192192
/// An option to control whether and how overlays should be produced.
193-
static const String OVERLAY = 'overlay';
193+
static const String overlayOption = 'overlay';
194194

195195
/// An option controlling how long of a prefix should be used.
196196
///
197197
/// This affects the offset of the completion request, and how much content is
198198
/// removed in each of the overlay modes.
199-
static const String PREFIX_LENGTH = 'prefix-length';
199+
static const String prefixLengthOption = 'prefix-length';
200200

201201
/// A flag that causes information to be printed about the completion requests
202202
/// that were the slowest to return suggestions.
203-
static const String PRINT_SLOWEST_RESULTS = 'print-slowest-results';
203+
static const String printSlowestResultsFlag = 'print-slowest-results';
204204

205205
/// The overlay mode that should be used.
206206
final OverlayMode overlay;
@@ -212,9 +212,9 @@ class CompletionMetricsOptions {
212212
final bool printSlowestResults;
213213

214214
CompletionMetricsOptions(ArgResults results)
215-
: overlay = OverlayMode.parseFlag(results[OVERLAY] as String),
216-
prefixLength = int.parse(results[PREFIX_LENGTH] as String),
217-
printSlowestResults = results[PRINT_SLOWEST_RESULTS] as bool;
215+
: overlay = OverlayMode.parseFlag(results.option(overlayOption)!),
216+
prefixLength = int.parse(results.option(prefixLengthOption)!),
217+
printSlowestResults = results.flag(printSlowestResultsFlag);
218218
}
219219

220220
enum OverlayMode {

pkg/analysis_server/tool/code_completion/completion_metrics_client.dart

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ ArgParser _createArgParser() {
6767
)
6868
..addFlag('help', abbr: 'h', help: 'Print this help message.')
6969
..addOption(
70-
CompletionMetricsOptions.OVERLAY,
70+
CompletionMetricsOptions.overlayOption,
7171
allowed: [
7272
OverlayMode.none.flag,
7373
OverlayMode.removeRestOfFile.flag,
@@ -81,15 +81,15 @@ ArgParser _createArgParser() {
8181
'complete at the start of the token without modifying the file.',
8282
)
8383
..addOption(
84-
CompletionMetricsOptions.PREFIX_LENGTH,
84+
CompletionMetricsOptions.prefixLengthOption,
8585
defaultsTo: '0',
8686
help:
8787
'The number of characters to include in the prefix. Each '
8888
'completion will be requested this many characters in from the '
8989
'start of the token being completed.',
9090
)
9191
..addFlag(
92-
CompletionMetricsOptions.PRINT_SLOWEST_RESULTS,
92+
CompletionMetricsOptions.printSlowestResultsFlag,
9393
help:
9494
'Print information about the completion requests that were the '
9595
'slowest to return suggestions.',

pkg/analysis_server/tool/code_completion/visitors.dart

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -130,19 +130,19 @@ class ExpectedCompletion {
130130
}
131131

132132
class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
133-
static const ASYNC_STAR = 'async*';
133+
static const _asyncStar = 'async*';
134134

135-
static const DEFAULT_COLON = 'default:';
135+
static const _defaultColon = 'default:';
136136

137-
static const DEFERRED_AS = 'deferred as';
137+
static const _deferredAs = 'deferred as';
138138

139-
static const EXPORT_STATEMENT = "export '';";
139+
static const _exportStatement = "export '';";
140140

141-
static const IMPORT_STATEMENT = "import '';";
141+
static const _importStatement = "import '';";
142142

143-
static const PART_STATEMENT = "part '';";
144-
static const SYNC_STAR = 'sync*';
145-
static const YIELD_STAR = 'yield*';
143+
static const _partStatement = "part '';";
144+
static const _syncStar = 'sync*';
145+
static const _yieldStar = 'yield*';
146146

147147
/// The result of resolving the file being visited.
148148
final ResolvedUnitResult result;
@@ -204,7 +204,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
204204
entity,
205205
lineNumber,
206206
columnNumber,
207-
ASYNC_STAR,
207+
_asyncStar,
208208
kind,
209209
elementKind,
210210
),
@@ -216,7 +216,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
216216
entity,
217217
lineNumber,
218218
columnNumber,
219-
DEFAULT_COLON,
219+
_defaultColon,
220220
kind,
221221
elementKind,
222222
),
@@ -228,7 +228,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
228228
entity,
229229
lineNumber,
230230
columnNumber,
231-
DEFERRED_AS,
231+
_deferredAs,
232232
kind,
233233
elementKind,
234234
),
@@ -240,7 +240,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
240240
entity,
241241
lineNumber,
242242
columnNumber,
243-
EXPORT_STATEMENT,
243+
_exportStatement,
244244
kind,
245245
elementKind,
246246
),
@@ -252,7 +252,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
252252
entity,
253253
lineNumber,
254254
columnNumber,
255-
IMPORT_STATEMENT,
255+
_importStatement,
256256
kind,
257257
elementKind,
258258
),
@@ -264,7 +264,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
264264
entity,
265265
lineNumber,
266266
columnNumber,
267-
PART_STATEMENT,
267+
_partStatement,
268268
kind,
269269
elementKind,
270270
),
@@ -276,7 +276,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
276276
entity,
277277
lineNumber,
278278
columnNumber,
279-
SYNC_STAR,
279+
_syncStar,
280280
kind,
281281
elementKind,
282282
),
@@ -288,7 +288,7 @@ class ExpectedCompletionsVisitor extends RecursiveAstVisitor<void> {
288288
entity,
289289
lineNumber,
290290
columnNumber,
291-
YIELD_STAR,
291+
_yieldStar,
292292
kind,
293293
elementKind,
294294
),

0 commit comments

Comments
 (0)