Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add rustfmt to CI to unify code formatting #630

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:
toolchain: ${{ matrix.rust }}
components: clippy
cache: true
- if: matrix.rust == 'stable'
run: cargo fmt -- --check

# test project with default + extra features
- if: matrix.rust == 'stable' || matrix.rust == 'beta'
run: cargo test --features image,ndarray,sop-class,rle,cli,jpegxl
Expand Down
2 changes: 2 additions & 0 deletions .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
newline_style = "Unix"
max_width = 100
6 changes: 6 additions & 0 deletions .rustfmt_nightly.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
newline_style = "Unix"
max_width = 100

# Enable only with nightly channel via - cargo +nightly fmt
imports_granularity = "Crate"
group_imports = "StdExternalCrate"
11 changes: 11 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
check:
cargo fmt -- --check
cargo clippy

fix:
cargo fmt
cargo clippy --fix --allow-dirty --allow-staged

fix_nightly:
cargo +nightly fmt -- --config-path .rustfmt_nightly.toml
#cargo +nightly clippy --fix --allow-dirty --allow-staged # To enable, after running format on nightly
Loading