|
| 1 | +# Contributing to CycloneDX.MSBuild |
| 2 | + |
| 3 | +Thank you for your interest in contributing to CycloneDX.MSBuild! This document provides guidelines and instructions for contributing. |
| 4 | + |
| 5 | +## Code of Conduct |
| 6 | + |
| 7 | +This project adheres to the CycloneDX community standards. By participating, you are expected to uphold professional and respectful communication. |
| 8 | + |
| 9 | +## How to Contribute |
| 10 | + |
| 11 | +### Reporting Issues |
| 12 | + |
| 13 | +- Use the GitHub issue tracker |
| 14 | +- Search existing issues before creating a new one |
| 15 | +- Provide detailed reproduction steps |
| 16 | +- Include environment details (OS, .NET version, MSBuild version) |
| 17 | + |
| 18 | +### Suggesting Features |
| 19 | + |
| 20 | +- Open a GitHub issue with the label "enhancement" |
| 21 | +- Clearly describe the use case and benefits |
| 22 | +- Consider backward compatibility |
| 23 | + |
| 24 | +### Pull Requests |
| 25 | + |
| 26 | +1. Fork the repository |
| 27 | +2. Create a feature branch (`git checkout -b feature/your-feature`) |
| 28 | +3. Make your changes following our coding standards |
| 29 | +4. Add tests for new functionality |
| 30 | +5. Update documentation |
| 31 | +6. Commit with clear messages |
| 32 | +7. Push to your fork |
| 33 | +8. Open a pull request |
| 34 | + |
| 35 | +## Development Guidelines |
| 36 | + |
| 37 | +### Security by Design |
| 38 | + |
| 39 | +All contributions must follow these security principles: |
| 40 | + |
| 41 | +- **No Elevated Permissions**: Code runs in build context only |
| 42 | +- **Input Validation**: Validate all MSBuild properties |
| 43 | +- **Fail-Safe Defaults**: Default to safe behavior |
| 44 | +- **No Arbitrary Code Execution**: Only execute vetted tools |
| 45 | +- **Dependency Pinning**: Use explicit versions |
| 46 | + |
| 47 | +### Clean Code Principles |
| 48 | + |
| 49 | +- **Separation of Concerns**: Keep configuration (.props) and logic (.targets) separate |
| 50 | +- **Single Responsibility**: Each target does one thing |
| 51 | +- **DRY**: Don't repeat yourself |
| 52 | +- **Meaningful Names**: Use clear, descriptive names |
| 53 | +- **Documentation**: Comment complex logic |
| 54 | + |
| 55 | +### MSBuild Best Practices |
| 56 | + |
| 57 | +- Use conditions to avoid unnecessary execution |
| 58 | +- Provide clear messages for errors and warnings |
| 59 | +- Use appropriate message importance levels |
| 60 | +- Handle multi-targeting scenarios |
| 61 | +- Test with various project types |
| 62 | + |
| 63 | +### Code Style |
| 64 | + |
| 65 | +- Follow existing patterns in the codebase |
| 66 | +- Use XML formatting for .props and .targets files |
| 67 | +- Indent with 2 spaces |
| 68 | +- Keep lines under 120 characters |
| 69 | + |
| 70 | +## Testing |
| 71 | + |
| 72 | +### Manual Testing |
| 73 | + |
| 74 | +Test your changes with: |
| 75 | + |
| 76 | +1. Simple single-target projects |
| 77 | +2. Multi-targeting projects |
| 78 | +3. Projects with disabled SBOM generation |
| 79 | +4. Custom configuration scenarios |
| 80 | + |
| 81 | +### Test Projects |
| 82 | + |
| 83 | +Use the integration test projects: |
| 84 | + |
| 85 | +```bash |
| 86 | +# Build test projects |
| 87 | +dotnet build tests/Integration.Tests/SimpleProject/SimpleProject.csproj |
| 88 | +dotnet build tests/Integration.Tests/MultiTargetProject/MultiTargetProject.csproj |
| 89 | +dotnet build tests/Integration.Tests/DisabledProject/DisabledProject.csproj |
| 90 | + |
| 91 | +# Verify SBOM generation |
| 92 | +ls tests/Integration.Tests/SimpleProject/bin/Debug/net8.0/bom.json |
| 93 | +``` |
| 94 | + |
| 95 | +## Documentation |
| 96 | + |
| 97 | +Update documentation when: |
| 98 | + |
| 99 | +- Adding new features |
| 100 | +- Changing configuration options |
| 101 | +- Modifying behavior |
| 102 | +- Adding examples |
| 103 | + |
| 104 | +Documentation locations: |
| 105 | +- `README.md` - User-facing documentation |
| 106 | +- XML comments in `.props` and `.targets` - Property descriptions |
| 107 | +- `CONTRIBUTING.md` - Development guidelines |
| 108 | + |
| 109 | +## Release Process |
| 110 | + |
| 111 | +1. Update version in `CycloneDX.MSBuild.csproj` |
| 112 | +2. Update `CHANGELOG.md` (if present) |
| 113 | +3. Update `README.md` version references |
| 114 | +4. Create a pull request |
| 115 | +5. After merge, maintainers will create a release tag |
| 116 | + |
| 117 | +## Questions? |
| 118 | + |
| 119 | +- Open a GitHub discussion |
| 120 | +- Check existing documentation |
| 121 | +- Review similar issues |
| 122 | + |
| 123 | +## License |
| 124 | + |
| 125 | +By contributing, you agree that your contributions will be licensed under the Apache License 2.0. |
0 commit comments