cleanup
This commit is contained in:
parent
04799633b4
commit
947a8ff51f
145
QualityTODO.md
145
QualityTODO.md
@ -78,18 +78,6 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
### 1️⃣ Code Follows PEP8 and Project Coding Standards
|
||||
|
||||
#### Blank Line Spacing Issues (PEP8 §4)
|
||||
|
||||
- [ ] `src/cli/Main.py` - Missing blank lines between methods
|
||||
- [ ] `src/core/providers/aniworld_provider.py` - Inconsistent class method spacing
|
||||
- [ ] Verify 2 blank lines between top-level class/function definitions
|
||||
|
||||
#### Indentation Consistency
|
||||
|
||||
- [ ] `src/cli/Main.py` - Mixed indentation in multi-line statements
|
||||
- [ ] `src/core/SerieScanner.py` - Check continuation line alignment
|
||||
- [ ] `src/server/database/service.py` - Verify parameter alignment in method definitions
|
||||
|
||||
---
|
||||
|
||||
### 2️⃣ Type Hints Used Where Applicable
|
||||
@ -98,70 +86,16 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
**Abstract Base Classes (Critical)**
|
||||
|
||||
- [ ] `src/core/providers/base_provider.py` - 6 abstract methods entirely untyped
|
||||
- Lines 7, 11, 15, 19, 23, 27
|
||||
- All need parameter types and return types
|
||||
- [ ] `src/core/providers/streaming/Provider.py` - `GetLink()` method
|
||||
- Return type `(str, [str])` is invalid syntax
|
||||
- Should use `Tuple[str, List[str]]`
|
||||
|
||||
**CLI Module**
|
||||
|
||||
- [ ] `src/cli/Main.py` - 12+ methods without type hints
|
||||
- `search(words: str) -> list` - line 70
|
||||
- `get_user_selection() -> list` - line 75
|
||||
- `display_series()` - no type hints
|
||||
- `__InitList__()` - no type hints
|
||||
- `retry()` method - no type hints
|
||||
- `print_Download_Progress()` - no type hints
|
||||
|
||||
**Service Classes**
|
||||
|
||||
- [ ] `src/server/services/auth_service.py` - Missing return type on `_verify_password()`
|
||||
- [ ] `src/server/services/config_service.py` - Check all methods for return types
|
||||
- [ ] `src/server/services/monitoring_service.py` - Check method signatures
|
||||
- [ ] `src/server/services/backup_service.py` - Check method signatures
|
||||
- [ ] `src/server/services/analytics_service.py` - Check method signatures
|
||||
|
||||
**API Endpoints**
|
||||
|
||||
- [ ] `src/server/api/anime.py` - Line 100+ `get_anime()` missing return type
|
||||
- [ ] `src/server/api/health.py` - Check all endpoints
|
||||
- [ ] `src/server/api/maintenance.py` - Check all endpoints
|
||||
- [ ] `src/server/api/analytics.py` - Check all endpoints
|
||||
- [ ] `src/server/api/backup.py` - Check all endpoints
|
||||
|
||||
**Dependencies and Utils**
|
||||
|
||||
- [ ] `src/server/utils/dependencies.py` - Several function return types missing
|
||||
- `get_current_user()` at line 100 - returns `dict` but untyped
|
||||
- `optional_auth()` - returns `Optional[dict]` but untyped
|
||||
- `CommonQueryParams.__init__()` - no return type annotation
|
||||
|
||||
**Core Classes**
|
||||
|
||||
- [ ] `src/core/SeriesApp.py` - Missing return types on:
|
||||
- `ReScan()` method
|
||||
- `_handle_error()` method
|
||||
- `_handle_completion()` method
|
||||
- `download_series()` method (partially typed)
|
||||
- [ ] `src/core/SerieScanner.py` - Missing return types on:
|
||||
- `Scan()` method - line 85+
|
||||
- `__find_mp4_files()` method
|
||||
|
||||
**Property Decorators**
|
||||
|
||||
- [ ] `src/core/entities/series.py` - Check if properties have return types
|
||||
- Lines 15-50 - properties should have return type annotations
|
||||
- [ ] `src/core/providers/aniworld_provider.py` - Check class property types
|
||||
|
||||
#### Invalid Type Hint Syntax
|
||||
|
||||
- [ ] `src/core/providers/streaming/Provider.py` line 7
|
||||
- `(str, [str])` should be `Tuple[str, List[str]]`
|
||||
- [ ] `src/core/entities/series.py` line 4
|
||||
- Uses `dict[int, list[int]]` - OK for Python 3.9+, but check minimum version
|
||||
|
||||
---
|
||||
|
||||
### 3️⃣ Clear, Self-Documenting Code Written
|
||||
@ -170,7 +104,6 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
**Module-Level Docstrings**
|
||||
|
||||
- [ ] `src/cli/Main.py` - Missing module docstring
|
||||
- [ ] `src/core/entities/SerieList.py` - Check module docstring
|
||||
- [ ] `src/core/providers/streaming/doodstream.py` - Check module docstring
|
||||
- [ ] `src/core/providers/streaming/filemoon.py` - Check module docstring
|
||||
@ -640,31 +573,16 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
#### `src/cli/Main.py`
|
||||
|
||||
- [x] **Naming Conventions** - COMPLETED
|
||||
- ✅ Fixed `__InitList__()` → `__init_list__()`
|
||||
- ✅ Fixed `print_Download_Progress()` → `print_download_progress()`
|
||||
- ✅ Fixed task naming `task3` → `download_progress_task`
|
||||
- ✅ Updated method calls to snake_case
|
||||
- [ ] **PEP8**: Missing type hints on method parameters (lines 1-50)
|
||||
- `search()` missing return type annotation
|
||||
- `get_user_selection()` missing return type annotation
|
||||
- `__init_list__()` missing docstring and type annotations
|
||||
- [ ] **Code Quality**: Class `SeriesApp` duplicates core `SeriesApp` from `src/core/SeriesApp.py`
|
||||
- Consider consolidating or using inheritance
|
||||
- Line 35: `_initialization_count` duplicated state tracking
|
||||
- [ ] **Type Hints**: `display_series()` doesn't validate if `serie.name` is `None` before using it
|
||||
- [ ] **Documentation**: Missing comprehensive docstrings for class methods
|
||||
- [ ] **Import Organization**: Imports not sorted (lines 1-11) - should follow isort convention
|
||||
- [ ] **Error Handling**: `NoKeyFoundException` and `MatchNotFoundError` are bare except classes - need proper inheritance
|
||||
- [ ] **Logging**: Logging configuration at module level should be in centralized config
|
||||
|
||||
#### `src/core/SeriesApp.py`
|
||||
|
||||
- [ ] **Type Hints**: Return type missing on multiple methods:
|
||||
- `ReScan()` method
|
||||
- `_handle_error()` method
|
||||
- `_handle_completion()` method
|
||||
- [ ] **Documentation**: `download_series()` method lacks detailed docstring explaining async callback behavior
|
||||
- [ ] **Global State**: Line 73 - `series_app: Optional[SeriesApp] = None` in `fastapi_app.py` uses global state
|
||||
- Should use dependency injection instead
|
||||
- [ ] **Complexity**: `Scan()` method is complex (80+ lines) - should be broken into smaller methods
|
||||
@ -672,31 +590,12 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
#### `src/core/SerieScanner.py`
|
||||
|
||||
- [ ] **Type Hints**: Line 66 - `folderDict: dict[str, Serie]` uses new dict syntax but Python 3.8 compatibility might be needed
|
||||
- [ ] **Documentation**: `Scan()` method missing return type annotation (line 83+)
|
||||
- [ ] **Code Quality**: `is_null_or_whitespace()` duplicates Python's `str.isspace()` - use built-in instead
|
||||
- [ ] **Error Logging**: Lines 167-182 catch exceptions but only log, don't propagate context
|
||||
- [ ] **Performance**: `__find_mp4_files()` might be inefficient for large directories - add progress callback
|
||||
|
||||
#### `src/core/providers/base_provider.py`
|
||||
|
||||
- [ ] **Type Hints**: All abstract methods lack type annotations:
|
||||
- Line 7: `Search()` missing type hints on parameters
|
||||
- Line 11: `IsLanguage()` parameters not typed
|
||||
- Line 15: `Download()` missing return type annotation
|
||||
- Line 19: `GetSiteKey()` missing return type
|
||||
- Line 23: `GetTitle()` missing return type
|
||||
- Line 27: `get_season_episode_count()` missing return type
|
||||
- [ ] **Docstrings**: No docstrings explaining abstract contract for implementing classes
|
||||
- [ ] **Documentation**: Abstract methods need clear parameter documentation
|
||||
|
||||
#### `src/core/providers/streaming/Provider.py`
|
||||
|
||||
- [ ] **Type Hints**: Line 7 - Return type annotation `(str, [str])` uses invalid syntax
|
||||
- Should be `Tuple[str, List[str]]` with proper imports
|
||||
- [ ] **Documentation**: Abstract method `GetLink()` missing docstring
|
||||
- [ ] **Naming**: `DEFAULT_REQUEST_TIMEOUT` parameter should be type-hinted as `int`
|
||||
|
||||
#### `src/core/providers/aniworld_provider.py`
|
||||
|
||||
- [ ] **Import Organization**: Lines 1-18 - imports not sorted (violates isort)
|
||||
@ -764,9 +663,6 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
#### `src/server/database/service.py`
|
||||
|
||||
- [ ] **Type Hints**: Multiple service methods lack return type annotations:
|
||||
- Line 50 onwards - `create()` should annotate return type as `-> AnimeSeries`
|
||||
- Other CRUD methods need return type annotations
|
||||
- [ ] **Documentation**: Service layer methods need detailed docstrings explaining:
|
||||
- Database constraints
|
||||
- Transaction behavior
|
||||
@ -782,8 +678,6 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
#### `src/server/services/download_service.py`
|
||||
|
||||
- [ ] **Type Hints**: Constructor and methods properly typed - good!
|
||||
- [ ] **Documentation**: Line 45+ - comprehensive docstrings present
|
||||
- [ ] **Performance**: Line 85 - `deque(maxlen=100)` for completed items - is this appropriate for long-running service?
|
||||
- [ ] **Thread Safety**: Uses `ThreadPoolExecutor` but thread-safety of queue operations not clear
|
||||
|
||||
@ -793,7 +687,6 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
- "TODO: Implement rate limiting logic"
|
||||
- "TODO: Implement request logging logic"
|
||||
- Create separate task items for these
|
||||
- [ ] **Documentation**: `CommonQueryParams` class at line 192 lacks docstring
|
||||
|
||||
#### `src/server/utils/system.py`
|
||||
|
||||
@ -804,33 +697,18 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
|
||||
- [ ] **Error Handling**: Lines 35-39 - Multiple bare `except Exception` handlers
|
||||
- Need specific exception types and proper logging
|
||||
- [ ] **Type Hints**: `get_anime()` missing return type annotation
|
||||
- [ ] **Code Quality**: Lines 32-36 - Complex property access with `getattr()` chains
|
||||
- Create helper function or model method to encapsulate
|
||||
- [ ] **Documentation**: Endpoint docstrings are minimal
|
||||
|
||||
---
|
||||
|
||||
### Models and Pydantic Issues
|
||||
|
||||
#### `src/server/models/auth.py`
|
||||
|
||||
- [ ] **Documentation**: Models well-documented - ✅
|
||||
- [ ] **Type Hints**: All properly annotated - ✅
|
||||
|
||||
#### `src/server/models/anime.py`
|
||||
|
||||
- [ ] Need to review for type hints and docstrings
|
||||
|
||||
#### `src/server/models/config.py`
|
||||
|
||||
- [ ] **Error Handling**: Line 93 - `ValidationError` caught but only silently passed?
|
||||
- Should log or re-raise with context
|
||||
|
||||
#### `src/server/models/download.py`
|
||||
|
||||
- [ ] Need to review for type hints and docstrings
|
||||
|
||||
---
|
||||
|
||||
### Utility and Configuration Issues
|
||||
@ -921,31 +799,8 @@ conda run -n AniWorld python -m pytest tests/ -v -s
|
||||
- [ ] Sort imports in `src/core/providers/aniworld_provider.py` using isort
|
||||
- [ ] Sort imports in `src/core/providers/enhanced_provider.py` using isort
|
||||
|
||||
### Type Hints - Phase 1: Core Providers
|
||||
|
||||
- [ ] Add type hints to all parameters in `src/core/providers/base_provider.py` abstract methods
|
||||
- [ ] Fix return type annotation in `src/core/providers/streaming/Provider.py` (use `Tuple[str, List[str]]`)
|
||||
- [ ] Add `@property` type hints to `src/core/providers/aniworld_provider.py` class attributes
|
||||
- [ ] Add type hints to `src/core/providers/enhanced_provider.py` constructor parameters
|
||||
|
||||
### Type Hints - Phase 2: Services and API
|
||||
|
||||
- [ ] Add return type annotations to methods in `src/server/services/download_service.py`
|
||||
- [ ] Add return type annotations to methods in `src/server/services/auth_service.py`
|
||||
- [ ] Add return type annotations to endpoints in `src/server/api/anime.py`
|
||||
- [ ] Add type hints to dependency functions in `src/server/utils/dependencies.py`
|
||||
|
||||
### Type Hints - Phase 3: CLI and Core
|
||||
|
||||
- [ ] Add type hints to methods in `src/cli/Main.py`
|
||||
- [ ] Add return type annotations to methods in `src/core/SeriesApp.py`
|
||||
- [ ] Add return type annotations to methods in `src/core/SerieScanner.py`
|
||||
|
||||
### Documentation - Phase 1: Critical Sections
|
||||
|
||||
- [ ] Add comprehensive docstring to `src/core/SeriesApp.Scan()` method
|
||||
- [ ] Document abstract method contracts in `src/core/providers/base_provider.py`
|
||||
- [ ] Add docstring to `src/server/utils/dependencies.CommonQueryParams` class
|
||||
- [ ] Document database transaction behavior in `src/server/database/service.py`
|
||||
|
||||
### Documentation - Phase 2: Endpoints
|
||||
|
||||
@ -1,3 +1,9 @@
|
||||
"""Command-line interface for the Aniworld anime download manager.
|
||||
|
||||
This module provides an interactive CLI for searching, selecting, and
|
||||
downloading anime series. It coordinates between the SerieScanner for
|
||||
finding missing episodes and the provider loaders for downloading content.
|
||||
"""
|
||||
import logging
|
||||
import os
|
||||
import time
|
||||
|
||||
@ -545,7 +545,7 @@ class SeriesApp:
|
||||
"""Check if the current operation has been cancelled."""
|
||||
return self._cancel_flag
|
||||
|
||||
def _handle_error(self, error: Exception):
|
||||
def _handle_error(self, error: Exception) -> None:
|
||||
"""
|
||||
Handle errors and notify via callback.
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user