code-pull-requestContributing

How to Contribute to Vector SDK

Contributing 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 Conductarrow-up-right. By contributing to this project, you agree to abide by its terms.


Getting Started

  1. Fork the repository on GitHub

  2. Clone your fork locally:

  3. 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

  • Use snake_case for variables and functions

  • Use PascalCase for types and enums

  • Use UPPER_CASE for constants

  • Keep lines under 100 characters when possible

  • Use 4 spaces for indentation (Rust's default)

Documentation

  • Document all public items with Rustdoc comments

  • Follow the format:

Error Handling

  • Use the thiserror crate for defining error types

  • Provide clear, actionable error messages

  • Implement proper error conversion with From trait

Logging

  • Use the log crate for logging

  • Follow 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

  • Integration tests: In the tests/ directory

  • Example tests: In the separate examples repository

Writing Tests

Test Coverage

  • Aim for high test coverage (80%+)

  • Test edge cases and error conditions

  • Test async code properly with tokio::test


Pull Requests

Creating a Pull Request

  1. Create a feature branch from main:

  2. Make your changes following the coding standards

  3. Commit your changes with clear, descriptive messages:

  4. Push to your fork:

  5. Open a Pull Request on GitHub with:

    • Clear title describing the change

    • Detailed description of what was changed and why

    • Related issues (if any)

    • Screenshots or examples (if applicable)

Pull Request Requirements

  • All tests must pass

  • Code must be properly formatted (run cargo fmt)

  • Code must pass linting (run cargo clippy)

  • Documentation must be updated

  • Changes must follow the coding standards


Documentation

Updating Documentation

  • Update the README.md for major changes

  • Update CHANGELOG.md for new features and fixes

  • Add or update Rustdoc comments for code changes

  • Update any relevant documentation files

Generating Documentation

To generate and view the API documentation:


Releases

Versioning

This project follows Semantic Versioningarrow-up-right:

  • 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

  1. Update CHANGELOG.md with release notes

  2. Update version in Cargo.toml

  3. Create a git tag:

  4. Publish to crates.io:


Security

Reporting Security Issues

If you discover a security vulnerability, please:

  1. Do not open a public issue

  2. Email the maintainers directly at security@vectorapp.ioenvelope

  3. Include as much detail as possible

Security Best Practices

  • Always use secure random number generation

  • Validate all inputs

  • Use proper encryption for sensitive data

  • Follow the principle of least privilege

  • Keep dependencies updated


Questions

If you have any questions about contributing, please open an issue on GitHub or contact the maintainers. Additional help can be found in the Vector Community Discordarrow-up-right.

Last updated