Thank you for your interest in contributing to OpenSauce! This document provides guidelines and instructions for contributing.
- A GitHub account
- Git installed on your local machine
- Basic knowledge of the programming language you want to contribute in
- Understanding of Data Structures and Algorithms
If this is your first contribution to open source:
- Read through this guide completely
- Check out How to Contribute to Open Source
- Look for beginner-friendly issues or start with a simple algorithm implementation
# Fork the repository on GitHub, then clone your fork
git clone https://github.com/your-username/OpenSauce.git
cd OpenSauce
# Add upstream remote
git remote add upstream https://github.com/xthxr/OpenSauce.git# Create and switch to a new branch
git checkout -b feature/algorithm-name
# Branch naming conventions:
# - feature/binary-search-python
# - add/merge-sort-java
# - fix/bubble-sort-cpp- Navigate to the appropriate language folder
- Create subdirectories for organizing by topic (e.g.,
sorting/,trees/) - Write your code following the language-specific guidelines
- Add comprehensive comments
# Stage your changes
git add .
# Commit with a meaningful message
git commit -m "Add binary search implementation in Python"
# Commit message format:
# - "Add [algorithm] in [language]"
# - "Fix [issue] in [algorithm]"
# - "Update [algorithm] documentation"# Fetch latest changes from upstream
git fetch upstream
# Merge upstream changes
git merge upstream/main# Push to your fork
git push origin feature/algorithm-name
# Then create a Pull Request on GitHub- Originality: Write your own code or properly attribute sources
- Documentation: Include clear comments explaining the algorithm
- Complexity Analysis: Add time and space complexity in comments
- Testing: Provide example usage or test cases
- Formatting: Follow language-specific style guides
For algorithms:
1. Brief description of the algorithm
2. Time complexity: O(?)
3. Space complexity: O(?)
4. Implementation
5. Example usage/test cases
Example (Python):
"""
Binary Search Algorithm
Time Complexity: O(log n)
Space Complexity: O(1)
Searches for a target value in a sorted array using divide and conquer.
"""
def binary_search(arr, target):
"""
Performs binary search on a sorted array.
Args:
arr: Sorted list of comparable elements
target: Element to search for
Returns:
Index of target if found, -1 otherwise
"""
left, right = 0, len(arr) - 1
while left <= right:
mid = (left + right) // 2
if arr[mid] == target:
return mid
elif arr[mid] < target:
left = mid + 1
else:
right = mid - 1
return -1
# Example usage
if __name__ == "__main__":
arr = [1, 3, 5, 7, 9, 11, 13]
target = 7
result = binary_search(arr, target)
print(f"Element found at index: {result}")- Use descriptive variable names
- Include necessary headers
- Add function prototypes if needed
- Use proper memory management
- Follow camelCase for methods, PascalCase for classes
- Include proper package declarations if needed
- Use Java Collections Framework appropriately
- Follow PEP 8 style guide
- Use type hints (Python 3.5+)
- Include docstrings
- Use meaningful variable names
- Use ES6+ features
- Follow camelCase convention
- Add JSDoc/TSDoc comments
- Use proper error handling
Organize your code by topic within each language folder:
Language/
├── README.md
├── arrays/
│ ├── two_sum.ext
│ └── rotate_array.ext
├── sorting/
│ ├── bubble_sort.ext
│ ├── quick_sort.ext
│ └── merge_sort.ext
├── trees/
│ ├── binary_tree.ext
│ └── bfs_traversal.ext
└── graphs/
├── dfs.ext
└── dijkstra.ext
- C/C++:
snake_case.c,snake_case.cpp - Java/Kotlin:
PascalCase.java,PascalCase.kt - Python:
snake_case.py - JavaScript:
camelCase.js - Go:
snake_case.go - Rust:
snake_case.rs
❌ Don't submit:
- Duplicate implementations (check existing code first)
- Code without proper documentation
- Code copied from other sources without attribution
- Spam or meaningless contributions
- Code that doesn't run or compile
- Unrelated files (build artifacts, IDE configs, etc.)
❌ Don't:
- Submit multiple PRs for the same algorithm
- Make unnecessary formatting changes to existing code
- Submit broken or untested code
- Automated Checks: Basic checks run automatically
- Review: Maintainers review your code
- Feedback: You may receive suggestions for improvements
- Approval: Once approved, your PR will be merged
# Make requested changes
git add .
git commit -m "Address review comments"
git push origin feature/algorithm-nameAll contributors will be:
- Listed in the Contributors section
- Credited in the commit history
- Eligible for Hacktoberfest rewards (during October)
- Questions? Open an issue with the
questionlabel - Found a bug? Open an issue with the
buglabel - Have an idea? Open an issue with the
enhancementlabel
If contributing for Hacktoberfest:
- Register on hacktoberfest.com
- Make quality contributions (not spam)
- Complete 4 valid PRs during October
- Wait for PRs to be reviewed and accepted
- PRs must add value to the repository
- No minor formatting or whitespace changes only
- Must follow all contribution guidelines above
- Be respectful and inclusive
- Provide constructive feedback
- Accept constructive criticism gracefully
- Focus on what's best for the community
- Harassment or discriminatory language
- Trolling or insulting comments
- Spam or promotional content
- Publishing others' private information
Thank you for contributing to OpenSauce! Happy coding! 🎉