Contributing to TacoMapper
Welcome Contributors! 🌮
Section titled “Welcome Contributors! 🌮”We’re excited that you’re interested in contributing to TacoMapper! This guide will help you get started with contributing to the project, whether you’re fixing bugs, adding features, improving documentation, or helping with testing.
Ways to Contribute
Section titled “Ways to Contribute”🐛 Bug Reports
Section titled “🐛 Bug Reports”- Report bugs through GitHub Issues
- Include detailed reproduction steps
- Provide example code that demonstrates the issue
- Specify your environment (.NET version, OS, etc.)
✨ Feature Requests
Section titled “✨ Feature Requests”- Suggest new mapping capabilities
- Propose API improvements
- Request performance optimizations
- Share use cases that aren’t well supported
📝 Documentation
Section titled “📝 Documentation”- Improve existing documentation
- Add more examples and use cases
- Fix typos and clarify explanations
- Translate documentation (future)
🧪 Testing
Section titled “🧪 Testing”- Add unit tests for existing features
- Improve test coverage
- Add integration tests
- Performance benchmarking
💻 Code Contributions
Section titled “💻 Code Contributions”- Bug fixes
- New features
- Performance improvements
- Code quality enhancements
Development Setup
Section titled “Development Setup”Prerequisites
Section titled “Prerequisites”- .NET 8.0 SDK or later
- Git for version control
- Visual Studio 2022, JetBrains Rider, or VS Code with C# extension
- GitHub account for submitting pull requests
Getting Started
Section titled “Getting Started”-
Fork the Repository
Terminal window # Navigate to https://github.com/tavobarrientos/TacoMapper# Click the "Fork" button in the top right -
Clone Your Fork
Terminal window git clone https://github.com/YOUR_USERNAME/TacoMapper.gitcd TacoMapper -
Add Upstream Remote
Terminal window git remote add upstream https://github.com/tavobarrientos/TacoMapper.git -
Build the Project
Terminal window dotnet build -
Run Tests
Terminal window dotnet test -
Run the Example
Terminal window cd exampledotnet run
Project Structure
Section titled “Project Structure”TacoMapper/├── lib/ # Main library code│ ├── core/│ │ ├── IMapper.cs # Mapper interface│ │ ├── Mapper.cs # Mapper implementation│ │ └── ObjectMapper.cs # Static entry point│ └── TacoMapper.csproj # Library project file├── example/ # Example usage│ ├── Program.cs # Demo application│ ├── Models/│ │ └── Models.cs # Sample models│ └── TacoMapper.Example.csproj├── unit-tests/ # Unit tests│ ├── Mapper.Tests.cs # Main test file│ ├── TestModels.cs # Test models│ └── TacoMapper.Tests.csproj├── page/ # Documentation site│ └── src/content/docs/ # Documentation content├── .github/workflows/ # CI/CD workflows└── README.md # Project README
Coding Standards
Section titled “Coding Standards”C# Conventions
Section titled “C# Conventions”Follow Microsoft’s C# Coding Conventions:
// ✅ Good: PascalCase for public memberspublic class ObjectMapper{ public static IMapper<TSource, TDestination> Create<TSource, TDestination>() { // ✅ Good: camelCase for local variables var mapper = new Mapper<TSource, TDestination>(); return mapper; }}
// ✅ Good: Use meaningful namespublic IMapper<TSource, TDestination> Map<TProp>( Expression<Func<TDestination, TProp>> destinationProperty, Expression<Func<TSource, TProp>> sourceProperty)
// ❌ Bad: Generic or unclear namespublic IMapper<TSource, TDestination> Map<T>( Expression<Func<TDestination, T>> dest, Expression<Func<TSource, T>> src)
Documentation Standards
Section titled “Documentation Standards”XML Documentation for Public APIs:
/// <summary>/// Maps a source property to a destination property with a custom transformation/// </summary>/// <typeparam name="TSrcProp">Source property type</typeparam>/// <typeparam name="TDestProp">Destination property type</typeparam>/// <param name="destinationProperty">Expression selecting the destination property</param>/// <param name="sourceProperty">Expression selecting the source property</param>/// <param name="transform">Function to transform the source value</param>/// <returns>The mapper instance for method chaining</returns>public IMapper<TSource, TDestination> Map<TSrcProp, TDestProp>( Expression<Func<TDestination, TDestProp>> destinationProperty, Expression<Func<TSource, TSrcProp>> sourceProperty, Func<TSrcProp, TDestProp> transform)
Performance Guidelines
Section titled “Performance Guidelines”- Avoid Boxing/Unboxing - Use generics appropriately
- Minimize Allocations - Reuse objects where possible
- Cache Compiled Expressions - Store compiled delegates
- Lazy Initialization - Initialize expensive resources only when needed
// ✅ Good: Lazy compilationprivate readonly Lazy<Func<TSource, TDestination>> _compiledMapper;
// ✅ Good: Minimal allocationspublic List<TDestination> MapFrom(IEnumerable<TSource> sources){ var result = new List<TDestination>(); foreach (var source in sources) { result.Add(MapFrom(source)); } return result;}
Testing Guidelines
Section titled “Testing Guidelines”Unit Test Structure
Section titled “Unit Test Structure”Use AAA Pattern (Arrange, Act, Assert):
[Test]public void Map_WithCustomTransformation_TransformsValueCorrectly(){ // Arrange var person = new Person { DateOfBirth = new DateTime(1990, 1, 1) };
var mapper = ObjectMapper.Create<Person, PersonDto>() .Map(dest => dest.Age, src => src.DateOfBirth, dob => DateTime.Now.Year - dob.Year);
// Act var result = mapper.MapFrom(person);
// Assert Assert.That(result.Age, Is.EqualTo(DateTime.Now.Year - 1990));}
Test Coverage Requirements
Section titled “Test Coverage Requirements”- New Features: Minimum 90% code coverage
- Bug Fixes: Include regression tests
- Edge Cases: Test null values, empty collections, edge conditions
- Performance: Include benchmarks for performance-critical code
Test Categories
Section titled “Test Categories”[Test][Category("Unit")]public void BasicMapping_Works() { /* ... */ }
[Test][Category("Integration")]public void ComplexScenario_Works() { /* ... */ }
[Test][Category("Performance")]public void LargeCollection_PerformsWell() { /* ... */ }
Submission Process
Section titled “Submission Process”1. Create a Feature Branch
Section titled “1. Create a Feature Branch”# Stay up to dategit checkout maingit pull upstream main
# Create feature branchgit checkout -b feature/your-feature-name# orgit checkout -b fix/issue-number-description
2. Make Your Changes
Section titled “2. Make Your Changes”- Write code following the coding standards
- Add comprehensive tests
- Update documentation if needed
- Run tests locally
# Build and testdotnet builddotnet test
# Check formatting (if using EditorConfig)dotnet format --verify-no-changes
3. Commit Your Changes
Section titled “3. Commit Your Changes”Use Conventional Commits:
# Feature commitsgit commit -m "feat: add conditional mapping with custom predicates"
# Bug fix commitsgit commit -m "fix: resolve null reference exception in collection mapping"
# Documentation commitsgit commit -m "docs: add advanced mapping examples"
# Test commitsgit commit -m "test: add unit tests for property combination"
4. Submit Pull Request
Section titled “4. Submit Pull Request”# Push to your forkgit push origin feature/your-feature-name
# Create PR on GitHub# Navigate to https://github.com/tavobarrientos/TacoMapper# Click "New Pull Request"
Pull Request Guidelines
Section titled “Pull Request Guidelines”PR Title Format
Section titled “PR Title Format”feat: Brief description of new feature
fix: Brief description of bug fix
docs: Brief description of documentation change
test: Brief description of test changes
refactor: Brief description of refactoring
perf: Brief description of performance improvement
PR Description Template
Section titled “PR Description Template”## DescriptionBrief description of changes made.
## Type of Change- [ ] Bug fix (non-breaking change which fixes an issue)- [ ] New feature (non-breaking change which adds functionality)- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)- [ ] Documentation update
## Testing- [ ] Unit tests pass- [ ] Integration tests pass- [ ] Manual testing completed- [ ] Performance impact assessed
## Checklist- [ ] Code follows project coding standards- [ ] Self-review completed- [ ] Documentation updated (if applicable)- [ ] Tests added/updated- [ ] No breaking changes (or clearly documented)
## Related IssuesFixes #123Closes #456
Code Review Process
Section titled “Code Review Process”What We Look For
Section titled “What We Look For”- Correctness - Does the code solve the problem correctly?
- Performance - Is the solution efficient?
- Maintainability - Is the code clean and readable?
- Testing - Are there adequate tests?
- Documentation - Is the code well-documented?
Review Timeline
Section titled “Review Timeline”- Initial Review: Within 2-3 business days
- Follow-up Reviews: Within 1-2 business days
- Merge: After approval and CI passes
Getting Help
Section titled “Getting Help”Communication Channels
Section titled “Communication Channels”- GitHub Issues - For bugs and feature requests
- GitHub Discussions - For questions and general discussion
- Pull Request Comments - For code review discussion
Mentorship
Section titled “Mentorship”New contributors are welcome! If you’re new to open source or need help getting started:
- Look for issues labeled
good first issue
- Comment on issues you’re interested in working on
- Don’t hesitate to ask questions in GitHub Discussions
Recognition
Section titled “Recognition”Contributors will be:
- Listed in Contributors - GitHub automatically tracks contributions
- Mentioned in Release Notes - Significant contributions highlighted
- Added to README - Major contributors recognized in project README
Code of Conduct
Section titled “Code of Conduct”We follow the Contributor Covenant. In summary:
- Be Respectful - Treat everyone with respect and kindness
- Be Inclusive - Welcome people of all backgrounds and experience levels
- Be Collaborative - Work together constructively
- Be Professional - Keep discussions focused and productive
Questions?
Section titled “Questions?”If you have any questions about contributing, please:
- Check existing GitHub Discussions
- Create a new discussion if your question isn’t answered
- Reach out to maintainers through GitHub
Thank you for contributing to TacoMapper! 🌮✨