-
Notifications
You must be signed in to change notification settings - Fork 0
Rules of code
Josias KABORE edited this page Apr 3, 2025
·
3 revisions
- Use consistent indentation (spaces or tabs, but be consistent)
- Keep lines at a reasonable length (typically 80-120 characters)
- Use meaningful and descriptive names for variables, functions, and classes
- Write code in English (variable names, comments, documentation)
- Include a clear README.md with:
- Project description
- Installation instructions
- Usage examples
- Contributing guidelines
- Document all public APIs and functions
- Add inline comments for complex logic
- Keep documentation up-to-date with code changes
- Write clear, descriptive commit messages
- Make small, focused commits
- Use feature branches for development
- Follow semantic versioning (MAJOR.MINOR.PATCH)
- Never commit sensitive information (passwords, API keys)
- Write unit tests for new features
- Maintain good test coverage
- Ensure all tests pass before submitting changes
- Include both positive and negative test cases
- Document test procedures and requirements
- Handle errors and edge cases appropriately
- Use proper exception handling
- Provide meaningful error messages
- Log errors and important events
- Fail gracefully when possible
- Review others' code respectfully
- Provide constructive feedback
- Be open to suggestions and improvements
- Help maintain project documentation
- Follow the project's code of conduct