Contributing to Sannr
Thank you for your interest in contributing to Sannr! We welcome contributions from the community to help make this the standard for AOT-first validation in .NET.
Table of Contents
Code of Conduct
This project adheres to the Contributor Covenant Code of Conduct. By participating, you are expected to uphold this code.
How to Contribute
Reporting Bugs
Bugs are tracked as GitHub issues. When filing an issue, please include:
- Version: The version of Sannr you are using.
- Reproduction: A code snippet or minimal reproduction repository.
- Expected vs Actual: What you expected to happen vs what actually happened.
Suggesting Enhancements
We love new ideas! If you want to suggest a new "Power Attribute" (e.g., [LuhnCheck] or [Isbn]), please open a Feature Request issue first to discuss the API design before writing code.
Pull Requests
- Fork the repository.
- Branch off
main(e.g.,feature/add-isbn-validatororfix/regex-timeout). - Commit your changes. Please use clear, imperative commit messages (e.g., "Add ISBN validator", not "Added some code").
- Test your changes. Run
dotnet testto ensure all standard and generator tests pass. - Push to your fork and submit a Pull Request.
Development Workflow
Sannr is a Source Generator project. This adds some complexity to the dev loop.
- Open the Solution:
Sannr.sln. - Build:
dotnet build. - Test: The
tests/Sannr.Testsproject references the generator as an analyzer.- Note: Visual Studio sometimes requires a restart to pick up changes to the source generator logic itself.
- We recommend running
dotnet testfrom the CLI for the most reliable results during generator development.
Coding Standards
- Style: We follow standard C# coding conventions (PascalCase for public members,
_camelCasefor private fields). - Performance: This is a high-performance AOT library.
- Avoid LINQ in hot paths (validation loops).
- Avoid boxing where possible.
- Use
StringBuilderor string interpolation carefully in the generator.
- Tests: All new features must be accompanied by unit tests in
Sannr.Tests.
License
By contributing, you agree that your contributions will be licensed under its MIT License.