Skip to content

Commit 240b9de

Browse files
authored
Ignore hidden projects (#272)
1 parent dcce163 commit 240b9de

File tree

4 files changed

+19
-59
lines changed

4 files changed

+19
-59
lines changed

packages/custom_lint/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
- Fix CI
44
- Fix custom_lint not warning non-Dart files when necessary.
5+
- Custom_lint no-longer tries to analyze projects that lack a `.dart_tool/package_config.json`
56

67
## 0.6.7 - 2024-09-08
78

packages/custom_lint/lib/src/workspace.dart

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -413,14 +413,8 @@ Iterable<String> _findRoots(String path) sync* {
413413
if (fileName != 'pubspec.yaml' && fileName != 'analysis_options.yaml') {
414414
return false;
415415
}
416-
// Check if the project has a package_config.json file.
417-
final isChildFromCache =
418-
file.uri.pathSegments.any((e) => e == '.dart_tool' || e == '.symlinks');
419-
if (isChildFromCache) {
420-
return file.parent.packageConfig.existsSync();
421-
}
422416

423-
return true;
417+
return file.parent.packageConfig.existsSync();
424418
}).map((file) => file.parent.path);
425419
}
426420

packages/custom_lint/test/cli_process_test.dart

Lines changed: 14 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,20 @@ version: 0.0.1
142142
'ios',
143143
parent: app,
144144
);
145+
createTmpFolder(
146+
{
147+
join(
148+
'flutter',
149+
'ephemeral',
150+
'.plugin_symlinks',
151+
'plugin_name',
152+
'example',
153+
'pubspec.yaml',
154+
): testDepsPubSpec,
155+
},
156+
'linux',
157+
parent: app,
158+
);
145159

146160
final process = Process.runSync(
147161
'dart',
@@ -268,56 +282,6 @@ Analyzing...
268282
);
269283
}
270284

271-
test(
272-
'missing package_config.json',
273-
() async {
274-
final plugin = createPlugin(name: 'test_lint', main: oyPluginSource);
275-
276-
final app = createLintUsage(
277-
name: 'test_app',
278-
source: {
279-
'lib/main.dart': 'void fn() {}',
280-
'lib/another.dart': 'void fail() {}',
281-
},
282-
plugins: {'test_lint': plugin.uri},
283-
);
284-
285-
// Create a child context root
286-
final innerContextRoot = createLintUsage(
287-
name: 'test_project_inner',
288-
source: {
289-
'lib/main.dart': 'void fn() {}',
290-
'lib/another.dart': 'void fail() {}',
291-
},
292-
parent: app,
293-
);
294-
295-
// create error during initialization because of missing package_config.json
296-
final packageConfig = innerContextRoot.packageConfig;
297-
// Potentially resolve the file system link, temp folders are links on macOs into /private/var
298-
final missingPackageConfig =
299-
await innerContextRoot.resolveSymbolicLinks();
300-
packageConfig.deleteSync();
301-
302-
final process = await Process.run(
303-
'dart',
304-
[customLintBinPath],
305-
workingDirectory: app.path,
306-
);
307-
308-
expect(process.exitCode, isNot(0));
309-
expect(
310-
trimDependencyOverridesWarning(process.stderr),
311-
startsWith(
312-
'Failed to decode .dart_tool/package_config.json at $missingPackageConfig. '
313-
'Make sure to run `pub get` first.\n'
314-
'PathNotFoundException: Cannot open file, path =',
315-
),
316-
);
317-
expect(process.stdout, isEmpty);
318-
},
319-
);
320-
321285
test(
322286
'dependency conflict',
323287
() async {

packages/custom_lint/test/src/workspace_test.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2403,8 +2403,9 @@ dependency_overrides:
24032403
final analysisFile = workspace.dir('package').analysisOptions;
24042404
analysisFile.createSync();
24052405
analysisFile.writeAsStringSync(analysisOptionsWithCustomLintEnabled);
2406-
final nestedAnalysisFile =
2407-
workspace.dir('package', 'test').analysisOptions;
2406+
final testDir = workspace.dir('package', 'test');
2407+
testDir.packageConfig.createSync(recursive: true);
2408+
final nestedAnalysisFile = testDir.analysisOptions;
24082409
nestedAnalysisFile.createSync(recursive: true);
24092410
nestedAnalysisFile
24102411
.writeAsStringSync(analysisOptionsWithCustomLintEnabled);

0 commit comments

Comments
 (0)