Skip to content

Conversation

@xdustinface
Copy link
Collaborator

This PR adds https://pre-commit.com to the project which is a framework that runs automated checks on your code before you commit or push to help catching issues before they hit the CI. The same checks will also run in the CI via the integrated pre-commit github workflow.

This should be reviewed commit by commit since its pretty big PR mainly because of c422499 which fixes 2000 lines of trailing whitespaces. The first commit introduces all the infrastructure, the second cleans up all the github workflow steps which are now consolidated in the pre-commit config and the other commits just fix up one pre-commit stage per commit to get all of them to pass.

With pre commit hooks installed

See https://github.com/dashpay/rust-dashcore/blob/3543d2386f1385d1cf62d1fcf9863c94553f1356/CONTRIBUTING.md#pre-commit-hooks

When commiting:

  • The code gets formatted (cargo fmt, line endings fixed)
  • Typos get corrected
  • Basic file checks run (yaml syntax, trailing whitespace, etc.)
  • Takes a few seconds

When pushing:

  • Clippy runs on the whole workspace
  • FFI headers and docs get verified (regenerated and checked for drift)
  • Takes probably up to 60 seconds depending on what changed but generally it should not be too slow.

If something fails, the commit/push is blocked and you'll see what needs fixing while most things get auto generated via the check run.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Nov 20, 2025

Important

Review skipped

More than 25% of the files skipped due to max files limit. The review is being skipped to prevent a low-quality review.

130 files out of 237 files are above the max files limit of 100. Please upgrade to Pro plan to get higher limits.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch ci/pre-commit

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@QuantumExplorer QuantumExplorer merged commit 7352740 into v0.41-dev Dec 1, 2025
24 checks passed
@QuantumExplorer QuantumExplorer deleted the ci/pre-commit branch December 1, 2025 07:59
pauldelucia pushed a commit that referenced this pull request Dec 3, 2025
* Add pre-commit infrastructure

* Remove all steps in `rust.yml` which are now covered by `pre-commit`

* Fix `trailing-whitespace` checks

* Fix `end-of-file-fixer` checks

* Fix `check-executables-have-shebangs` checks

* Fix `check-shebang-scripts-are-executable` checks

* Fix actionlint

* Fix `typos` checks

* Fix `clippy-workspace` checks

* Fix `verify-ffi-docs`

* Revert intentional typo fix for testing

* Remove the redundant format/linting section in `CONTRIBUTING.md`

* Change `id` from `clippy-workspace` to `clippy`

* Fix `verify FFI` stage
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 26, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Properly keep track of all create wallets and wallet infos and clean them up at the end.
- Head allocate wallet infos like it would happen in real FFI usage and
  free them properly at the end.
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 26, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Modified `set_error`, `set_success`, and `ffi_error_set` macro to
  free previous error messages before setting new ones
- Added `FFIError::free_message` helper for test cleanup
- Added cleanup in all relevalt tests
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 26, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Properly keep track of all create wallets and wallet infos and clean them up at the end.
- Head allocate wallet infos like it would happen in real FFI usage and
  free them properly at the end.
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 26, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Modified `set_error`, `set_success`, and `ffi_error_set` macro to
  free previous error messages before setting new ones
- Added `FFIError::free_message` helper for test cleanup
- Added cleanup in all relevalt tests
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 27, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Properly keep track of all create wallets and wallet infos and clean them up at the end.
- Head allocate wallet infos like it would happen in real FFI usage and
  free them properly at the end.
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 27, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Modified `set_error`, `set_success`, and `ffi_error_set` macro to
  free previous error messages before setting new ones
- Added `FFIError::free_message` helper for test cleanup
- Added cleanup in all relevalt tests
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 27, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Properly keep track of all create wallets and wallet infos and clean them up at the end.
- Head allocate wallet infos like it would happen in real FFI usage and
  free them properly at the end.
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 27, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Modified `set_error`, `set_success`, and `ffi_error_set` macro to
  free previous error messages before setting new ones
- Added `FFIError::free_message` helper for test cleanup
- Added cleanup in all relevalt tests
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 27, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Properly keep track of all create wallets and wallet infos and clean them up at the end.
- Head allocate wallet infos like it would happen in real FFI usage and
  free them properly at the end.
xdustinface added a commit to xdustinface/rust-dashcore that referenced this pull request Dec 27, 2025
This fixes a bunch of memory leaks in tests detected by sanitizer
in CI overhaul PR dashpay#201.

- Modified `set_error`, `set_success`, and `ffi_error_set` macro to
  free previous error messages before setting new ones
- Added `FFIError::free_message` helper for test cleanup
- Added cleanup in all relevalt tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants