Skip to content

Commit

Permalink
Move rustfmt and clippy into Makefile targets
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesbornholt committed Sep 9, 2022
1 parent 44c1223 commit 7f31af8
Show file tree
Hide file tree
Showing 7 changed files with 54 additions and 28 deletions.
12 changes: 3 additions & 9 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,14 +56,8 @@ jobs:
uses: actions/checkout@v3
- name: Install rustfmt
run: rustup component add rustfmt
- name: Check aws-crt-s3-sys
run: cargo fmt --manifest-path aws-crt-s3-sys/Cargo.toml -- --check
- name: Check aws-crt-s3
run: cargo fmt --manifest-path aws-crt-s3/Cargo.toml -- --check
- name: Check s3-client
run: cargo fmt --manifest-path s3-client/Cargo.toml -- --check
- name: Check s3-file-connector
run: cargo fmt --manifest-path s3-file-connector/Cargo.toml -- --check
- name: Check format
run: make fmt-check

clippy:
name: Clippy
Expand All @@ -77,4 +71,4 @@ jobs:
- name: Install fuse
run: sudo apt-get install fuse libfuse2 libfuse-dev
- name: Run Clippy
run: cargo clippy -p aws-crt-s3 -p s3-client -p aws-s3-fuse --no-deps --all-targets -- -D clippy::all
run: make clippy
30 changes: 15 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 32 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Most of these targets just exist so we can avoid running clippy and rustfmt on the vendored
# fuser crate. If those tools ever get stabilized `ignore` features, or we stop vendoring, this can
# go away.

CRATES = aws-crt-s3-sys aws-crt-s3 s3-client s3-file-connector

.PHONY: all
all:
cargo build --all-targets

.PHONY: release
release:
cargo build --release --all-targets

.PHONY: fmt
fmt:
@for crate in $(CRATES); do \
cargo fmt --manifest-path $$crate/Cargo.toml; \
done

.PHONY: fmt-check
fmt-check:
@fail=0; \
for crate in $(CRATES); do \
cargo fmt --manifest-path $$crate/Cargo.toml -- --check || fail=1; \
done; \
exit $$fail

.PHONY: clippy
clippy:
packages=`echo "$(CRATES)" | sed -E 's/(^| )/ -p /g'`; \
cargo clippy $$packages --no-deps --all-targets -- -D clippy::all
3 changes: 2 additions & 1 deletion aws-crt-s3-sys/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@
non_snake_case,
unused,
rustdoc::broken_intra_doc_links,
rustdoc::bare_urls
rustdoc::bare_urls,
clippy::all
)]
mod generated {
include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
Expand Down
1 change: 0 additions & 1 deletion rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
max_width = 120
ignore = ["vendor/"]
2 changes: 1 addition & 1 deletion s3-file-connector/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "aws-s3-fuse"
name = "s3-file-connector"
version = "0.1.0"
edition = "2021"
publish = false
Expand Down
2 changes: 1 addition & 1 deletion s3-file-connector/tests/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use aws_s3_fuse::fs::S3Filesystem;
use fuser::{BackgroundSession, MountOption, Session};
use s3_client::{S3Client, S3ClientConfig};
use s3_file_connector::fs::S3Filesystem;
use tempfile::TempDir;

pub fn make_test_session() -> (TempDir, BackgroundSession) {
Expand Down

0 comments on commit 7f31af8

Please sign in to comment.