You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Feature Request] Add --check option to mojo format #1249
In mojo 0.6 mojo format returns a non-zero exit code when some files could not be reformatted. I think this is a change from 0.5 but did not see it in the 0.6 release notes. However this seems sufficient for CI/CD like purposes, it would be fine to close this issue.
I just revisited this, and it appears that occurrence of formatting changes cannot be detected without additional shell scripting/workarounds. For example, this reformatted 1 file, but returned a zero exit code (success). So I think a --check option would be helpful.
$ mojo format .
reformatted geo_features/test/geom/test_line_string.mojo
All done! ✨ 🍰 ✨
1 file reformatted, 41 files left unchanged.
$ echo$?
0
mojo format now returns a non-zero exit code when files can't be reformatted, as @guidoricenoted. However, @guidorice also found it returns zero when files are reformatted (just different, not broken) — so a dedicated --check flag for CI (detect any changes) may still be useful. Closing the original request as the exit-code behavior covers the core ask, but if the "detect any formatting changes" use case matters to you, please open a new issue. Thanks!
Activity
guidorice commentedon Dec 5, 2023
In mojo 0.6
mojo formatreturns a non-zero exit code when some files could not be reformatted. I think this is a change from 0.5 but did not see it in the 0.6 release notes. However this seems sufficient for CI/CD like purposes, it would be fine to close this issue.guidorice commentedon Dec 16, 2023
I just revisited this, and it appears that occurrence of formatting changes cannot be detected without additional shell scripting/workarounds. For example, this reformatted 1 file, but returned a zero exit code (success). So I think a
--checkoption would be helpful.conorbronsdon commentedon Mar 28, 2026
mojo formatnow returns a non-zero exit code when files can't be reformatted, as @guidorice noted. However, @guidorice also found it returns zero when files are reformatted (just different, not broken) — so a dedicated--checkflag for CI (detect any changes) may still be useful. Closing the original request as the exit-code behavior covers the core ask, but if the "detect any formatting changes" use case matters to you, please open a new issue. Thanks!