Contributing¶
Thank you for your interest in contributing to Straw! This guide will help you get started.
Getting Started¶
Prerequisites¶
- Go 1.25 or later
- Git
- Make (optional, for using Makefile commands)
Setting Up Development Environment¶
-
Fork and clone the repository:
-
Install dependencies:
-
Build the project:
-
Run tests:
Development Workflow¶
Branching Strategy¶
main- Stable release branchdevelop- Development branchfeature/*- Feature branchesbugfix/*- Bug fix branches
Making Changes¶
-
Create a new branch:
-
Make your changes following the code style guidelines
-
Test your changes:
-
Commit with a clear message:
-
Push and create a pull request:
Code Style¶
Go Conventions¶
We follow standard Go conventions:
- Use
gofmtfor formatting - Use
goimportsfor import organization - Follow Effective Go
- Follow Go Code Review Comments
Project-Specific Guidelines¶
See the project's AGENTS.md for detailed project guidelines.
Key points:
-
Imports ordering:
-
Error handling:
-
Testing:
- Use table-driven tests
- Name tests descriptively
- Clean up test resources
Testing¶
Running Tests¶
# All tests
make test
# Specific package
go test ./internal/config
# With coverage
go test -cover ./...
# Verbose output
go test -v ./...
Writing Tests¶
Example test structure:
func TestFeature_Description(t *testing.T) {
t.Run("Test case 1", func(t *testing.T) {
// Test code
})
t.Run("Test case 2", func(t *testing.T) {
// Test code
})
}
Linting and Formatting¶
# Run all checks
make check
# Format code
make fmt
# Run linter
golangci-lint run ./...
# Vet code
go vet ./...
Documentation¶
- Update documentation for any user-facing changes
- Update CHANGELOG.md for significant changes
- Add examples for new features
- Update configuration examples if needed
Commit Message Format¶
We follow Conventional Commits:
Types: - feat: New feature - fix: Bug fix - docs: Documentation changes - style: Code style changes (formatting) - refactor: Code refactoring - test: Test changes - chore: Build/tooling changes
Examples:
feat(rules): add support for regex matching
fix(actions): handle spaces in file paths
docs: update installation instructions
Pull Request Process¶
- Update documentation for any changed functionality
- Add tests for new features
- Ensure all tests pass
- Update CHANGELOG.md if applicable
- Request review from maintainers
- Address review feedback
- Squash commits if requested
Reporting Issues¶
Bug Reports¶
Include: - Operating system and version - Straw version (straw --version) - Steps to reproduce - Expected behavior - Actual behavior - Configuration file (sanitized) - Relevant log output
Feature Requests¶
Include: - Use case description - Proposed solution - Alternatives considered
Code of Conduct¶
- Be respectful and inclusive
- Welcome newcomers
- Focus on constructive feedback
- Assume good intentions
Getting Help¶
- GitHub Discussions: For questions and ideas
- GitHub Issues: For bugs and feature requests
- Documentation: Check the docs first
Release Process¶
Releases are managed by maintainers:
- Update version in relevant files
- Update CHANGELOG.md
- Create git tag
- Build release binaries
- Create GitHub release
- Update documentation
License¶
By contributing, you agree that your contributions will be licensed under the MIT License.