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

Update Clippy command and Fix Clippy warnings #66

Merged
merged 3 commits into from
May 29, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
57 changes: 57 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -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
10 changes: 5 additions & 5 deletions fs-index/src/index.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ impl<Id: ResourceId> ResourceIndex<Id> {
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());
Expand Down Expand Up @@ -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<Id>(
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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");

Expand Down
2 changes: 1 addition & 1 deletion fs-storage/src/file_storage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down
Loading