Introduction
Welcome to the OSS Coding Standards documentation! 📚 These guidelines help maintain consistency, readability, and quality across open-source projects. Whether you're contributing to an existing repository or starting a new one, following these standards ensures smoother collaboration.
For more details on how to contribute to OSS projects, check out our OSS Project Contribution Guide.
Key Principles
Here are the core principles every OSS contributor should follow:
Readability First 📝
Code should be easy to understand. Use clear variable names and consistent formatting.Consistency Matters 🔄
Follow the style guide of the project. If it's not defined, adopt a widely accepted standard (e.g., Google Style Guides).Documentation is Essential 📖
Every public API and major feature must have accompanying documentation. Use tools like Sphinx for Python projects.Testing & Linting 🔍
Run automated tests and linters (e.g., ESLint for JavaScript) before submitting changes.
Language-Specific Guidelines
Python
- PEP 8 compliance is mandatory.
- Use black for code formatting.
- Add type hints for better maintainability.
JavaScript
- Follow Airbnb's JavaScript Style Guide.
- Use ESLint with the
eslint-config-airbnb
preset. - Prefer
const
overlet
unless mutation is required.
Java
- Adhere to Oracle's Java Code Conventions.
- Use Checkstyle for code quality checks.
- Keep methods focused and concise.
Best Practices
- Commit Messages: Use Conventional Commits format.
- Branching Strategy: Follow Git Flow or Trunk-Based Development.
- Code Reviews: Always peer-review pull requests. Use 📌 for code quality suggestions.
Community Standards
- Respect the project's code of conduct.
- Use 📢 for important announcements in the README.
- Keep discussions in the issue tracker focused on solutions.
Let's build better software together! 🌍🔧