Skip to content

Fix IOFileSystemPath printing during package resolution exceptions - #1818

Merged
kevmoo merged 3 commits into
mainfrom
fix_bug
Mar 30, 2026
Merged

kevmoo merged 3 commits into
mainfrom
fix_bug

Conversation

@kevmoo

@kevmoo kevmoo commented Mar 28, 2026

Copy link
Copy Markdown
Member

The IOFileSystemPath object lacked a toString() method, leading to Instance of 'IOFileSystemPath' being rendered in error strings. When PackageResolutionException was thrown encountering package resolution errors while reading analysis options, the path output was masked.

This change adds toString() to IOFileSystemPath to output the correct underlying file system .path. A test is also added to io_file_system_test.dart preventing regressions.

The `IOFileSystemPath` object lacked a `toString()` method, leading to `Instance of 'IOFileSystemPath'` being rendered in error strings. When `PackageResolutionException` was thrown encountering package resolution errors while reading analysis options, the path output was masked.

This change adds `toString()` to `IOFileSystemPath` to output the correct underlying file system `.path`. A test is also added to `io_file_system_test.dart` preventing regressions.
@kevmoo

kevmoo commented Mar 28, 2026

Copy link
Copy Markdown
Member Author

This is a follow-up fix to 0d56d85

@kevmoo
kevmoo requested a review from kallentu March 28, 2026 02:49
kevmoo added a commit to dart-lang/ecosystem that referenced this pull request Mar 28, 2026
The associated analysis_options uses dart_flutter_team_lints

So dartfmt was logging a lot of errors. Fixes those

Also helped me find/fix dart-lang/dart_style#1818
@kevmoo
kevmoo merged commit 5ed5aad into main Mar 30, 2026
8 checks passed
@kevmoo
kevmoo deleted the fix_bug branch March 30, 2026 17:16
Curstantine pushed a commit to Curstantine/fart_style that referenced this pull request Apr 2, 2026
…art-lang#1818)

The `IOFileSystemPath` object lacked a `toString()` method, leading to `Instance of 'IOFileSystemPath'` being rendered in error strings. When `PackageResolutionException` was thrown encountering package resolution errors while reading analysis options, the path output was masked.

This change adds `toString()` to `IOFileSystemPath` to output the correct underlying file system `.path`. A test is also added to `io_file_system_test.dart` preventing regressions.

* Also improve incorrect error messages about while analysis_options couldn't be found
munificent added a commit that referenced this pull request Jun 5, 2026
If an analysis_options.yaml file has an include that points to another relative path and reading that other file fails, print a warning and continue as if the file was found and empty.

Fix #1840.

This is sort of a short-term fix for the root cause of that issue which is that the formatter is trying to format code in `build/` directories that contain packages that aren't fully resolved with all of their dependencies and shouldn't be formatted anyway.

I think the right long-term solution for that is to support file exclusion (#864). I plan to work on that soon, but it will take a while because it's part of revising the overall library API and how configuration data is plumbed from hosts to the formatter.

Even when that long-term solution is done, I think this change is good too. It's still possible for users to get into this situation, as simply as having a typo in an analysis_options.yaml file. When that happens, the formatter should degrade more gracefully. Warning and continuing as in this PR is consistent with how we handle other configuration failures.

---

Note: This PR is identical to #1851 except:

* It is intended to be merged onto the dart-sdk-stable branch so that it can be cherry-picked to the stable Dart SDK without pulling in other changes on dart_style main that the stable SDK shouldn't get.

* It includes [the changes to `io_file_system.dart`](5ed5aad#diff-cd6508e68de5dc72aa1bb51352d5258b9d1dd228d66fae6b1b0831b25b507726) from [this PR](#1818) which this fix relies on.
munificent added a commit that referenced this pull request Jun 8, 2026
…#1853)

Don't crash on a missing analysis_options.yaml include.

If an analysis_options.yaml file has an include that points to another relative path and reading that other file fails, print a warning and continue as if the file was found and empty.

Fix #1840.

This is sort of a short-term fix for the root cause of that issue which is that the formatter is trying to format code in `build/` directories that contain packages that aren't fully resolved with all of their dependencies and shouldn't be formatted anyway.

I think the right long-term solution for that is to support file exclusion (#864). I plan to work on that soon, but it will take a while because it's part of revising the overall library API and how configuration data is plumbed from hosts to the formatter.

Even when that long-term solution is done, I think this change is good too. It's still possible for users to get into this situation, as simply as having a typo in an analysis_options.yaml file. When that happens, the formatter should degrade more gracefully. Warning and continuing as in this PR is consistent with how we handle other configuration failures.

---

Note: This PR is identical to #1851 except:

* It is intended to be merged onto the dart-sdk-stable branch so that it can be cherry-picked to the stable Dart SDK without pulling in other changes on dart_style main that the stable SDK shouldn't get.

* It includes [the changes to `io_file_system.dart`](5ed5aad#diff-cd6508e68de5dc72aa1bb51352d5258b9d1dd228d66fae6b1b0831b25b507726) from #1818 which this fix relies on.
munificent added a commit that referenced this pull request Jun 8, 2026
…1855)

If an analysis_options.yaml file has an include that points to another relative path and reading that other file fails, print a warning and continue as if the file was found and empty.

Fix #1840.

This is sort of a short-term fix for the root cause of that issue which is that the formatter is trying to format code in `build/` directories that contain packages that aren't fully resolved with all of their dependencies and shouldn't be formatted anyway.

I think the right long-term solution for that is to support file exclusion (#864). I plan to work on that soon, but it will take a while because it's part of revising the overall library API and how configuration data is plumbed from hosts to the formatter.

Even when that long-term solution is done, I think this change is good too. It's still possible for users to get into this situation, as simply as having a typo in an analysis_options.yaml file. When that happens, the formatter should degrade more gracefully. Warning and continuing as in this PR is consistent with how we handle other configuration failures.

---

Note: This PR is identical to #1851 except:

* Its parent commit is f1d10e1, which is the commit that Dart SDK main branch currently has for dart_style.

* It includes [the changes to `io_file_system.dart`](5ed5aad#diff-cd6508e68de5dc72aa1bb51352d5258b9d1dd228d66fae6b1b0831b25b507726) from #1818 which this fix relies on.

* It has a slightly different CHANGELOG entry.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants