diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 9931d74..a332ab5 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -18,13 +18,12 @@ pip install -e ".[dev]"
This project uses several tools to maintain code quality:
-- **Ruff**: Fast Python linter and formatter
-- **Black**: Code formatter
+- **Ruff**: Fast Python linter and formatter (replaces Black, flake8, isort, etc.)
- **MyPy**: Static type checker
#### Ruff
-Ruff is configured via `ruff.toml`. It combines the functionality of multiple linters (flake8, isort, etc.).
+Ruff is configured via `ruff.toml`. It combines the functionality of multiple linters (flake8, isort, Black, etc.) and is used for both linting and formatting.
```bash
# Check for issues
@@ -33,20 +32,11 @@ ruff check .
# Auto-fix issues
ruff check --fix .
-# Format code (alternative to black)
+# Format code
ruff format .
-```
-
-#### Black
-
-Black is configured via `pyproject.toml`.
-```bash
-# Check formatting
-black --check .
-
-# Format code
-black .
+# Check formatting without making changes
+ruff format --check .
```
#### MyPy
@@ -163,12 +153,12 @@ Add to `.vscode/settings.json`:
{
"python.linting.enabled": true,
"python.linting.ruffEnabled": true,
- "python.formatting.provider": "black",
"editor.formatOnSave": true,
"[python]": {
- "editor.defaultFormatter": "ms-python.black-formatter",
+ "editor.defaultFormatter": "charliermarsh.ruff",
"editor.codeActionsOnSave": {
- "source.organizeImports": true
+ "source.organizeImports": true,
+ "source.fixAll": true
}
}
}
@@ -177,13 +167,13 @@ Add to `.vscode/settings.json`:
#### PyCharm
1. Install Ruff plugin
-2. Configure Black as formatter
+2. Configure Ruff as formatter and linter
3. Enable MyPy inspection
## Configuration Files
-- `ruff.toml` - Ruff linter configuration
-- `pyproject.toml` - Black, MyPy, and project metadata
+- `ruff.toml` - Ruff linter and formatter configuration
+- `pyproject.toml` - MyPy and project metadata
- `.mypy.ini` - MyPy type checker configuration
- `.pre-commit-config.yaml` - Pre-commit hooks configuration
- `pytest.ini` - Pytest test configuration
diff --git a/PLAN.md b/PLAN.md
index 250f239..a6714f6 100644
--- a/PLAN.md
+++ b/PLAN.md
@@ -1,103 +1,103 @@
-# План работ по улучшению проекта
-
-## Структура плана
-Каждая задача включает:
-1. Создание GitHub Issue
-2. Создание ветки `feature/issue-{номер}-{название}`
-3. **Переход на новую ветку** (вручную): `git checkout -b feature/issue-{номер}-{название}`
-4. Реализацию изменений
-5. Тестирование и проверки
-6. Коммит изменений
-7. **Поднять версию** в `pyproject.toml` перед созданием PR (patch version: 7.4.X → 7.4.X+1)
-8. **Push ветки** (вручную): `git push origin feature/issue-{номер}-{название}`
-9. **Создание Pull Request** с веткой `main`/`master`
+# Project Improvement Plan
+
+## Plan Structure
+Each task includes:
+1. Create GitHub Issue
+2. Create branch `feature/issue-{number}-{name}`
+3. **Switch to new branch** (manually): `git checkout -b feature/issue-{number}-{name}`
+4. Implement changes
+5. Testing and verification
+6. Commit changes
+7. **Bump version** in `pyproject.toml` before creating PR (patch version: 7.4.X → 7.4.X+1)
+8. **Push branch** (manually): `git push origin feature/issue-{number}-{name}`
+9. **Create Pull Request** with `main`/`master` branch
---
-## Issue #1: Интеграция с Codecov
+## Issue #1: Codecov Integration
**Title (EN):** Integrate Codecov for coverage reporting
**Description (EN):** Improve Codecov integration in CI/CD pipeline. Currently, Codecov action is present but may not be fully configured. Enhance the integration to ensure proper coverage reporting, add coverage thresholds, and configure Codecov settings for better visibility and reporting.
-### Ветка: `feature/issue-1-integrate-codecov`
-
-### Задачи:
-- [ ] Улучшить настройку Codecov в CI workflow
- - Проверить корректность генерации `coverage.xml`
- - Добавить флаг `--cov-report=xml` в pytest для генерации XML отчета
- - Настроить правильные параметры для codecov-action
- - Добавить токен Codecov (если требуется)
-- [ ] Добавить конфигурацию Codecov
- - Создать `codecov.yml` для настройки поведения Codecov
- - Настроить минимальный порог покрытия
- - Настроить уведомления о падении покрытия
-- [ ] Добавить проверку покрытия в CI
- - Добавить `--cov-fail-under` для проверки минимального покрытия
- - Настроить fail при падении покрытия ниже порога
-- [ ] Обновить документацию
- - Добавить информацию о Codecov в README
- - Добавить ссылку на Codecov dashboard
-
-### По окончанию:
+### Branch: `feature/issue-1-integrate-codecov`
+
+### Tasks:
+- [ ] Improve Codecov configuration in CI workflow
+ - Verify correct generation of `coverage.xml`
+ - Add `--cov-report=xml` flag to pytest for XML report generation
+ - Configure correct parameters for codecov-action
+ - Add Codecov token (if required)
+- [ ] Add Codecov configuration
+ - Create `codecov.yml` to configure Codecov behavior
+ - Set minimum coverage threshold
+ - Configure coverage drop notifications
+- [ ] Add coverage check in CI
+ - Add `--cov-fail-under` for minimum coverage check
+ - Configure fail when coverage drops below threshold
+- [ ] Update documentation
+ - Add Codecov information to README
+ - Add link to Codecov dashboard
+
+### After completion:
```bash
-# Тестирование и проверки
+# Testing and verification
pytest --cov=email_processor --cov-report=xml --cov-report=term-missing
-# Проверить, что coverage.xml создается
-# Проверить, что Codecov получает данные
+# Verify that coverage.xml is created
+# Verify that Codecov receives data
-# Коммит
+# Commit
git add .
git commit -m "ci: integrate Codecov for coverage reporting
Fixes #1"
-# Push и создание PR (вручную)
+# Push and create PR (manually)
git push origin feature/issue-1-integrate-codecov
-# Затем создать Pull Request через GitHub UI или CLI
+# Then create Pull Request via GitHub UI or CLI
```
---
-## Issue #2: Улучшение покрытия тестами до 95%
+## Issue #2: Improve Test Coverage to 95%
**Title (EN):** Improve test coverage to 95%+
**Description (EN):** Increase test coverage from current level to at least 95% by adding comprehensive tests for all modules. This will improve code reliability, maintainability, and ensure better code quality through extensive testing.
-### Ветка: `feature/issue-2-improve-test-coverage-95`
-
-### Задачи:
-- [ ] Провести анализ текущего покрытия
- - Запустить `pytest --cov=email_processor --cov-report=term-missing`
- - Определить модули с низким покрытием
- - Составить список недостающих тестов
-- [ ] Добавить тесты для модулей с низким покрытием
- - Тесты для всех публичных методов и классов
- - Тесты для edge cases и граничных условий
- - Тесты для обработки ошибок
- - Тесты для всех веток кода (if/else, try/except)
-- [ ] Добавить интеграционные тесты
- - Тесты для полного цикла обработки
- - Тесты для взаимодействия между модулями
- - Тесты для реальных сценариев использования
-- [ ] Настроить проверку покрытия в CI
- - Добавить `--cov-fail-under=95` в pytest команду
- - Убедиться, что CI падает при покрытии ниже 95%
-- [ ] Обновить документацию по тестированию
- - Обновить `README_TESTS.md` с информацией о покрытии
- - Добавить инструкции по запуску тестов с покрытием
-
-### Цель покрытия: ≥95%
-
-### По окончанию:
+### Branch: `feature/issue-2-improve-test-coverage-95`
+
+### Tasks:
+- [ ] Analyze current coverage
+ - Run `pytest --cov=email_processor --cov-report=term-missing`
+ - Identify modules with low coverage
+ - Create list of missing tests
+- [ ] Add tests for modules with low coverage
+ - Tests for all public methods and classes
+ - Tests for edge cases and boundary conditions
+ - Tests for error handling
+ - Tests for all code branches (if/else, try/except)
+- [ ] Add integration tests
+ - Tests for full processing cycle
+ - Tests for module interactions
+ - Tests for real-world usage scenarios
+- [ ] Configure coverage check in CI
+ - Add `--cov-fail-under=95` to pytest command
+ - Ensure CI fails when coverage drops below 95%
+- [ ] Update testing documentation
+ - Update `README_TESTS.md` with coverage information
+ - Add instructions for running tests with coverage
+
+### Coverage Goal: ≥95%
+
+### After completion:
```bash
# Тестирование и проверки
pytest --cov=email_processor --cov-report=term-missing --cov-fail-under=95
pre-commit run --all-files
-python -m email_processor --version # Проверка работоспособности
+python -m email_processor --version # Verify functionality
-# Коммит
+# Commit
git add .
git commit -m "test: improve test coverage to 95%+
@@ -110,46 +110,46 @@ git push origin feature/issue-2-improve-test-coverage-95
---
-## Issue #3: Добавление документации проекта (Code of Conduct, License, Security Policy, Templates)
+## Issue #3: Add Project Documentation (Code of Conduct, License, Security Policy, Templates)
**Title (EN):** Add project documentation and templates (Code of Conduct, License, Security Policy, Issue/PR templates)
**Description (EN):** Add essential project documentation files including Code of Conduct, License file, Security Policy, and GitHub templates for issues and pull requests. This will improve project professionalism, provide clear guidelines for contributors, and streamline the contribution process.
-### Ветка: `feature/issue-3-add-project-documentation`
-
-### Задачи:
-- [ ] Добавить LICENSE файл
- - Выбрать лицензию (MIT, Apache 2.0, или другая)
- - Создать `LICENSE` файл с полным текстом лицензии
- - Обновить `pyproject.toml` если нужно (уже указано MIT)
-- [ ] Добавить CODE_OF_CONDUCT.md
- - Использовать Contributor Covenant или создать собственный
- - Добавить информацию о том, как сообщать о нарушениях
- - Добавить контактную информацию
-- [ ] Добавить SECURITY.md (Security Policy)
- - Описать процесс сообщения об уязвимостях
- - Указать поддерживаемые версии
- - Добавить информацию о процессе исправления
- - Создать в `.github/SECURITY.md` или в корне проекта
-- [ ] Создать Issue templates
- - Создать `.github/ISSUE_TEMPLATE/` директорию
- - Добавить шаблон для bug reports (`bug_report.md`)
- - Добавить шаблон для feature requests (`feature_request.md`)
- - Добавить шаблон для вопросов (`question.md`) - опционально
- - Настроить `config.yml` для выбора шаблона
-- [ ] Создать Pull Request template
- - Создать `.github/pull_request_template.md`
- - Добавить секции: описание, тип изменений, проверки, связанные issues
- - Добавить чеклист для проверки перед PR
-
-### По окончанию:
+### Branch: `feature/issue-3-add-project-documentation`
+
+### Tasks:
+- [ ] Add LICENSE file
+ - Choose license (MIT, Apache 2.0, or other)
+ - Create `LICENSE` file with full license text
+ - Update `pyproject.toml` if needed (MIT already specified)
+- [ ] Add CODE_OF_CONDUCT.md
+ - Use Contributor Covenant or create custom one
+ - Add information on how to report violations
+ - Add contact information
+- [ ] Add SECURITY.md (Security Policy)
+ - Describe vulnerability reporting process
+ - Specify supported versions
+ - Add information on fix process
+ - Create in `.github/SECURITY.md` or project root
+- [ ] Create Issue templates
+ - Create `.github/ISSUE_TEMPLATE/` directory
+ - Add template for bug reports (`bug_report.md`)
+ - Add template for feature requests (`feature_request.md`)
+ - Add template for questions (`question.md`) - optional
+ - Configure `config.yml` for template selection
+- [ ] Create Pull Request template
+ - Create `.github/pull_request_template.md`
+ - Add sections: description, change type, checks, related issues
+ - Add checklist for pre-PR verification
+
+### After completion:
```bash
-# Проверка файлов
-# Убедиться, что все файлы созданы и корректны
-# Проверить форматирование Markdown
+# File verification
+# Ensure all files are created and correct
+# Check Markdown formatting
-# Коммит
+# Commit
git add .
git commit -m "docs: add Code of Conduct, License, Security Policy, and templates
@@ -161,9 +161,9 @@ git commit -m "docs: add Code of Conduct, License, Security Policy, and template
Fixes #3"
-# Push и создание PR (вручную)
+# Push and create PR (manually)
git push origin feature/issue-3-add-project-documentation
-# Затем создать Pull Request через GitHub UI или CLI
+# Then create Pull Request via GitHub UI or CLI
```
---
diff --git a/README.md b/README.md
index 9cfd044..4ae05e7 100644
--- a/README.md
+++ b/README.md
@@ -692,15 +692,26 @@ The project uses a modular architecture for better maintainability:
```
email_processor/
+├── cli/ # CLI commands and user interface
+│ ├── commands/ # CLI subcommands (config, imap, passwords, smtp, status)
+│ └── ui.py # UI components and console output
├── config/ # Configuration loading and validation
-├── logging/ # Structured logging setup
-├── imap/ # IMAP operations (client, auth, archive)
-├── processor/ # Email processing logic
+├── imap/ # IMAP operations (client, auth, archive, fetcher, filters)
+├── logging/ # Structured logging setup and formatters
+├── security/ # Security features (encryption, fingerprint, key generation)
+├── smtp/ # SMTP operations (client, sender, config)
├── storage/ # UID storage and file management
-└── utils/ # Utility functions (email, path, disk, etc.)
+└── utils/ # Utility functions (email, path, disk, folder resolver, context)
```
-See `ARCHITECTURE_PROPOSAL.md` for detailed architecture documentation.
+Key modules:
+- **`cli/`**: Command-line interface with subcommands for all operations
+- **`config/`**: YAML configuration loading and validation
+- **`imap/`**: Email fetching, attachment downloading, and archiving
+- **`smtp/`**: Email sending with file tracking
+- **`security/`**: Password encryption and system-based key derivation
+- **`storage/`**: Processed UID tracking and sent file management
+- **`utils/`**: Helper functions for common operations
# 📚 Additional Documentation
diff --git a/README_TESTS.md b/README_TESTS.md
index cc1a96f..3ba10d1 100644
--- a/README_TESTS.md
+++ b/README_TESTS.md
@@ -90,7 +90,9 @@ Modular test structure matching the codebase architecture:
- `test_fetcher_storage.py`: Processed UID storage tests (9 tests)
- `test_fetcher_file_ops.py`: File operations tests (8 tests)
- `test_fetcher_errors.py`: Error handling and edge cases (17 tests)
-- **`tests/unit/processor/`**: Email processing, filtering, and attachment handling tests
+- **`tests/unit/cli/`**: CLI commands and UI tests
+- **`tests/unit/security/`**: Security and encryption tests
+- **`tests/unit/smtp/`**: SMTP sending and file tracking tests
- **`tests/unit/storage/`**: UID storage and file management tests
- **`tests/unit/utils/`**: Utility function tests (email, path, disk, folder resolver)
diff --git a/tests/unit/README.md b/tests/unit/README.md
index e9035c8..b919fb0 100644
--- a/tests/unit/README.md
+++ b/tests/unit/README.md
@@ -1,67 +1,74 @@
-# Структура тестов
+# Test Structure
-Структура тестов соответствует структуре основного проекта `email_processor`:
+Test structure matches the main project `email_processor` structure:
```
tests/unit/
-├── cli/ # Тесты для email_processor/cli/
-│ ├── test_args.py # Тесты для email_processor/cli/args.py
-│ ├── test_ui.py # Тесты для email_processor/cli/ui.py
-│ └── commands/ # Тесты для email_processor/cli/commands/
-│ ├── test_config.py # Тесты для email_processor/cli/commands/config.py
-│ ├── test_passwords.py # Тесты для email_processor/cli/commands/passwords.py
-│ └── test_smtp.py # Тесты для email_processor/cli/commands/smtp.py
-├── config/ # Тесты для email_processor/config/
+├── cli/ # Tests for email_processor/cli/
+│ ├── test_args.py # Tests for email_processor/cli/args.py
+│ ├── test_ui.py # Tests for email_processor/cli/ui.py
+│ ├── test_ui_cliui.py # Tests for CLIUI class
+│ └── commands/ # Tests for email_processor/cli/commands/
+│ ├── test_config.py # Tests for email_processor/cli/commands/config.py
+│ ├── test_imap.py # Tests for email_processor/cli/commands/imap.py
+│ ├── test_passwords.py # Tests for email_processor/cli/commands/passwords.py
+│ ├── test_smtp.py # Tests for email_processor/cli/commands/smtp.py
+│ └── test_status.py # Tests for email_processor/cli/commands/status.py
+├── config/ # Tests for email_processor/config/
│ └── test_loader.py
-├── imap/ # Тесты для email_processor/imap/
+├── imap/ # Tests for email_processor/imap/
│ ├── test_archive.py
│ ├── test_attachments.py
│ ├── test_auth.py
│ ├── test_client.py
│ ├── test_fetcher.py
-│ ├── test_fetcher_base.py # Базовый класс для тестов Fetcher
-│ ├── test_fetcher_header.py # Тесты обработки заголовков
-│ ├── test_fetcher_message.py # Тесты обработки сообщений
-│ ├── test_fetcher_uid.py # Тесты обработки UID
-│ ├── test_fetcher_attachment.py # Тесты обработки вложений
-│ ├── test_fetcher_archive.py # Тесты архивирования
-│ ├── test_fetcher_storage.py # Тесты сохранения обработанных UID
-│ ├── test_fetcher_file_ops.py # Тесты файловых операций
-│ ├── test_fetcher_errors.py # Тесты обработки ошибок
+│ ├── test_fetcher_base.py # Base class for Fetcher tests
+│ ├── test_fetcher_header.py # Header processing tests
+│ ├── test_fetcher_message.py # Message processing tests
+│ ├── test_fetcher_uid.py # UID processing tests
+│ ├── test_fetcher_attachment.py # Attachment processing tests
+│ ├── test_fetcher_archive.py # Archive operation tests
+│ ├── test_fetcher_storage.py # Processed UID storage tests
+│ ├── test_fetcher_file_ops.py # File operations tests
+│ ├── test_fetcher_errors.py # Error handling tests
│ └── test_filters.py
-├── logging/ # Тесты для email_processor/logging/
+├── logging/ # Tests for email_processor/logging/
│ ├── test_formatters.py
│ └── test_setup.py
-├── security/ # Тесты для email_processor/security/
+├── security/ # Tests for email_processor/security/
│ ├── test_encryption.py
│ ├── test_fingerprint.py
│ └── test_key_generator.py
-├── smtp/ # Тесты для email_processor/smtp/
+├── smtp/ # Tests for email_processor/smtp/
│ ├── test_client.py
│ ├── test_sender.py
│ └── test_sent_files_storage.py
-├── storage/ # Тесты для email_processor/storage/
+├── storage/ # Tests for email_processor/storage/
│ ├── test_file_manager.py
│ └── test_uid_storage.py
-├── utils/ # Тесты для email_processor/utils/
+├── utils/ # Tests for email_processor/utils/
│ ├── test_context.py
│ ├── test_disk_utils.py
│ ├── test_email_utils.py
│ ├── test_folder_resolver.py
│ └── test_path_utils.py
-└── test_main.py # Тесты для email_processor/__main__.py
+└── test_main.py # Tests for email_processor/__main__.py
```
-## Соответствие файлов
+## File Mapping
-| Исходный файл проекта | Файл теста |
-|----------------------|------------|
+| Source File | Test File |
+|------------|-----------|
| `email_processor/cli/args.py` | `tests/unit/cli/test_args.py` |
| `email_processor/cli/ui.py` | `tests/unit/cli/test_ui.py` |
| `email_processor/cli/commands/config.py` | `tests/unit/cli/commands/test_config.py` |
+| `email_processor/cli/commands/imap.py` | `tests/unit/cli/commands/test_imap.py` |
| `email_processor/cli/commands/passwords.py` | `tests/unit/cli/commands/test_passwords.py` |
| `email_processor/cli/commands/smtp.py` | `tests/unit/cli/commands/test_smtp.py` |
+| `email_processor/cli/commands/status.py` | `tests/unit/cli/commands/test_status.py` |
| `email_processor/__main__.py` | `tests/unit/test_main.py` |
-| `email_processor/imap/fetcher.py` | `tests/unit/imap/test_fetcher.py`
`tests/unit/imap/test_fetcher_*.py` (дополнительные тесты) |
+| `email_processor/imap/fetcher.py` | `tests/unit/imap/test_fetcher.py`
`tests/unit/imap/test_fetcher_*.py` (additional tests) |
| `email_processor/imap/attachments.py` | `tests/unit/imap/test_attachments.py` |
| `email_processor/imap/filters.py` | `tests/unit/imap/test_filters.py` |
+| `email_processor/security/encryption.py` | `tests/unit/security/test_encryption.py` |
+| `email_processor/smtp/sender.py` | `tests/unit/smtp/test_sender.py` |