Skip to content

Commit

Permalink
chore: Add rustfmt check for rust files before git commit (farcasterx…
Browse files Browse the repository at this point in the history
…yz#1831)

## Motivation

Ensure consistent formatting of rust files. 

## Change Summary

Run `yarn lint:rust` to format all the rust files

## Merge Checklist

_Choose all relevant options below by adding an `x` now or at any time
before submitting for review_

- [X] PR title adheres to the [conventional
commits](https://www.conventionalcommits.org/en/v1.0.0/) standard
- [X] PR has a
[changeset](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#35-adding-changesets)
- [X] PR has been tagged with a change label(s) (i.e. documentation,
feature, bugfix, or chore)
- [X] PR includes
[documentation](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#32-writing-docs)
if necessary.
- [X] All [commits have been
signed](https://github.com/farcasterxyz/hub-monorepo/blob/main/CONTRIBUTING.md#22-signing-commits)

<!-- start pr-codex -->

---

## PR-Codex overview
This PR adds a Rust code formatter check before Git commit, updates
linting scripts, and refactors code in the `LinkStore` module.

### Detailed summary
- Added Rustfmt check before Git commit
- Updated linting scripts in `package.json`
- Refactored code in the `LinkStore` module

> The following files were skipped due to too many changes:
`apps/hubble/src/addon/src/store/link_store.rs`

> ✨ Ask PR-Codex anything about this PR by commenting with `/codex {your
question}`

<!-- end pr-codex -->
  • Loading branch information
adityapk00 authored Mar 20, 2024
1 parent 0b52328 commit d2b2f72
Show file tree
Hide file tree
Showing 8 changed files with 154 additions and 106 deletions.
5 changes: 5 additions & 0 deletions .changeset/shaggy-bags-film.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@farcaster/hubble": patch
---

chore: Add rustfmt check before git commit
2 changes: 2 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -261,6 +261,8 @@ Called Signer.verify with the correct parameter to ensure that older signature
types would not pass verification in our Signer Sets
```

Make sure that all your files are formatted correctly. We use `biome` to format TypeScript files and `rustfmt` for the Rust files. To auto-format all the files run `yarn lint` to format all source files.

### 3.5. Adding Changesets

All PRs with meaningful changes should have a [changeset](https://github.com/changesets/changesets) which is a short
Expand Down
2 changes: 1 addition & 1 deletion apps/hubble/biome.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"indentSize": 2,
"indentStyle": "space",
"lineWidth": 120,
"ignore": ["src/abstract-leveldown.d.ts", "src/rocksdb.d.ts"]
"ignore": ["src/abstract-leveldown.d.ts", "src/rocksdb.d.ts", "src/addon/*"]
},
"linter": {
"enabled": true,
Expand Down
5 changes: 3 additions & 2 deletions apps/hubble/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,9 @@
"build": "yarn build:all",
"clean": "rimraf ./build && cargo clean --manifest-path ./src/addon/Cargo.toml",
"dev": "yarn start | yarn pino-pretty",
"lint": "yarn lint:customjs && biome format src/ --write && biome check src/ --apply",
"lint:rust": "cargo fmt --manifest-path ./src/addon/Cargo.toml",
"lint": "yarn lint:ts && yarn lint:rust",
"lint:ts": "yarn lint:customjs && biome format src/ --write && biome check src/ --apply",
"lint:rust": "cargo fmt --manifest-path ./src/addon/Cargo.toml && cargo fmt --manifest-path ./src/addon/Cargo.toml --check",
"lint:ci": "yarn lint:customjs && biome ci src/",
"lint:customjs": "node scripts/linter.cjs",
"start": "node --max-old-space-size=8192 --no-warnings build/cli.js start",
Expand Down
Loading

0 comments on commit d2b2f72

Please sign in to comment.