These coding guidelines are intended to ensure a consistent and maintainable codebase for FunnyQuoteLib. All contributors are expected to follow these guidelines when submitting code changes.
-
Readability:
- Write clear and readable code. Use meaningful variable and function names.
- Keep lines of code reasonably short to enhance readability.
-
Consistency:
- Follow consistent coding patterns and conventions.
- Use consistent indentation (spaces or tabs) throughout the codebase.
-
Comments:
- Add comments to explain complex or non-intuitive sections of code.
- Ensure comments are kept up-to-date with code changes.
-
PSR Standards:
- Follow the PSR-1 and PSR-2 standards as much as possible.
- For autoloading, adhere to PSR-4.
-
Namespace:
- Use namespaces to organize classes logically.
-
Class Structure:
- Follow a consistent class structure: properties, constructor, methods.
-
Error Handling:
- Use exceptions for error handling rather than PHP errors.
-
Unit Tests:
- Write comprehensive unit tests for new features and bug fixes.
- Ensure existing tests pass before submitting changes.
-
Test Coverage:
- Aim for high test coverage to catch regressions.
-
One Feature or Bug Fix Per Pull Request:
- Keep pull requests focused on addressing a single issue or implementing a specific feature.
-
Clear Descriptions:
- Provide a clear and concise description of the changes made in the pull request.
-
Reference Issues:
- If applicable, reference the relevant issue(s) in your pull request.
- Semantic Versioning:
- Follow semantic versioning (SemVer) for versioning.
By contributing to FunnyQuoteLib, you agree to adhere to these coding guidelines. Consistent adherence to these guidelines will help maintain a high-quality and cohesive codebase.