From 2cf500c2249fca25288756cd991391cac1f2f5a3 Mon Sep 17 00:00:00 2001 From: Tarek Date: Tue, 28 May 2024 14:41:31 +0300 Subject: [PATCH 1/3] fix: implement clippy suggestions Signed-off-by: Tarek --- fs-index/src/index.rs | 10 +++++----- fs-storage/src/file_storage.rs | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/fs-index/src/index.rs b/fs-index/src/index.rs index 6aa21d43..a60287ea 100644 --- a/fs-index/src/index.rs +++ b/fs-index/src/index.rs @@ -106,7 +106,7 @@ impl ResourceIndex { match CanonicalPathBuf::canonicalize(&path) { Ok(path) => { log::trace!("[load] {} -> {}", id, path.display()); - index.insert_entry(path, IndexEntry { id, modified }); + index.insert_entry(path, IndexEntry { modified, id }); } Err(_) => { log::warn!("File {} not found", path.display()); @@ -638,7 +638,7 @@ where let id = Id::from_path(path)?; let modified = metadata.modified()?; - Ok(IndexEntry { id, modified }) + Ok(IndexEntry { modified, id }) } fn scan_entries( @@ -685,9 +685,9 @@ mod tests { use dev_hash::Crc32; use fs_atomic_versions::initialize; use std::fs::File; - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] use std::fs::Permissions; - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] use std::os::unix::fs::PermissionsExt; use std::path::PathBuf; @@ -952,7 +952,7 @@ mod tests { assert_eq!(actual.collisions.len(), 0); assert_eq!(actual.size(), 2); - #[cfg(target_os = "linux")] + #[cfg(target_family = "unix")] file.set_permissions(Permissions::from_mode(0o222)) .expect("Should be fine"); diff --git a/fs-storage/src/file_storage.rs b/fs-storage/src/file_storage.rs index 7c652064..f9bbbe62 100644 --- a/fs-storage/src/file_storage.rs +++ b/fs-storage/src/file_storage.rs @@ -289,7 +289,7 @@ mod tests { if let Err(err) = file_storage.erase() { panic!("Failed to delete file: {:?}", err); } - assert_eq!(storage_path.exists(), false); + assert!(!storage_path.exists()); } #[test] From 4d11525ed74ad526d2ccbcd35d8b62e8696bc23a Mon Sep 17 00:00:00 2001 From: Tarek Date: Tue, 28 May 2024 14:42:00 +0300 Subject: [PATCH 2/3] fix(ci): update cargo clippy command Signed-off-by: Tarek --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6396f326..cddbfab4 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: - name: Format run: | cargo fmt --all -- --check - cargo clippy + cargo clippy --workspace --bins -- -D warnings - name: Build Debug run: cargo build --verbose From ec6017e0081858732e70dba90bbc80a490671237 Mon Sep 17 00:00:00 2001 From: Tarek Date: Tue, 28 May 2024 14:42:21 +0300 Subject: [PATCH 3/3] docs: add CONTRIBUTING.md file Signed-off-by: Tarek --- CONTRIBUTING.md | 57 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 57 insertions(+) create mode 100644 CONTRIBUTING.md diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md new file mode 100644 index 00000000..d46adc5b --- /dev/null +++ b/CONTRIBUTING.md @@ -0,0 +1,57 @@ +You made it here! This is a great step in helping to contribute to ARK 🎈 + +## How to contribute + +To get started, you can start off here [issues](https://github.com/ARK-Builders/ark-rust/issues) with those tagged [`good first issue`](https://github.com/ARK-Builders/ark-rust/issues?q=is:issue+is:open+label:%22good+first+issue%22). + +You can find fresh builds as artifacts of [GitHub Actions workflows](https://github.com/ARK-Builders/ark-rust/actions): + +- The "Verify build" workflow runs tests on supported platforms +- Benchmarks are run on every PR. It uses [`criterion`](https://github.com/bheisler/criterion.rs) to measure performance of the code compared to current main branch + +## Forking the project + +Before we can add you as a contributor to our project, we suggest to do initial work from your own fork of the project. + +To create a fork, please press `fork` button on the project page: +![fork](https://github.com/ARK-Builders/ark-rust/assets/60650661/fb950e9c-3bff-4850-9fa9-188dc59fdc15) + +Then you can modify everything without fear of breaking official version. + +## Submitting a Pull Request + +After you've implemented a feature or fixed a bug, it is time to open Pull Request. +![pr](https://github.com/ARK-Builders/ark-rust/assets/60650661/ae6b0070-2d19-4c10-b09f-5f2b64e81c12) + +Please enable GitHub Actions in your fork, so our QA will be able to download build of your version without manually compiling from source code. +![actions](https://github.com/ARK-Builders/ark-rust/assets/60650661/1ae7d5d3-30a4-4e19-8271-8a30ce1d4d99) + +### Automated code style checks + +The projects uses `rustfmt` and `clippy` to enforce code style and best practices. You can run them locally with: + +```bash +cargo fmt --all +cargo clippy --workspace --bins -- -D warnings +``` + +### Code review + +We care a lot about our software quality, that's why we are conducting strict code reviews before merging: + +- we will ask questions if we are not sure about particular technical decision +- when possible, we will suggest alternative solution +- GitHub Actions workflow must result in success (be green) +- comments must be resolved before merge +- code style should be green as well + +Right now, the team isn't that big, so please be patient 🙂 + +### Merge conflicts + +If Pull Request is long time in reviewing phase, `main` branch might go forward too far. +Please, fix all merge conflicts in this case 🛠 + +## Additional read + +https://docs.github.com/en/get-started/quickstart/github-flow