This document outlines the standards and best practices for external contributions to Bayat's open-source projects.
- Introduction
- Code of Conduct
- Getting Started
- Contribution Workflow
- Pull Request Guidelines
- Code Standards
- Documentation Requirements
- Testing Requirements
- Review Process
- Recognition and Attribution
- Communication Channels
- Legal Considerations
These guidelines facilitate successful contributions to Bayat's open-source projects by:
- Setting clear expectations for contributors
- Streamlining the contribution process
- Ensuring high-quality contributions
- Creating a positive experience for community members
- Maintaining project quality and consistency
These guidelines apply to all contributions to Bayat's public repositories, including:
- Code contributions
- Documentation improvements
- Bug reports
- Feature requests
- Design assets
- Translations
- Test cases
All contributors must adhere to our \1\2), which promotes:
- Respectful and inclusive communication
- Constructive feedback
- Collaborative problem solving
- Focus on project objectives
- A welcoming environment for all participants
Violations of the Code of Conduct should be reported to the project maintainers or [email protected].
-
Read Project Documentation:
- Project README and contribution guidelines
- Architecture documentation
- Design documents or style guides
-
Search Existing Issues and PRs:
- Check if the issue has already been reported
- Look for ongoing or rejected work on similar features
- Review related discussions
-
Join the Community:
- Introduce yourself in community channels
- Participate in discussions
- Ask questions if something is unclear
For first-time contributors:
- Look for issues labeled
good-first-issue
orbeginner-friendly
- Start with small, contained changes like:
- Documentation improvements
- Bug fixes with clear reproduction steps
- Test additions
- Small feature enhancements
-
Fork the repository to your GitHub account
-
Clone your fork to your local machine
-
Set up the upstream remote:
git remote add upstream https://github.com/bayat/[project].git
-
Follow project-specific setup instructions in the README
-
Verify your environment with provided tests or examples
-
Issue Discussion:
- For features: Discuss in issues before implementation
- For bugs: Report with complete reproduction steps
- Get maintainer feedback on proposed approach
-
Branch Creation:
- Create a feature branch from the main development branch
- Use descriptive naming:
feature/short-description
orfix/issue-description
- Keep branches focused on single issues or features
-
Development:
- Follow project coding standards
- Include tests for new functionality
- Update documentation as needed
- Make regular, logical commits with clear messages
-
Preparation for Submission:
-
Sync with upstream before submitting:
git fetch upstream git rebase upstream/main
-
Resolve any conflicts
-
Run all tests and linters locally
-
-
Pull Request Submission:
- Submit PR against the appropriate target branch
- Complete the PR template with all required information
- Link to related issues
- Request appropriate reviewers
Contribution Type | Recommended Size | Review Time Expectation |
---|---|---|
Typo fix | 1-5 lines | 1-2 days |
Bug fix | < 200 lines | 2-5 days |
Small feature | < 500 lines | 5-10 days |
Major feature | Discuss with maintainers | 2+ weeks |
For larger changes, consider:
- Breaking the work into smaller, incremental PRs
- Creating a design document or RFC first
- Implementing a prototype for feedback before full implementation
All pull requests should:
- Address a single concern (feature, bug, documentation)
- Include tests for new functionality
- Update relevant documentation
- Pass CI/CD checks
- Follow coding standards and style guides
- Include appropriate changelog entries
- Be rebased on the latest upstream changes
PRs should use the project-specific template that includes:
## Description
[Concise description of the changes]
## Related Issue
Fixes #[issue_number]
## Motivation and Context
[Why is this change needed? What problem does it solve?]
## How Has This Been Tested?
[Describe the tests you ran]
## Screenshots (if appropriate)
## Types of changes
- [ ] Bug fix
- [ ] New feature
- [ ] Breaking change
- [ ] Documentation update
## Checklist
- [ ] My code follows the project's style guidelines
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have updated the documentation
- [ ] My changes generate no new warnings
- [ ] I have added tests that prove my fix is effective or that my feature works
- [ ] New and existing unit tests pass locally with my changes
Follow the Conventional Commits format:
<type>[optional scope]: <description>
[optional body]
[optional footer(s)]
Where type
is one of:
feat
: A new featurefix
: A bug fixdocs
: Documentation changesstyle
: Code style changes (formatting, etc.)refactor
: Code changes that neither fix bugs nor add featuresperf
: Performance improvementstest
: Adding or correcting testschore
: Changes to build process, tools, etc.
Examples:
feat(auth): add multi-factor authentication
fix(api): prevent race condition in request handling
docs: clarify installation instructions
Follow the project's established coding standards, which typically reference Bayat's language-specific standards:
- \1\2)
- \1\2)
- \1\2)
- \1\2)
- \1\2)
- \1\2)
- \1\2)
Regardless of language:
- Readability: Prioritize code readability over cleverness
- Simplicity: Prefer simple, straightforward solutions
- Consistency: Follow existing patterns and conventions
- Modularity: Write modular, reusable components
- Maintainability: Consider the long-term maintenance implications
- Use comments to explain "why" not "what"
- Document non-obvious design decisions
- Include references to relevant issues or external resources
- Keep comments up-to-date with code changes
- Use language-appropriate documentation tools (JSDoc, docstrings, etc.)
When contributing, update the following documentation as appropriate:
-
Code Documentation:
- Function/method documentation
- Class and module documentation
- Complex algorithm explanations
-
Project Documentation:
- README updates
- Installation/setup instructions
- API documentation
- Usage examples
-
User-Facing Documentation:
- User guides
- Tutorials
- FAQ updates
- Feature documentation
- Use clear, concise language
- Include examples for APIs and functions
- Maintain consistent terminology
- Organize content logically
- Follow Markdown standards for formatting
- Include screenshots or diagrams for complex features
Add appropriate entries to CHANGELOG.md following the Keep a Changelog format:
## [Unreleased]
### Added
- New feature X
### Fixed
- Bug in component Y
### Changed
- Behavior of function Z
Contribution Type | Test Coverage Expectation |
---|---|
Bug fix | Tests that verify the fix |
New feature | Tests for all functionality |
Refactoring | Maintain or improve existing test coverage |
Performance improvement | Benchmarks showing improvement |
-
Write tests that are:
- Fast
- Independent
- Repeatable
- Self-validating
- Thorough
-
Test both:
- Happy paths (expected usage)
- Edge cases and error conditions
Use the project's established testing frameworks:
- JavaScript/TypeScript: Jest, Mocha, Cypress
- Python: pytest, unittest
- Go: testing package, testify
- Java: JUnit, TestNG
- C#: xUnit, NUnit
Pull requests are evaluated based on:
- Functionality: Does it work as intended?
- Quality: Does it meet code standards?
- Tests: Is it adequately tested?
- Documentation: Is it properly documented?
- Design: Does it align with the project's architecture?
- Performance: Does it maintain or improve performance?
- Security: Does it follow security best practices?
-
Initial Review:
- Automated checks must pass
- Maintainer performs initial review
- Feedback provided within timeframe based on PR size
-
Revision Cycle:
- Contributor addresses feedback
- Reviewer re-reviews changes
- Process repeats until PR is approved or rejected
-
Approval and Merge:
- Requires approval from at least one maintainer
- Some projects may require multiple approvals
- Maintainers handle the final merge
As a reviewer:
- Be respectful and constructive
- Explain the reasoning behind suggestions
- Differentiate between required changes and preferences
- Provide examples when possible
- Acknowledge good work
As a contributor:
- Respond to all feedback
- Explain your decisions when not implementing suggestions
- Ask for clarification if feedback is unclear
- Be patient and professional
Contributors are recognized through:
- Inclusion in CONTRIBUTORS.md file
- Mention in release notes for significant contributions
- Acknowledgment in documentation
- Potential inclusion in the core team for consistent contributors
- Original authors should be credited in file headers
- Major contributors to a component should be listed in component documentation
- Adapted or inspired code must credit original sources
Active contributors may be invited to become project maintainers based on:
- Quality and consistency of contributions
- Understanding of project goals and architecture
- Positive interaction with the community
- Commitment to the project's long-term success
Channel | Purpose | Response Time |
---|---|---|
GitHub Issues | Bug reports, feature requests | 1-3 business days |
GitHub Discussions | Design discussions, Q&A | 2-5 business days |
Discord/Slack | Real-time community discussion | Best effort |
Dev mailing list | Major announcements, RFC discussions | Weekly digest |
Project blog | Major features, roadmap updates | Monthly posts |
- Keep technical discussions in public channels
- Use issues for project-related discussions, not personal messages
- Tag relevant team members when needed
- Be patient waiting for responses
- Consider time zones when expecting replies
- All contributions must comply with the project's license
- By contributing, you agree that your contributions will be licensed under the project's license
- Include license headers in new files
For some projects, contributors must sign a CLA:
- Individual CLA for personal contributions
- Corporate CLA for contributions made as part of employment
- Complete the CLA before your first contribution
- Only contribute code you have the right to contribute
- Do not contribute code that infringes on patents or copyrights
- Disclose any potential IP concerns to maintainers
When adding dependencies:
- Only add dependencies with compatible licenses
- Document new dependencies in appropriate files
- Justify the need for new dependencies
- Consider the maintenance and security status of dependencies