Repository navigation
🐛 Always end generated pubspec section with a final newline - #10
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Goal
Closes the endless diff churn when a project's tooling (editorconfig
insert_final_newline, format-on-save, git hooks) enforces a final newline:Yaml.write()ended withyamlString.trim(), so the generated# assets endblock always landed at EOF without a trailing newline. Newline-enforcing tools re-added it, the next generation stripped it again — dirty diffs on every run.Changes
lib/src/yaml.dart: write${yamlString.trim()}\nso the file always ends with exactly one newline, whether the block is at EOF or mid-file.test/yaml_test.dart(first test suite in the repo): each test runsYaml.write()5× the way the generator does (fresh instance + fresh asset list per run) and asserts byte-stability, covering:fonts:section) — below-content preserved verbatim, runs convergeassets:key with a sibling key belowflutter:with a top-level key belowexample/pubspecs: one-time normalization to the new stable output (adds the missing final newline).pubspec.yaml: addstestdev dependency.Verification
dart test— 4/4 pass.example/twice: 2nd run byte-identical (md5match) — rerun churn eliminated.dart analyze lib testclean.