Closed adamrothman closed 1 month ago
Thanks for opening this issue! That behavior does indeed sound annoying. Should be a quick fix -- I'll take a look now.
Fixed by #1220. This change will naturally be included in the next minor version (4.1.0). But let us know if you need it asap and we can release a patch version 4.0.1.
Before opening, please confirm:
Bug Category
Other
Describe the bug
Given a file containing the following policy (taken from the Cedar docs), with a trailing newline:
The
cedar format --check
command exits with a non-0 status:Expected behavior
The
format
command should not treat a policy file that ends with a newline as malformed or in need of formatting. It's very common for editors to automatically add a trailing newline to files on save, and quite a pain to try to disable this feature for only.cedar
files.When invoked with
--check
, policy files that end with a trailing newline should pass (i.e. exit status 0).When invoked with
--write
, the CLI should not remove trailing newlines from policy files where they are present.Reproduction steps
cedar-policy-cli
crate.test.cedar
, ensuring that a trailing newline is added.cedar format --check
.Code Snippet
No response
Log output
No response
Additional configuration
No response
Operating System
macOS Sonoma 14.7
Additional information and screenshots
No response