Thank you for your interest in contributing to Spinner! We welcome contributions from the community and are grateful for your support.
- Code of Conduct
- How Can I Contribute?
- Development Setup
- Pull Request Process
- Coding Standards
- Testing Guidelines
- Documentation
- Community
This project adheres to a code of conduct that all contributors are expected to follow. Please be respectful and constructive in all interactions.
- Be Respectful: Treat everyone with respect and kindness
- Be Constructive: Provide helpful feedback and suggestions
- Be Collaborative: Work together to make Spinner better
- Be Patient: Remember that everyone has different levels of experience
Before creating bug reports, please check existing issues to avoid duplicates. When creating a bug report, include as many details as possible:
- Use the bug report template
- Use a clear and descriptive title
- Provide step-by-step reproduction steps
- Include code samples
- Describe the expected vs actual behavior
- Include environment details (.NET version, OS, etc.)
Feature suggestions are welcome! Please:
- Use the feature request template
- Clearly describe the problem it solves
- Provide examples of how it would be used
- Consider potential drawbacks or alternatives
Documentation improvements are always appreciated:
- Fix typos or unclear wording
- Add examples or clarifications
- Update outdated information
- Translate documentation (if applicable)
- Find an Issue: Look for issues labeled
good first issueorhelp wanted - Discuss First: For major changes, open an issue to discuss your approach
- Fork & Create Branch: Create a feature branch from
main - Write Code: Follow our coding standards
- Add Tests: Ensure your changes are tested
- Update Docs: Update documentation if needed
- Submit PR: Create a pull request using our template
- .NET SDK 6.0 or higher
- Git
- Your favorite IDE (Visual Studio, Rider, VS Code)
-
Fork the repository
Click the "Fork" button on GitHub
-
Clone your fork
git clone https://github.com/YOUR-USERNAME/Spinner.git cd Spinner -
Add upstream remote
git remote add upstream https://github.com/Daniel-iel/Spinner.git
-
Create a branch
git checkout -b feature/your-feature-name
-
Build the project
cd src dotnet build -
Run tests
cd Spinner.Test dotnet test
For performance-critical changes:
cd bench/Spinner.Benchmark
dotnet run -c Releasecd src/Spinner.Test
dotnet stryker- Create an issue to discuss major changes
- Fork the repository and create a feature branch
- Follow the coding standards
- Write or update tests
- Update documentation
- Run all tests locally
- Run benchmarks (for performance changes)
- Ensure no new warnings or errors
Use Conventional Commits format:
<type>: <description>
Types:
- feat: New feature
- fix: Bug fix
- docs: Documentation changes
- perf: Performance improvement
- test: Adding or updating tests
- refactor: Code refactoring
- style: Code style changes (formatting, etc.)
- chore: Build process or tooling changes
Examples:
feat: Add support for custom date formats
fix: Resolve null reference in ReadFromSpan
docs: Update migration guide with examples
perf: Optimize StringBuilder allocation
test: Add unit tests for padding scenarios
Use the provided template and include:
- Clear description of changes
- Type of change (bug fix, feature, etc.)
- Related issues (use "Fixes #123")
- Testing performed
- Checklist completion
- Screenshots (if UI changes)
- Automated Checks: CI/CD will run tests and checks
- Code Review: Maintainers will review your code
- Feedback: Address any requested changes
- Approval: Once approved, your PR will be merged
- Cleanup: Delete your feature branch after merge
-
Naming Conventions:
- PascalCase for public members, classes, methods
- camelCase for private fields, parameters
- Use
_prefix for private fields:_myField
-
Code Organization:
- One class per file
- Organize using statements
- Group members by type (fields, properties, methods)
-
Performance:
- Avoid unnecessary allocations
- Use
Span<T>andReadOnlySpan<T>where appropriate - Consider ThreadStatic for per-thread resources
- Profile performance-critical code
-
Thread Safety:
- Ensure code is thread-safe where applicable
- Document thread-safety guarantees
- Use appropriate synchronization primitives
- SOLID Principles: Follow SOLID design principles
- DRY: Don't Repeat Yourself
- KISS: Keep It Simple, Stupid
- Comments: Comment complex logic, not obvious code
- Error Handling: Use appropriate exception types
- Null Safety: Handle null appropriately
/// <summary>
/// Converts an object to a positional string.
/// </summary>
/// <param name="obj">Object to serialize.</param>
/// <returns>Positional string representation.</returns>
public string WriteAsString(T obj)
{
var sb = builder ??= new StringBuilder(ReadObjectMapper?.Length ?? 256);
sb.Clear();
WritePositionalString(ref sb, obj);
return ReadObjectMapper is not null
? sb.ToString(0, ReadObjectMapper.Length)
: sb.ToString();
}- Unit Tests: All new code must have unit tests
- Coverage: Aim for high code coverage (>80%)
- Mutation Testing: Ensure tests catch mutations
- Edge Cases: Test boundary conditions and edge cases
- Error Cases: Test error handling paths
Use the Arrange-Act-Assert pattern:
[Fact]
public void WriteAsString_ShouldPadLeft_WhenValueIsShorterThanLength()
{
// Arrange
var obj = new TestClass { Code = "123" };
var spinner = new Spinner<TestClass>();
// Act
var result = spinner.WriteAsString(obj);
// Assert
Assert.Equal("0000000123", result);
}MethodName_Should_ExpectedBehavior_When_Condition
Examples:
ReadFromString_Should_ThrowException_When_PropertyNotMappedWriteAsString_Should_TruncateValue_When_ExceedsLengthReadFromSpan_Should_ParseCorrectly_When_ValidInput
- Use XML documentation comments for public APIs
- Explain complex algorithms or logic
- Document thread-safety guarantees
- Include usage examples for complex features
Located in docs/docs/:
- Update relevant .md files when changing functionality
- Add examples for new features
- Update migration guide for breaking changes
- Keep performance benchmarks up to date
Update README.md if:
- Adding new major features
- Changing installation process
- Updating supported versions
- Adding new contributors
- Discussions: GitHub Discussions for questions
- Issues: GitHub Issues for bugs and features
- Documentation: Official Docs for guides
- Watch the repository for updates
- Check the changelog for release notes
- Follow discussions for feature proposals
Contributors are recognized in:
- README.md Contributors section
- Release notes
- GitHub contributors page
If you have questions about contributing, feel free to:
- Open a discussion on GitHub
- Comment on an existing issue
- Reach out to maintainers
Thank you for contributing to Spinner! Your efforts help make this project better for everyone. 🎉