Contributing
How to Contribute to Vector SDK
Thank you for considering contributing to Vector SDK! This document provides guidelines for contributing to the project.
Table of Contents
Code of Conduct
Please note that this project is released with a Contributor Code of Conduct. By contributing to this project, you agree to abide by its terms.
Getting Started
Fork the Vector repository on GitHub.
Clone your fork locally:
Add the upstream remote to keep your fork in sync:
Development Setup
Prerequisites
Rust (latest stable version)
Cargo (Rust package manager)
Git
Optional: Rustfmt and Clippy for code formatting and linting
Building the Project
Running Tests
Coding Standards
Rust Style Guide
Follow the Rust API Guidelines
Use
snake_casefor variables and functionsUse
PascalCasefor types and enumsUse
UPPER_CASEfor constantsKeep lines under 100 characters when possible
Use 4 spaces for indentation (Rust's default)
Documentation
Document all public items with Rustdoc comments, following this format:
Error Handling
Bot-facing errors flow through
vector_sdk::Error/vector_sdk::Result, re-exported directly fromvector-coreProvide clear, actionable error messages
Implement proper error conversion with the
Fromtrait where it makes the calling code cleaner
Logging
Use the log crate for logging, following these log levels:
error
Critical errors that need attention
warn
Potential issues or deprecated features
info
Important operational messages
debug
Detailed debugging information
trace
Very detailed tracing information
Testing
Test Organization
Unit tests: In the same file as the implementation, in a
#[cfg(test)]module. The SDK's owninvite_policy_matrixandchannel_kind_auto_detectiontests inlib.rsare good reference examples.Integration tests: In the
tests/directory.Example bots: In
examples/, runnable end-to-end as living documentation rather than as automated tests.
Writing Tests
Aim for high test coverage on new logic, and make sure to test edge cases, error conditions, and async code (with #[tokio::test]) rather than only the happy path.
Pull Requests
Creating a Pull Request
Create a feature branch from
master:
Make your changes following the coding standards above.
Commit your changes with clear, descriptive messages:
Push to your fork:
Open a Pull Request on GitHub with:
A clear title describing the change
A detailed description of what was changed and why
Related issues, if any
Screenshots or examples, if applicable
Pull Request Requirements
All of the following must be true before a pull request will be merged:
All tests pass
Code is properly formatted (
cargo fmt)Code passes linting (
cargo clippy)Documentation is updated
Changes follow the coding standards above
Documentation
Updating Documentation
Update
README.mdfor major changesUpdate
CHANGELOG.mdfor new features and fixesAdd or update Rustdoc comments for code changes
Update any relevant GitBook pages, including this one, when developer-facing behavior changes
Generating Documentation
To generate and view the API documentation locally:
Releases
Versioning
This project follows Semantic Versioning:
MAJOR version when making breaking changes
MINOR version when adding functionality in a backwards-compatible manner
PATCH version when making backwards-compatible bug fixes
Release Process
Update
CHANGELOG.mdwith release notes.Update the version in
crates/vector-sdk/Cargo.toml.Create a git tag:
Publish to crates.io:
Security
Reporting Security Issues
If you discover a security vulnerability, please do not open a public issue.
Instead:
Email the maintainers directly at
security@vectorapp.ioInclude as much detail as possible
See the Security page for the full policy and best practices.
Questions (Support)
If you have any questions about contributing, please open an issue on GitHub, contact the maintainers, or ask in the Vector Community on Vector or Discord.
Last updated