Code Standards
Follow these standards when contributing to maintain code quality and consistency.Core Principles
The Arch Way
- Simplicity - No unnecessary abstractions
- Correctness - Robust error handling, proper types
- Transparency - Well-documented, readable code
- User-centricity - Assume competent users
- Pragmatism - Practical solutions over theoretical purity
Type Hints
Required - All functions must have complete type hints:Async/Await
Required - All I/O operations must be async:✅ Good
❌ Bad
Error Handling
Required - Comprehensive error handling with structured responses:Error Response Format
Return structured errors for MCP clients:Logging
Required - Debug logs for all operations:Log Levels
DEBUG- Detailed flow information (default)INFO- Major events (startup, shutdown)WARNING- Fallbacks, recoverable errorsERROR- Failures that prevent operation
Docstrings
Use Google-style docstrings:Function Organization
Group related functions, order by importance:Timeout Management
Always use timeouts for network operations:Code Comments
Add comments for complex logic only:Testing Standards
All new features and bug fixes must include tests using pytest:Writing Tests
Test Organization
- Place tests in
tests/directory - Name test files
test_<module>.py - Use descriptive test names:
test_<function>_<scenario>() - Group related tests in classes:
class TestWikiSearch:
Coverage Expectations
- New code: Aim for 90%+ coverage
- Bug fixes: Add regression tests
- Core modules: Maintain 90%+ coverage (utils, wiki, pacman)
- Security code: 100% coverage required (AUR analysis)
Running Tests
Next Steps
Contributing Guide
Ready to contribute? Read the contribution guidelines.
Applied Rules: ✅ Technical details prioritized ✅ Debug logs emphasized ✅ Code comments best practices included