Thank you for your interest in contributing to SpdxModel! This document provides guidelines and instructions for contributing to this project.
- Code of Conduct
- Getting Started
- Development Setup
- How to Contribute
- Coding Guidelines
- Testing Requirements
- Pull Request Process
- Reporting Bugs
- Suggesting Features
This project adheres to a Code of Conduct (see CODE_OF_CONDUCT.md). By participating, you are expected to uphold this code. Please report unacceptable behavior to the project maintainers.
- Fork the repository on GitHub
- Clone your fork locally
- Create a branch for your changes
- Make your changes
- Push your changes to your fork
- Submit a pull request
- .NET 8, 9, or 10 SDK
- A code editor (Visual Studio, Visual Studio Code, or JetBrains Rider recommended)
- Git
# Restore .NET tools
dotnet tool restore
# Restore dependencies
dotnet restore
# Build the solution
dotnet build
# Run tests
dotnet test# Run all tests
dotnet test
# Run tests with code coverage
dotnet test --collect:"XPlat Code Coverage;Format=opencover"We welcome various types of contributions:
- Bug fixes: Help us fix issues in the codebase
- New features: Add new functionality to the library
- Documentation: Improve or add documentation
- Tests: Add or improve test coverage
- Code quality: Refactor code, improve performance, or enhance maintainability
- Check the issue tracker to see if your issue or feature has already been reported
- For major changes, please open an issue first to discuss what you would like to change
- Ensure your development environment is properly set up
- Follow standard C# naming conventions (PascalCase for classes/methods/properties, camelCase for local variables)
- Use meaningful variable and method names
- Keep methods focused and concise
- Add XML documentation comments for public APIs
- The project uses
.editorconfigfor consistent code style - ensure your editor respects these settings
- Use nullable reference types appropriately
- Prefer
varwhen the type is obvious from the right-hand side - Use
file-scopednamespaces - Avoid public fields; use properties instead
- Follow the existing code style in the project
- All public APIs must have XML documentation comments
- Include
<summary>,<param>,<returns>, and<exception>tags as appropriate - Provide clear and concise descriptions
- Include code examples for complex APIs when helpful
The project uses several code analyzers:
- Microsoft.CodeAnalysis.NetAnalyzers: For .NET-specific code analysis
- StyleCop.Analyzers: For consistent code style enforcement
- Nullable Reference Types: Enabled project-wide
Ensure your code passes all analyzer checks before submitting a pull request.
- All new features must include comprehensive unit tests
- Bug fixes should include tests that verify the fix
- Aim for high test coverage (80%+ for new code)
- Use the AAA (Arrange, Act, Assert) pattern for tests
[TestMethod]
public void MethodName_Scenario_ExpectedBehavior()
{
// Arrange: Set up test data and dependencies
var sut = new SystemUnderTest();
// Act: Execute the method being tested
var result = sut.MethodName();
// Assert: Verify the expected behavior
Assert.AreEqual(expected, result);
}- Test files should be named
[Component]Tests.cs - Test methods should follow the pattern:
MethodName_Scenario_ExpectedBehavior - Use descriptive test names that clearly indicate what is being tested
-
Create a Branch: Create a feature branch from
maingit checkout -b feature/your-feature-name
-
Make Changes: Implement your changes following the coding guidelines
-
Write Tests: Add or update tests to cover your changes
-
Run Tests: Ensure all tests pass
dotnet test -
Build Verification: Ensure the project builds without errors or warnings
dotnet build
-
Commit Changes: Use clear and descriptive commit messages
git commit -m "Add feature: brief description" -
Push Changes: Push your branch to your fork
git push origin feature/your-feature-name
-
Open Pull Request: Submit a pull request to the main repository
- Provide a clear description of the changes
- Reference any related issues
- Ensure all CI checks pass
- All tests must pass
- Code coverage should not decrease
- No build warnings or errors
- Code must pass all analyzer checks
- Documentation must be updated if APIs change
- Commit messages should be clear and descriptive
- Maintainers will review your pull request
- Address any feedback or requested changes
- Once approved, a maintainer will merge your pull request
- Check the issue tracker to see if the bug has already been reported
- Ensure you're using the latest version of the library
- Verify that the issue is reproducible
- Use the GitHub issue tracker
- Provide a clear and descriptive title
- Describe the expected behavior
- Describe the actual behavior
- Provide steps to reproduce the issue
- Include relevant code samples or test cases
- Specify your environment (OS, .NET version, library version)
We welcome feature suggestions! To suggest a new feature:
- Check the issue tracker to see if the feature has already been suggested
- Open a new issue with the "enhancement" label
- Provide a clear description of the feature
- Explain the use case and benefits
- Consider providing a proposed implementation approach
By contributing to SpdxModel, you agree that your contributions will be licensed under the MIT License.
If you have questions about contributing, feel free to:
- Open an issue with your question
- Contact the project maintainers
Thank you for contributing to SpdxModel!