[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 <pquitslund@google.com> Commit-Queue: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This commit is contained in:
@@ -74,7 +74,7 @@ class AnalyticsManager {
|
||||
/// that have been handled.
|
||||
final Map<String, NotificationData> _completedNotifications = {};
|
||||
|
||||
/// A map from the name of a lint to the number of contexts in which the lint
|
||||
/// A map from the name of a lint to the number of options files in which the lint
|
||||
/// was enabled.
|
||||
final Map<String, int> _lintUsageCounts = {};
|
||||
|
||||
|
||||
@@ -47,6 +47,17 @@ class AnalyticsManagerTest with ResourceProviderMixin {
|
||||
_createAnalysisOptionsFile(
|
||||
lints: ['avoid_dynamic_calls', 'await_only_futures', 'unawaited_futures'],
|
||||
);
|
||||
// Add a second set of options so we can validate usage counts for multiple
|
||||
// options files.
|
||||
_createAnalysisOptionsFile(
|
||||
path: '$testPackageRootPath/sub/analysis_options.yaml',
|
||||
lints: [
|
||||
// A duplicate.
|
||||
'avoid_dynamic_calls',
|
||||
// And a new lint.
|
||||
'void_checks',
|
||||
],
|
||||
);
|
||||
var collection = _createContexts();
|
||||
_defaultStartup();
|
||||
manager.createdAnalysisContexts(collection.contexts);
|
||||
@@ -54,7 +65,10 @@ class AnalyticsManagerTest with ResourceProviderMixin {
|
||||
analytics.assertEvents([
|
||||
_ExpectedEvent.session(),
|
||||
_ExpectedEvent.lintUsageCount(
|
||||
eventData: {'count': 1, 'name': 'avoid_dynamic_calls'},
|
||||
eventData: {'count': 2, 'name': 'avoid_dynamic_calls'},
|
||||
),
|
||||
_ExpectedEvent.lintUsageCount(
|
||||
eventData: {'count': 1, 'name': 'void_checks'},
|
||||
),
|
||||
_ExpectedEvent.lintUsageCount(
|
||||
eventData: {'count': 1, 'name': 'await_only_futures'},
|
||||
|
||||
Reference in New Issue
Block a user