Skip to content

Commit be3237e

Browse files
srawlinsCommit Queue
authored andcommitted
analyzer_testing: deprecate MockPackagesMixin.addPedantic
Change-Id: I377e054a9abb167f7208f27067c905ff5947897c Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/460481 Reviewed-by: Konstantin Shcheglov <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent c2d5e57 commit be3237e

File tree

6 files changed

+24
-14
lines changed

6 files changed

+24
-14
lines changed

pkg/analysis_server/test/analysis/notification_errors_test.dart

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ linter:
7373

7474
Future<void> test_analysisOptionsFile_packageInclude() async {
7575
var analysisOptions = newAnalysisOptionsYamlFile(testPackageRootPath, '''
76-
include: package:pedantic/analysis_options.yaml
76+
include: package:lints/lints.yaml
7777
''');
7878

7979
await setRoots(included: [workspaceRootPath], excluded: []);
@@ -89,7 +89,15 @@ include: package:pedantic/analysis_options.yaml
8989
expect(error.type, AnalysisErrorType.STATIC_WARNING);
9090

9191
// Write a package file that allows resolving the include.
92-
writeTestPackageConfig(pedantic: true);
92+
var lintsRootPath = '/packages/lints';
93+
newFile(
94+
'$lintsRootPath/lib/lints.yaml',
95+
'# Used for testing diagnostics for imports in analysis options files.',
96+
);
97+
writeTestPackageConfig(
98+
config: PackageConfigFileBuilder()
99+
..add(name: 'lints', rootPath: lintsRootPath),
100+
);
93101

94102
// Ensure the errors disappear.
95103
await waitForTasksFinished();

pkg/analysis_server/test/shared/shared_test_interface.dart

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,5 @@ abstract interface class SharedTestInterface {
8080
String? languageVersion,
8181
bool flutter = false,
8282
bool meta = false,
83-
bool pedantic = false,
8483
});
8584
}

pkg/analysis_server/test/support/configuration_files.dart

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ mixin ConfigurationFilesMixin on MockPackagesMixin {
4646
String? languageVersion,
4747
bool flutter = false,
4848
bool meta = false,
49-
bool pedantic = false,
5049
}) {
5150
projectFolderPath = resourceProvider.convertPath(projectFolderPath);
5251

@@ -81,11 +80,6 @@ mixin ConfigurationFilesMixin on MockPackagesMixin {
8180
config.add(name: 'flutter_test', rootPath: libFolder.parent.path);
8281
}
8382

84-
if (pedantic) {
85-
var libFolder = addPedantic();
86-
config.add(name: 'pedantic', rootPath: libFolder.parent.path);
87-
}
88-
8983
if (addVectorMathPackageDep) {
9084
var libFolder = addVectorMath();
9185
config.add(name: 'vector_math', rootPath: libFolder.parent.path);
@@ -109,7 +103,6 @@ mixin ConfigurationFilesMixin on MockPackagesMixin {
109103
String? languageVersion,
110104
bool flutter = false,
111105
bool meta = false,
112-
bool pedantic = false,
113106
}) {
114107
writePackageConfig(
115108
testPackageRootPath,
@@ -118,7 +111,6 @@ mixin ConfigurationFilesMixin on MockPackagesMixin {
118111
packageName: 'test',
119112
flutter: flutter,
120113
meta: meta,
121-
pedantic: pedantic,
122114
);
123115
}
124116
}

pkg/analyzer_testing/CHANGELOG.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,11 @@
77
- Deprecate `MockPackagesMixin.addJs` and
88
`PubPackageResolutionTest.addJsPackageDep`. A mock js package can still be
99
written with `PubPackageResolutionTest.newPackage`.
10-
- Deprecate `PubPackageResolutionTest.addKernelPackageDep`. A mock kernel
10+
- Deprecate `MockPackagesMixin.addKernel` and
11+
`PubPackageResolutionTest.addKernelPackageDep`. A mock kernel
1112
package can still be written with `PubPackageResolutionTest.newPackage`.
13+
- Deprecate `MockPackagesMixin.addPedantic`. A mock pedantic package can still
14+
be written with `PubPackageResolutionTest.newPackage`.
1215

1316
## 0.1.7
1417

pkg/analyzer_testing/api.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,9 @@ package:analyzer_testing/mock_packages/mock_packages.dart:
3030
addFlutter (method: Folder Function())
3131
addFlutterTest (method: Folder Function())
3232
addJs (method: Folder Function(), deprecated)
33-
addKernel (method: Folder Function())
33+
addKernel (method: Folder Function(), deprecated)
3434
addMeta (method: Folder Function())
35-
addPedantic (method: Folder Function())
35+
addPedantic (method: Folder Function(), deprecated)
3636
addTestReflectiveLoader (method: Folder Function())
3737
addUI (method: Folder Function())
3838
addVectorMath (method: Folder Function())

pkg/analyzer_testing/lib/mock_packages/mock_packages.dart

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,10 @@ mixin MockPackagesMixin {
121121
return packageFolder.getChildAssumingFolder('lib');
122122
}
123123

124+
@Deprecated(
125+
'The mock kernel package is deprecated; use '
126+
'`PubPackageResolutionTest.newPackage` to make a custom mock',
127+
)
124128
Folder addKernel() {
125129
var packageFolder = _addFiles('kernel');
126130
return packageFolder.getChildAssumingFolder('lib');
@@ -131,6 +135,10 @@ mixin MockPackagesMixin {
131135
return packageFolder.getChildAssumingFolder('lib');
132136
}
133137

138+
@Deprecated(
139+
'The mock pedantic package is deprecated; use '
140+
'`PubPackageResolutionTest.newPackage` to make a custom mock',
141+
)
134142
Folder addPedantic() {
135143
var packageFolder = _addFiles('pedantic');
136144
return packageFolder.getChildAssumingFolder('lib');

0 commit comments

Comments
 (0)