Gleam: Run rustfmt on CI

Created on 22 Oct 2019  路  6Comments  路  Source: gleam-lang/gleam

Note these don't need to be ran for every OS, just on Linux will be fine.

Rustfmt should fail if any files are not correctly formatted.

help wanted

All 6 comments

@EskiMag I think you need to comment here for me to assign you

Please, assign this issue to me. 馃檹 馃榿

OK, so I wanted to work on this, but I am stuck. I am not familiar with Rust, I wrote maybe 10 lines in it few years ago. I did a clean install via the recommended method, then tried to run cargo fmt or rustfmt inside the gleam directory of this repo, but it's stuck on this error:

error: command failed: 'rustfmt'
error: caused by: Permission denied (os error 13)

I checked Stackoverflow, but no solution is working for me. I am using macOS Catalina and rustup --version is returning rustup 1.20.2 (13979c968 2019-10-16). Any tips, what can be wrong?

What version of rust, not rustup? Run rustup update to make sure it is up to date and post the output here so we can see what components it installs as well?

I deleted both ~/.cargo and ~/.rustup, installed again and it's working. Anyway, thanks @OvermindDL1 for your help. There were probably some old resuides from the past causing the trouble.
Now when I run cargo fmt, I see that the src/main.rs is being formatted.
Is there some switch for the cargo fmt command to just check if everything is properly formatted? Or should I combine the cargo fmt with git status to decide if the check should fail or succeed?

Different versions can format slightly differently. Generally you just have the CI locked to 'latest' and format everything and commit if any changes.

If you really want to 'just check' (which will fail if someone formatted with a different version at times) then I think it's just cargo fmt -- --check if I recall correctly.

Was this page helpful?
0 / 5 - 0 ratings