Repository navigation
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.
Summary
pud fmtsilently ignored extra operands: given a package directory followed by one or more.pudfiles (or two package directories), it formatted only the first package and ignored the rest. This change classifies the operands up front and rejects ambiguous combinations with a clear diagnostic before any file is written. The supported forms are unchanged.What changed
fmt_targetsnow splits positional arguments into.pudfile operands and package operands. A mix of the two, or more than one package operand, returns anErr.run_fmtresolvesfmt_targetsbefore its write loop, so the error is reported viafailbefore any files are modified. The diagnostic states the expected forms: "pass either a single package directory or one or more .pud files"..pudfiles still format and check.[Unreleased]referencing Reject mixed package and file operands inpud fmt#10.How verified
Reproduced on the unmodified code with the prebuilt debug binary:
pud fmt <pkg> <extra.pud>exited 0, rewrote only the package'ssrc/main.pud, and silently ignoredextra.pud.pud fmt --check <pkg>andpud fmt --check <f1.pud> <f2.pud>worked as expected.After the fix (binary built in this worktree):
pud fmt <pkg> <extra.pud>-> exit 1 witherror: cannot mix a package directory with .pud files; pass either a single package directory or one or more .pud files; neither file modified.pud fmt <pkg1> <pkg2>-> exit 1 witherror: expected a single package directory; pass either a single package directory or one or more .pud files.pud fmt --check <pkg>andpud fmt --check <f1.pud> <f2.pud>-> still report exactly the expected files.cargo test --test run fmt_ -- --nocapture-> 4 passed, 0 failed.cargo test -- --skip conformance_suite-> all passed (3 unit + 0 conformance + 9 integration). One run showed the unrelated timing-flakyplugin_host_capabilitiestest fail under parallel load; it passed 3/3 in isolation and the suite passed in full on rerun.Regression tests
fmt_rejects_mixed_package_and_file_operands- mixed operands fail with the diagnostic and neither file is modified.fmt_rejects_multiple_package_directories- two package operands fail with the diagnostic and neither package is modified.fmt_accepts_single_package- single package still formats and passes--check.fmt_accepts_multiple_files- multiple.pudfiles still format and pass--check.Fixes #10