# Contributing to bare-script
Thank you for your interest in contributing to bare-script! This document outlines the guidelines for contributing to this project.
## Code of Conduct
By participating in this project, you agree to follow our [Code of Conduct](CODE_OF_CONDUCT.md).
## Getting Started
### Prerequisites
- Rust 1.85.0 or later
- Cargo
### Development Setup
1. Fork the repository
2. Clone your fork: `git clone https://github.com/YOUR_USERNAME/bare-script.git`
3. Add the upstream remote: `git remote add upstream https://github.com/bare-rs/bare-script.git`
4. Create a feature branch: `git checkout -b feature/your-feature-name`
## Coding Standards
This project follows strict safety and quality standards:
### Zero Panic Policy
- **Never** use `.unwrap()`, `.expect()`, `panic!()`, `todo!()`, or `unimplemented!()`
- Use `.get()` or iterators for array access
- Always return `Result` for fallible operations
### Type Safety
- Use Newtype pattern: `struct UserId(u64)` instead of raw primitives
- Use exhaustive matching: handle every enum variant explicitly
- Avoid unsafe code unless explicitly authorized
### Clippy Compliance
All code must pass Clippy with strict settings:
```bash
cargo clippy --all-targets -- -D warnings
```
### Documentation
- All public APIs must have docstrings
- Include `# Errors` and `# Examples` sections for complex functions
- Use descriptive, non-abbreviated names
## Testing Requirements
### Running Tests
```bash
# Run all tests
cargo test
# Run with coverage
cargo test --all-features
# Run clippy
cargo clippy --all-targets -- -D warnings
```
### Test Categories
1. **Unit Tests**: Located in source files with `#[cfg(test)]` module
2. **Integration Tests**: Located in `tests/` directory
3. **Doc Tests**: Inline examples in documentation
### Adding Tests
- New features must include tests
- Bug fixes must include regression tests
- Edge cases should be documented in `tests/edge_case_test.rs`
## Pull Request Process
### Before Submitting
1. **Run the full test suite:**
```bash
cargo test
cargo clippy --all-targets -- -D warnings
cargo fmt --check
```
2. **Update documentation** if your changes affect the public API
3. **Add changelog entry** if your changes are user-facing
### PR Description
Include the following in your PR description:
- **Summary**: Brief description of changes
- **Motivation**: Why this change is needed
- **Changes**: Detailed list of modifications
- **Testing**: How you tested the changes
### Review Process
1. All PRs require review before merging
2. Address review feedback promptly
3. Keep changes focused and atomic
## Feature Flags
This project uses Cargo feature flags:
- `tokio-rt`: Enable async API (default)
- `logging`: Enable logging support
- `tokio-full`: Enable full tokio features
## Security Considerations
- Never log sensitive information (passwords, tokens, keys)
- Validate all external input
- Use type-safe abstractions over raw strings
## License
By contributing to bare-script, you agree that your contributions will be licensed under the MIT OR Apache-2.0 license.