Added uncovered files detection - Issue #529#2029
Added uncovered files detection - Issue #529#2029Victowolf wants to merge 3 commits intodart-lang:mainfrom Victowolf:main
Conversation
liamappelbe
left a comment
There was a problem hiding this comment.
This PR needs tests.
|
|
||
| analyzer: | ||
| errors: | ||
| unnecessary_this: ignore |
There was a problem hiding this comment.
You can fix this lint, you don't need to add an exception.
| /// | ||
| /// If [isolateIds] is set, the coverage gathering will be restricted to only | ||
| /// those VM isolates. | ||
| /// If [isolateIds] is set, coverage gathering **will not be restricted** to |
| // for details. All rights reserved. Use of this source code is governed by a | ||
| // BSD-style license that can be found in the LICENSE file. | ||
|
|
||
| // ignore_for_file: unnecessary_this |
| waitPaused); | ||
|
|
||
| // Apply filtering if a filter function is provided | ||
| if (filter != null) { |
There was a problem hiding this comment.
What are these changes for? They seem unrelated to the PR. There's already a bunch of ways of filtering the coverage, so I'm not sure what this is for.
If you check what the _getAllCoverage function actually returns, this filter definitely won't work as you intend. Did you test your code?
| final buf = StringBuffer(); | ||
|
|
||
| // Get all Dart files in the project | ||
| final allDartFiles = resolver.listAllDartFiles().toSet(); |
There was a problem hiding this comment.
Lots of duplicated code between formatLcov and prettyPrint. Can you factorize them?
|
|
||
| // Add uncovered files if allowed | ||
| for (final file in uncoveredFiles) { | ||
| if (includeUncovered != null && !includeUncovered(file)) continue; |
There was a problem hiding this comment.
If includeUncovered is null, then no uncovered files should be included. That's to ensure we don't change behavior for existing users.
| @Deprecated('Use Resolver.create') | ||
| Resolver({this.packagesPath, this.sdkRoot}) | ||
|
|
||
| Resolver |
There was a problem hiding this comment.
Can you revert all these unrelated formatting changes?
| Map<String, Uri>? packages}) | ||
| : _packages = packages; | ||
| /// Returns a list of all Dart files in the project. | ||
| List<String> listAllDartFiles({String directoryPath = '.'}) { |
There was a problem hiding this comment.
This util doesn't need to be on Resolver. It doesn't use any of the fields.
Contribution guidelines:
dart format.Note that many Dart repos have a weekly cadence for reviewing PRs - please allow for some latency before initial review feedback.
Summary
This PR enhances
package:coverageby adding support for detecting uncovered files.Changes
Testing
dart testand all tests passed successfully.Issue Reference