Skip to content

Commit 25ab621

Browse files
Fix dependency_validator issues
1 parent 2d80fd4 commit 25ab621

File tree

3 files changed

+4
-29
lines changed

3 files changed

+4
-29
lines changed

tools/analyzer_plugin/pubspec.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,10 @@ dev_dependencies:
3030
io: ^1.0.0
3131
logging: ^1.0.1
3232
markdown: ^4.0.0
33-
package_config: ^2.0.0
3433
pub_semver: ^2.0.0
3534
test: ^1.14.0
3635
test_reflective_loader: ^0.2.0
36+
uuid: '>3.0.0 <4.0.0'
3737
workiva_analysis_options: ^1.1.0
3838

3939
dependency_validator:

tools/analyzer_plugin/test/integration/test_bases/analysis_driver_test_base.dart

+1-3
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,7 @@ abstract class AnalysisDriverTestBase {
3535
if (path != null && p.isAbsolute(path)) {
3636
throw ArgumentError.value(path, 'path', 'must be a relative path');
3737
}
38-
final fileContext = sharedContext.fileContextForTest(contents, filename: path,
39-
// TODO could we enable this in some cases?
40-
includeTestDescription: false);
38+
final fileContext = sharedContext.fileContextForTest(contents, filename: path);
4139
return resourceProvider.getFile(fileContext.path).createSource();
4240
}
4341

tools/analyzer_plugin/test/util/shared_analysis_context.dart

+2-25
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,6 @@ import 'package:io/io.dart';
2929
import 'package:path/path.dart' as p;
3030
import 'package:source_span/source_span.dart';
3131

32-
// This isn't strictly required for anything, so if the import becomes invalid,
33-
// just comment it and related code out.
34-
import 'package:test_api/src/backend/invoker.dart' show Invoker;
35-
import 'package:uuid/uuid.dart';
36-
3732
import 'package_util.dart';
3833
import 'util.dart';
3934

@@ -193,13 +188,11 @@ class SharedAnalysisContext {
193188
Future<FileContext> resolvedFileContextForTest(
194189
String sourceText, {
195190
String? filename,
196-
bool includeTestDescription = true,
197191
bool preResolveLibrary = true,
198192
bool throwOnAnalysisErrors = true,
199193
IsExpectedError? isExpectedError,
200194
}) async {
201-
final fileContext =
202-
fileContextForTest(sourceText, filename: filename, includeTestDescription: includeTestDescription);
195+
final fileContext = fileContextForTest(sourceText, filename: filename);
203196

204197
final context = collection.contexts.singleWhere((c) => c.contextRoot.root.path == contextRootPath);
205198

@@ -223,24 +216,8 @@ class SharedAnalysisContext {
223216
return fileContext;
224217
}
225218

226-
FileContext fileContextForTest(
227-
String sourceText, {
228-
String? filename,
229-
bool includeTestDescription = true,
230-
}) {
219+
FileContext fileContextForTest(String sourceText, {String? filename}) {
231220
filename ??= nextFilename();
232-
233-
if (includeTestDescription) {
234-
// For convenience, include the current test description in the file as
235-
// a comment, so that:
236-
// - you can tell you're looking at the right file for a given test
237-
// - you can search for the test description to easily find the right file
238-
try {
239-
final testName = Invoker.current!.liveTest.test.name;
240-
sourceText = lineComment('Created within test with name:\n> $testName') + '\n' + sourceText;
241-
} catch (_) {}
242-
}
243-
244221
final path = p.join(contextRootPath, _testFileSubpath, filename);
245222
final file = File(path);
246223
if (file.existsSync()) {

0 commit comments

Comments
 (0)