Repository navigation
1.0.0
π Initial Release
This is the first release of flake8-elegant-objects, a comprehensive Flake8 plugin that enforces the core principles of Elegant Objects programming philosophy by Yegor Bugayenko.
β¨ Features
Error Codes Implemented
-
EO001-EO004: No "-er" naming principle violations
EO001: Class names ending in "-er" (Manager, Controller, Handler, etc.)EO002: Method names ending in "-er" (process β processing)EO003: Variable names ending in "-er" (parser β arguments)EO004: Function names ending in "-er" (analyzer β analysis)
-
EO005: No null (None) usage - prevents defensive programming and unclear contracts
-
EO006: No code in constructors - constructors should only assemble objects, not execute logic
-
EO007: No getters/setters - prevents data container anti-pattern, promotes behavioral objects
-
EO008: No mutable objects - enforces immutability for thread-safety and predictability
-
EO009: No static methods - promotes proper object-oriented design over procedural programming
-
EO010: No type discrimination - prevents isinstance/type casting that violates polymorphism
-
EO011: No public methods without contracts - requires Protocol/ABC contracts for public methods
-
EO012: Test methods should only contain assertThat statements - enforces focused, single-assertion tests
-
EO013: No ORM/ActiveRecord patterns - prevents mixing persistence with business logic
-
EO014: No implementation inheritance - promotes composition over inheritance
π§ Technical Details
Requirements
- Python 3.10+
- AST-based analysis for accurate code inspection
- Zero runtime dependencies beyond Python standard library
Code Quality
- 86% Test Coverage: Comprehensive test suite with real-world examples
- Type Safety: Full mypy type checking compliance
- Code Style: Ruff formatting and linting
- Documentation: Extensive examples and principle explanations
Performance
- Efficient AST Traversal: Optimized single-pass analysis
- Minimal Memory Usage: Lightweight violation tracking
- Fast Execution: Suitable for large codebases
π§ͺ Testing
- 14 Test Modules: One dedicated test file per principle
- Real-world Examples: Test cases based on actual code patterns
- Integration Tests: End-to-end plugin functionality verification
- Continuous Testing: Automated test execution with coverage reporting
π Usage Examples
# Install
pip install flake8-elegant-objects
# Use as flake8 plugin
flake8 --select=EO your_code/
# Run standalone
python -m flake8_elegant_objects your_code/
# Configuration
echo "[flake8]\nselect = E,W,F,EO" > .flake8