Skip to content

feat: standardize exit codes, fix tests, apply pre-commit - #26

Merged
KHolodilin merged 3 commits into
mainfrom
feature/issue-5-standardize-exit-codes
Jan 24, 2026
Merged

feat: standardize exit codes, fix tests, apply pre-commit#26
KHolodilin merged 3 commits into
mainfrom
feature/issue-5-standardize-exit-codes

Conversation

@KHolodilin

@KHolodilin KHolodilin commented Jan 24, 2026

Copy link
Copy Markdown
Owner

Description

Standardize CLI exit codes via a dedicated ExitCode enum, fix two failing tests, apply pre-commit fixes (line endings, ruff-format), and update documentation.

Closes #25

Type of Change

  • New feature (non-breaking change which adds functionality)
  • Bug fix (non-breaking change which fixes an issue)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Performance improvement
  • Test addition or update
  • Other (please describe):

Related Issue

Closes #25

Changes Made

  • Exit codes: Add email_processor.exit_codes.ExitCode enum (SUCCESS, PROCESSING_ERROR, VALIDATION_FAILED, FILE_NOT_FOUND, UNSUPPORTED_FORMAT, WARNINGS_AS_ERRORS, CONFIG_ERROR). CLI commands (config, imap, passwords, smtp, status) and __main__ return ExitCode values instead of raw ints.
  • Tests: Fix test_full_cycle_send_folder (use isolated sent_files_dir, assert SMTP connect on ExitCode.SUCCESS) and test_create_default_config_example_not_found_with_rich_console (expect ExitCode.FILE_NOT_FOUND).
  • Pre-commit: Normalize line endings (mixed-line-ending), ruff-format. All pre-commit hooks pass.
  • Documentation: README key features and Exit Codes section (module ref, IntEnum, common scenarios 1 & 4); PLAN.md Issue chore: upgrade to Python 3.9, improve code quality tools and fix tests #5 marked implemented; exit_codes module docstring "See also" → README § Exit Codes.
  • Scripts / .bat: Updated for subcommands (run, send folder/file), install_context_menu args, run_all_tests cov 95.

Testing

  • All existing tests pass (718 passed, 32 skipped)
  • New tests added for new functionality
  • Manual testing performed (if applicable)
  • Test coverage maintained or improved

Checklist

  • My code follows the project's style guidelines
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any dependent changes have been merged and published
  • Pre-commit hooks pass (pre-commit run --all-files)
  • Code formatting passes (ruff format --check .)
  • Linting passes (ruff check .)

Additional Notes

  • create_default_config returns ExitCode.FILE_NOT_FOUND when the example config is missing; test_create_default_config_example_not_found_with_rich_console was updated accordingly.
  • Full-cycle send_folder test uses an isolated sent_files_dir so it doesn't share sent-file state with other tests (same mock PDF hash could otherwise be marked sent).

- Add email_processor.exit_codes.ExitCode enum (SUCCESS, PROCESSING_ERROR,
  VALIDATION_FAILED, FILE_NOT_FOUND, UNSUPPORTED_FORMAT, etc.)
- CLI commands (config, imap, passwords, smtp, status) and __main__ return
  ExitCode values instead of raw ints
- Fix test_full_cycle_send_folder: use isolated sent_files_dir to avoid
  shared state; assert SMTP connect on ExitCode.SUCCESS
- Fix test_create_default_config_example_not_found_with_rich_console:
  expect ExitCode.FILE_NOT_FOUND (config returns it when example missing)
- Pre-commit: normalize line endings (mixed-line-ending), ruff-format
- Update tests and integration checks for new exit codes
@codecov-commenter

Copy link
Copy Markdown

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

❌ Patch coverage is 97.26027% with 2 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
email_processor/cli/commands/smtp.py 92.30% 1 Missing ⚠️
email_processor/exit_codes.py 94.44% 1 Missing ⚠️

📢 Thoughts on this report? Let us know!

- README: add exit codes to key features; expand Exit Codes section
  (module ref, main/CLI return ExitCode, IntEnum); add 1 and 4 to
  common scenarios
- PLAN.md: mark Issue #5 tasks done, add implemented status and PR #26
- exit_codes: docstring See also -> README § Exit Codes
@KHolodilin KHolodilin mentioned this pull request Jan 24, 2026
12 tasks
- email_processor_run.bat: run 'py -m email_processor run' explicitly

- run_tests.bat: pytest tests/, add REM

- test_email_processor.bat: send folder + recipient env, use run

- install_context_menu: send file + to/config args, Optional Path

- run_all_tests: cov-fail-under 95
@KHolodilin
KHolodilin merged commit 1c9c8d1 into main Jan 24, 2026
17 checks passed
@KHolodilin
KHolodilin deleted the feature/issue-5-standardize-exit-codes branch January 25, 2026 17:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Standardize CLI exit codes

2 participants