Thank you for your interest in contributing to sourcekit-bsp! This document provides guidelines and information for contributors.
This project adheres to a Code of Conduct. By participating, you are expected to uphold this code.
- Check existing issues first to avoid duplicates
- Use the bug report template when creating new issues
- Provide detailed information including:
- Steps to reproduce the issue
- Expected vs actual behavior
- Environment details (macOS version, Xcode version, etc.)
- Relevant log output
- Check existing feature requests to avoid duplicates
- Use the feature request template
- Describe the problem you're trying to solve
- Propose a solution with implementation details if possible
- macOS 12.0 or later
- Xcode 14.0 or later
- Swift 6.1 or later
- Familiarity with Build Server Protocol (BSP)
-
Fork and clone the repository:
git clone https://github.com/yourusername/sourcekit-bsp.git cd sourcekit-bsp -
Install dependencies:
swift package resolve
-
Build the project:
swift build
-
Run tests:
swift test
-
Create a feature branch:
git checkout -b feature/your-feature-name
-
Make your changes following the coding standards below
-
Add tests for new functionality
-
Ensure all tests pass:
swift test -
Run code quality checks:
mint bootstrap mint run swiftlint --strict mint run swiftformat . --lint -
Commit your changes with clear, descriptive messages:
git commit -m "Add feature: brief description of changes" -
Push to your fork:
git push origin feature/your-feature-name
-
Create a pull request using the PR template
We follow the Swift API Design Guidelines and use SwiftLint for enforcement.
- Naming: Use clear, descriptive names
- Access Control: Use the most restrictive access level possible
- Documentation: Document all public APIs with triple-slash comments
- Error Handling: Use proper Swift error handling, avoid force unwrapping
- Concurrency: Use Swift's modern concurrency features (async/await, actors)
/// Manages the build server context for an Xcode project
public actor BuildServerContext {
private let projectURL: URL
private var buildSettings: [BuildSettings]?
/// Initializes a new build server context
/// - Parameter projectURL: The URL of the Xcode project or workspace
public init(projectURL: URL) {
self.projectURL = projectURL
}
/// Loads the project configuration and build settings
/// - Throws: `BuildServerError` if the project cannot be loaded
public func loadProject() async throws {
// Implementation...
}
}- Separation of Concerns: Keep BSP protocol, JSON-RPC, and Xcode integration separate
- Thread Safety: Use actors for shared mutable state
- Error Handling: Define specific error types, avoid generic errors
- Testing: Write unit tests for all public APIs
- Documentation: Document complex algorithms and protocols
Follow the Conventional Commits specification:
type(scope): description
[optional body]
[optional footer]
Types:
feat: New featurefix: Bug fixdocs: Documentation changesstyle: Code style changes (formatting, etc.)refactor: Code refactoringtest: Adding or updating testschore: Maintenance tasks
Examples:
feat(bsp): add support for build target dependencies
fix(jsonrpc): handle malformed requests gracefully
docs(readme): update installation instructions
- Write tests for all new functionality
- Maintain test coverage above 80%
- Use descriptive test names that explain what is being tested
- Follow the Arrange-Act-Assert pattern
- Test BSP protocol compliance
- Test Xcode integration with real projects
- Test error scenarios and edge cases
# Run all tests
swift test
# Run specific test
swift test --filter TestClassName.testMethodName
# Run with coverage
swift test --enable-code-coverage- Document all public APIs with triple-slash comments
- Include parameter descriptions and return value information
- Add usage examples for complex APIs
- Document thrown errors
- Update architecture diagrams for significant changes
- Document design decisions in ADRs (Architecture Decision Records)
- Keep the README up to date with new features
- Code follows style guidelines
- All tests pass
- Documentation is updated
- Commit messages follow conventions
- PR description explains the changes
Pull requests are reviewed for:
- Correctness: Does the code work as intended?
- Design: Is the code well-designed and fits the architecture?
- Functionality: Does it fulfill the requirements?
- Complexity: Is the code as simple as possible?
- Tests: Are there appropriate tests?
- Naming: Are names clear and descriptive?
- Comments: Are comments clear and useful?
- Documentation: Is documentation updated?
- Small changes: 1-2 days
- Medium changes: 3-5 days
- Large changes: 1-2 weeks
- Version bumps follow Semantic Versioning
- Releases are created from the
mainbranch - Release notes are auto-generated from commit messages
- Binaries are automatically built and uploaded via GitHub Actions
- Discussions: Use GitHub Discussions for questions
- Issues: Create issues for bugs and feature requests
- Discord: Join our community Discord (link in README)
Contributors are recognized in:
- README acknowledgments
- Release notes
- GitHub contributors page
Thank you for contributing to sourcekit-bsp!