Skip to content

Commit 6acab30

Browse files
pqCommit Queue
authored andcommitted
[analytics] validate lintUsage reporting for multiple options files
Change-Id: I6d6bbcc14d80fc670e134a8fa84f0ef42d17b3f7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/418440 Auto-Submit: Phil Quitslund <[email protected]> Commit-Queue: Brian Wilkerson <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 4d21cd4 commit 6acab30

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

pkg/analysis_server/lib/src/analytics/analytics_manager.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ class AnalyticsManager {
7474
/// that have been handled.
7575
final Map<String, NotificationData> _completedNotifications = {};
7676

77-
/// A map from the name of a lint to the number of contexts in which the lint
77+
/// A map from the name of a lint to the number of options files in which the lint
7878
/// was enabled.
7979
final Map<String, int> _lintUsageCounts = {};
8080

pkg/analysis_server/test/src/analytics/analytics_manager_test.dart

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,14 +47,28 @@ class AnalyticsManagerTest with ResourceProviderMixin {
4747
_createAnalysisOptionsFile(
4848
lints: ['avoid_dynamic_calls', 'await_only_futures', 'unawaited_futures'],
4949
);
50+
// Add a second set of options so we can validate usage counts for multiple
51+
// options files.
52+
_createAnalysisOptionsFile(
53+
path: '$testPackageRootPath/sub/analysis_options.yaml',
54+
lints: [
55+
// A duplicate.
56+
'avoid_dynamic_calls',
57+
// And a new lint.
58+
'void_checks',
59+
],
60+
);
5061
var collection = _createContexts();
5162
_defaultStartup();
5263
manager.createdAnalysisContexts(collection.contexts);
5364
await manager.shutdown();
5465
analytics.assertEvents([
5566
_ExpectedEvent.session(),
5667
_ExpectedEvent.lintUsageCount(
57-
eventData: {'count': 1, 'name': 'avoid_dynamic_calls'},
68+
eventData: {'count': 2, 'name': 'avoid_dynamic_calls'},
69+
),
70+
_ExpectedEvent.lintUsageCount(
71+
eventData: {'count': 1, 'name': 'void_checks'},
5872
),
5973
_ExpectedEvent.lintUsageCount(
6074
eventData: {'count': 1, 'name': 'await_only_futures'},

0 commit comments

Comments
 (0)