Skip to content

Commit bcc5680

Browse files
authored
Create CONTRIBUTING.md
1 parent f2ad23d commit bcc5680

File tree

1 file changed

+187
-0
lines changed

1 file changed

+187
-0
lines changed

CONTRIBUTING.md

+187
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,187 @@
1+
# Contributing to Rust Modular Projects
2+
3+
Welcome to the Rust Modular Projects! We're excited that you're interested in contributing. Before you get started, please take a moment to read through this guide.
4+
5+
## Table of Contents
6+
- [Code of Conduct](#code-of-conduct)
7+
- [Getting Started](#getting-started)
8+
- [Pull Request Process](#pull-request-process)
9+
- [Testing Guidelines](#testing-guidelines)
10+
- [Security](#security)
11+
12+
## Code of Conduct
13+
14+
This project adheres to the Rust Code of Conduct. By participating, you are expected to uphold this code. Please report unacceptable behavior to [[email protected]].
15+
16+
## Getting Started
17+
18+
1. **Fork the Repository**
19+
```bash
20+
git clone https://github.com/YOUR-USERNAME/rust-modular-projects.git
21+
cd rust-modular-projects
22+
git remote add upstream https://github.com/mdabir1203/rust-modular-projects.git
23+
```
24+
25+
2. **Set Up Development Environment**
26+
- Install Rust via rustup: https://rustup.rs/
27+
- Required dependencies:
28+
```bash
29+
rustup component add rustfmt
30+
rustup component add clippy
31+
cargo install cargo-audit
32+
```
33+
34+
3. **Create a Branch**
35+
```bash
36+
git checkout -b feature/your-feature-name
37+
```
38+
39+
## Development Workflow
40+
41+
1. **Keep Your Fork Updated**
42+
```bash
43+
git fetch upstream
44+
git rebase upstream/main
45+
```
46+
47+
2. **Run Tests Locally**
48+
```bash
49+
cargo test
50+
cargo clippy
51+
cargo fmt --all -- --check
52+
```
53+
54+
3. **Commit Guidelines**
55+
- Use conventional commits format:
56+
- feat: New feature
57+
- fix: Bug fix
58+
- docs: Documentation changes
59+
- style: Code style changes
60+
- refactor: Code refactoring
61+
- test: Test updates
62+
- chore: Maintenance tasks
63+
64+
Example:
65+
```
66+
feat(auth): implement JWT authentication
67+
68+
- Add JWT token generation
69+
- Implement token validation
70+
- Add unit tests for auth module
71+
```
72+
73+
## Pull Request Process
74+
75+
1. **Before Submitting**
76+
- Update documentation if needed
77+
- Add tests for new features
78+
- Ensure all tests pass
79+
- Update CHANGELOG.md if applicable
80+
81+
2. **PR Template**
82+
```markdown
83+
## Description
84+
[Describe your changes]
85+
86+
## Type of Change
87+
- [ ] Bug fix
88+
- [ ] New feature
89+
- [ ] Breaking change
90+
- [ ] Documentation update
91+
92+
## Testing
93+
- [ ] Tests added/updated
94+
- [ ] All tests passing
95+
96+
## Screenshots (if applicable)
97+
```
98+
99+
## Coding Standards
100+
101+
1. **Rust Style Guidelines**
102+
- Follow Rust API Guidelines: https://rust-lang.github.io/api-guidelines/
103+
- Use `rustfmt` for consistent formatting
104+
- Run `clippy` and address all warnings
105+
106+
107+
3. **Documentation**
108+
- All public items must have doc comments
109+
- Include examples in doc comments
110+
- Use proper Rust documentation syntax
111+
```rust
112+
/// Performs an operation.
113+
///
114+
/// # Examples
115+
///
116+
/// ```
117+
/// let result = my_function(42);
118+
/// assert_eq!(result, 84);
119+
/// ```
120+
pub fn my_function(input: i32) -> i32 {
121+
// Implementation
122+
}
123+
```
124+
125+
## Testing Guidelines
126+
127+
1. **Unit Tests**
128+
- Write tests for all public functions
129+
- Use descriptive test names
130+
- Follow arrange-act-assert pattern
131+
132+
```rust
133+
#[cfg(test)]
134+
mod tests {
135+
use super::*;
136+
137+
#[test]
138+
fn test_function_expected_behavior() {
139+
// Arrange
140+
let input = 42;
141+
142+
// Act
143+
let result = my_function(input);
144+
145+
// Assert
146+
assert_eq!(result, expected_value);
147+
}
148+
}
149+
```
150+
151+
2. **Integration Tests**
152+
- Place in `tests/` directory
153+
- Test module interactions
154+
- Include error cases
155+
156+
## Documentation
157+
158+
1. **API Documentation**
159+
- Use `cargo doc` to generate documentation
160+
- Include examples
161+
- Document error conditions
162+
- Add links to related items
163+
164+
2. **README Updates**
165+
- Keep installation instructions current
166+
- Update feature list
167+
- Maintain troubleshooting section
168+
169+
## Security
170+
171+
1. **Reporting Security Issues**
172+
- Email security concerns to [[email protected]]
173+
- Do not create public issues for security vulnerabilities
174+
175+
2. **Security Best Practices**
176+
- Use `cargo audit` regularly
177+
- Keep dependencies updated
178+
- Follow Rust security guidelines
179+
- Avoid unsafe code unless absolutely necessary
180+
181+
## Support
182+
183+
Need help? You can:
184+
- Open an issue
185+
- Email the maintainers
186+
187+
Thank you for contributing to Rust Modular Projects! 🦀

0 commit comments

Comments
 (0)