feat: Added type checking infrastructure and fix type errors
Overview
Added static type checking with mypy and resolved 105+ type errors across the codebase.
Changes Made
Type Checking Setup
- Installed and configured mypy as the type checker
- Created
mypy.iniwith appropriate settings for the project - Added type stubs:
types-openpyxl,types-python-dateutil,types-pytz,pandas-stubs,types-reportlab
Type Annotations Added
-
Projects/file_classifier.py: Addeddict[str, int]type forcounts -
modes/team_leaderboard.py: Addeddict[str, int]type foractivity_map -
gitlab_utils/client.py: Fixed_ZERO_ROWtype withdict[str, Any]
Import Issues Fixed
-
Projects/ directory: Renamed files to match imports
-
complicance_checks.py→compliance_checks.py -
compliance_Service.py→compliance_service.py -
template_checker.py→templates_checker.py
-
- Created
Projects/__init__.pyto make it a proper package - Removed reference to non-existent
vscode_checker
None Handling Fixed
-
gitlab_utils/client.py: Fixedclosed_ataccess with default empty string -
modes/team_leaderboard.py: Fixed None handling in string operations usingor ""
Type Mismatches Fixed
-
scripts/generate_report.py: Changedelementslist type tolist[Flowable] - Added
Flowableimport from reportlab.platypus
Missing Functions Added
-
batch_mode/batch_service.py: Addedprocess_single_project()stub -
batch_mode/export_service.py: Addedprepare_export_data()function -
user_profile/profile_utils.py: Addedsplit_projects()function
Configuration Updates
- Updated
pyproject.toml: Added N999 to ruff ignore list for 'Projects' directory - Created
mypy.ini: Configured ignore_missing_imports for libraries without stubs
Testing
-
ruff check .-✅ All checks passed -
mypy .-✅ Success - no issues found in 87 source files
Notes
- The
Projects/directory uses uppercase naming which triggers ruff N999; ignored via configuration - Some third-party libraries (
nest_asyncio,xlsxwriter) don't have type stubs; configured mypy to skip them