Skip to content

Conversation

@mikejmorgan-ai
Copy link
Member

@mikejmorgan-ai mikejmorgan-ai commented Jan 15, 2026

Closes #609

Summary

Auto-fixed 152 style issues using ruff check --fix.

Changes

  • Import sorting (I001): Organized import blocks
  • Deprecated typing (UP035): typing.Listlist, typing.Dictdict
  • Modern annotations (UP006, UP045): Optional[X]X | None

Files Modified

15 files across the codebase

Remaining

15 issues require manual review (deprecated typing imports still in use)


Bounty: $50 (+ $50 bonus after funding)

🤖 Generated with Claude Code

Summary by CodeRabbit

  • New Features

    • Added a CLI "notify" command with subcommands for configuring and sending notifications.
  • Chores

    • Modernized type annotations across the codebase to modern Python union/generic syntax for clearer typing.
    • Minor refinements to CLI messaging, import ordering, and error handling for consistency and maintainability.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jan 15, 2026

Caution

Review failed

The pull request is closed.

📝 Walkthrough

Walkthrough

Modernizes type hints across many modules to use built-in generics and PEP 604 union syntax; adjusts import ordering in places; broadens a few I/O exception handlers; and adds a new CortexCLI.notify(self, args) CLI method. No substantive runtime logic changes beyond the notify addition and I/O exception widening.

Changes

Cohort / File(s) Summary
Type annotation modernization
cortex/benchmark.py, cortex/branding.py, cortex/gpu_manager.py, cortex/licensing.py, cortex/output_formatter.py, cortex/printer_setup.py, cortex/semver_resolver.py, cortex/systemd_helper.py, cortex/update_checker.py, cortex/updater.py, cortex/version_manager.py, cortex/wifi_driver.py
Replaced typing generics (List, Dict, Tuple, Optional, Generator, etc.) with built-in generics (list, dict, tuple, `X
CLI enhancement
cortex/cli.py
Added new public method notify(self, args) to handle notification subcommands (config, enable, disable, dnd, send) and small CLI text formatting/import reorderings.
Output formatting tweak
cortex/output_formatter.py
Beyond typing updates, print_divider() now renders a divider even when no title is provided (minor behavioral change in rendering).
I/O error handling broadened
cortex/health_score.py, cortex/stdin_handler.py
Broadened caught exceptions from IOError to OSError in history/stdin handling; updated one signature to `dict
Import ordering adjustments
multiple modules (e.g., cortex/benchmark.py, cortex/gpu_manager.py, cortex/systemd_helper.py, etc.)
Reordered imports for linting/consistency (no runtime behavior changes).

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

MVP

Suggested reviewers

  • Suyashd999
  • Anshgrover23

Poem

🐰 I hopped through types and made them neat,

list not List, and unions sweet.
A CLI bell rings, "notify" hops in—
Tiny changes, tidy grins. ✨

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title 'chore: Auto-fix 152 ruff linting issues' clearly and specifically summarizes the main change—automated fixing of linting issues using ruff.
Description check ✅ Passed The description includes a related issue (#609), a clear summary of changes (import sorting, deprecated typing, modern annotations), and implementation details. Most required template sections are adequately addressed.
Linked Issues check ✅ Passed All code changes directly align with issue #609 objectives: import sorting (I001), replacing deprecated typing (UP035/UP006), and modernizing optional syntax (UP045). All 15 modified files demonstrate these fixes consistently.
Out of Scope Changes check ✅ Passed All changes are type annotation updates and import reorganization directly scoped to the linting fixes specified in #609. No unrelated behavioral logic or feature additions were introduced.
Docstring Coverage ✅ Passed Docstring coverage is 87.64% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between d017f97 and 9eed04d.

📒 Files selected for processing (15)
  • cortex/benchmark.py
  • cortex/branding.py
  • cortex/cli.py
  • cortex/gpu_manager.py
  • cortex/health_score.py
  • cortex/licensing.py
  • cortex/output_formatter.py
  • cortex/printer_setup.py
  • cortex/semver_resolver.py
  • cortex/stdin_handler.py
  • cortex/systemd_helper.py
  • cortex/update_checker.py
  • cortex/updater.py
  • cortex/version_manager.py
  • cortex/wifi_driver.py

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @mikejmorgan-ai, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request significantly improves the codebase's adherence to modern Python style and best practices by automatically fixing numerous linting issues. The changes primarily focus on standardizing import order and updating type hints to their contemporary forms, enhancing code readability and maintainability.

Highlights

  • Automated Linting Fixes: Automatically resolved 152 Ruff linting issues across 15 files using ruff check --fix.
  • Import Sorting (I001): Imports have been consistently sorted and grouped according to Ruff's I001 rule, improving code readability.
  • Modernized Type Hinting (UP035, UP006, UP045): Deprecated typing.List and typing.Dict have been replaced with built-in list and dict. Additionally, Optional[X] has been updated to the more modern X | None syntax for clarity and consistency.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a series of automated style fixes using ruff, which significantly improves code consistency and readability across 15 files. The changes primarily focus on modernizing type annotations (e.g., list instead of typing.List, X | None instead of Optional[X]), optimizing import statements, and removing unnecessary f-strings.

My review confirms that all the automated changes are correct and beneficial, adhering to modern Python best practices. The codebase is cleaner and more maintainable as a result. This is a great cleanup effort. Well done!

from rich.table import Table

from cortex.branding import console, cx_print, cx_header, CORTEX_CYAN
from cortex.branding import CORTEX_CYAN, console, cx_header, cx_print
import os
import subprocess
import time
from collections.abc import Callable
from enum import Enum
from pathlib import Path
from typing import Callable, Optional
from typing import Optional
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Generator, List, Optional, Tuple
from typing import Any, List, Optional, Tuple
from enum import Enum
from pathlib import Path
from typing import Callable, Optional
from typing import Optional
with open(self.history_path, "w") as f:
json.dump(history, f, indent=2)
except IOError:
except OSError:
- Sort imports (I001)
- Replace deprecated typing imports (UP035)
- Use modern type annotations (UP006, UP045)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (3)
cortex/benchmark.py (1)

18-18: Unused List, Optional, Tuple imports causing pipeline failure.

The pipeline is failing with UP035 'typing.List' is deprecated. After the type hint modernization, List, Optional, and Tuple are no longer used—only Any is still needed from typing.

Suggested fix
-from typing import Any, List, Optional, Tuple
+from typing import Any
cortex/systemd_helper.py (1)

16-16: Remove unused typing imports from line 16.

All imports (Any, Dict, List, Optional, Tuple) are unused. They appear only in docstring text, not in actual type annotations.

Suggested fix
-from typing import Any, Dict, List, Optional, Tuple
cortex/gpu_manager.py (1)

16-16: Remove all unused typing imports.

All imports on line 16 (Any, Dict, List, Optional, Tuple) are unused after type hint modernization. The codebase now uses PEP 585 and PEP 604 style type hints (lowercase list, dict, tuple, and | for unions).

♻️ Suggested fix
-from typing import Any, Dict, List, Optional, Tuple
🤖 Fix all issues with AI agents
In `@cortex/output_formatter.py`:
- Around line 10-14: Remove deprecated typing imports by deleting List, Tuple,
and Optional from the typing import in cortex/output_formatter.py; if typing.Any
is also unused, remove the entire "from typing import ..." line. Ensure you keep
the valid imports already added (Generator from collections.abc, contextmanager,
dataclass, field, Enum) and only import types that are actually referenced by
functions/classes in this module.
🧹 Nitpick comments (10)
cortex/wifi_driver.py (1)

14-14: Unused Optional import after modernization.

The Optional import is no longer used since find_driver now uses DriverInfo | None syntax. This should be removed as part of the cleanup.

Suggested fix
-from typing import Optional
cortex/stdin_handler.py (1)

17-17: Unused Optional import after modernization.

The Optional import is no longer used since display_stdin_info now uses dict | None syntax.

Suggested fix
-from typing import Optional
cortex/health_score.py (1)

18-18: Unused Optional import.

The Optional import is not used anywhere in this file and should be removed.

Suggested fix
-from typing import Optional
cortex/licensing.py (1)

7-7: Unused Optional import after modernization.

The Optional import is no longer used since all type hints now use X | None syntax.

Suggested fix
-from typing import Optional
cortex/semver_resolver.py (1)

13-13: Unused Optional import after modernization.

The Optional import is no longer used since all type hints now use X | None syntax.

Suggested fix
-from typing import Optional
cortex/version_manager.py (1)

12-12: Unused Optional import after type hint modernization.

The Optional import is no longer used since lines 32-33 now use str | None syntax. This appears to be one of the 15 remaining issues mentioned in the PR description that require manual removal.

Suggested fix
-from typing import Optional
cortex/update_checker.py (1)

15-15: Unused Optional import after type hint modernization.

The Optional import is no longer used since all usages have been converted to X | None union syntax.

Suggested fix
-from typing import Optional
cortex/updater.py (1)

21-21: Unused Optional import after type hint modernization.

The Optional import is no longer used since all usages have been converted to X | None union syntax.

Suggested fix
-from typing import Optional
cortex/branding.py (1)

14-14: Unused imports remain after type hint modernization.

The imports List, Optional, and Tuple from typing are no longer used after converting all type hints to Python 3.9+ built-in generics (list, tuple) and PEP 604 union syntax (X | None). This matches the PR description noting "Fifteen remaining issues require manual review due to deprecated typing imports still in use."

♻️ Suggested fix
-from typing import List, Optional, Tuple
cortex/printer_setup.py (1)

14-14: Unused imports remain after type hint modernization.

The imports Dict, List, Optional, and Tuple from typing are no longer used since all type hints have been converted to built-in generics and union syntax.

♻️ Suggested fix
-from typing import Dict, List, Optional, Tuple
📜 Review details

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 2700bcf and d017f97.

📒 Files selected for processing (15)
  • cortex/benchmark.py
  • cortex/branding.py
  • cortex/cli.py
  • cortex/gpu_manager.py
  • cortex/health_score.py
  • cortex/licensing.py
  • cortex/output_formatter.py
  • cortex/printer_setup.py
  • cortex/semver_resolver.py
  • cortex/stdin_handler.py
  • cortex/systemd_helper.py
  • cortex/update_checker.py
  • cortex/updater.py
  • cortex/version_manager.py
  • cortex/wifi_driver.py
🧰 Additional context used
📓 Path-based instructions (1)
**/*.py

📄 CodeRabbit inference engine (AGENTS.md)

**/*.py: Follow PEP 8 style guide for Python code
Include type hints in Python code
Add docstrings for all public APIs in Python code
Use dry-run mode by default for all installation operations
Do not use silent sudo - require explicit user confirmation for privilege escalation
Implement Firejail sandboxing for execution of untrusted code
Log all operations to ~/.cortex/history.db for audit purposes

Files:

  • cortex/wifi_driver.py
  • cortex/cli.py
  • cortex/update_checker.py
  • cortex/licensing.py
  • cortex/version_manager.py
  • cortex/branding.py
  • cortex/gpu_manager.py
  • cortex/health_score.py
  • cortex/semver_resolver.py
  • cortex/benchmark.py
  • cortex/systemd_helper.py
  • cortex/printer_setup.py
  • cortex/output_formatter.py
  • cortex/updater.py
  • cortex/stdin_handler.py
🧠 Learnings (1)
📓 Common learnings
Learnt from: CR
Repo: cortexlinux/cortex PR: 0
File: AGENTS.md:0-0
Timestamp: 2026-01-12T20:51:13.828Z
Learning: Applies to **/*.py : Include type hints in Python code
🧬 Code graph analysis (6)
cortex/wifi_driver.py (1)
cortex/printer_setup.py (2)
  • find_driver (291-320)
  • DriverInfo (60-66)
cortex/cli.py (4)
cortex/version_manager.py (2)
  • UpdateChannel (18-21)
  • get_version_string (152-154)
cortex/update_checker.py (1)
  • should_notify_update (371-391)
cortex/updater.py (1)
  • UpdateStatus (43-52)
cortex/branding.py (1)
  • cx_print (64-84)
cortex/update_checker.py (1)
cortex/version_manager.py (1)
  • SemanticVersion (26-144)
cortex/gpu_manager.py (3)
cortex/health_score.py (1)
  • _run_command (146-163)
cortex/printer_setup.py (1)
  • _run_command (106-119)
cortex/wifi_driver.py (1)
  • _run_command (193-210)
cortex/benchmark.py (2)
cortex/branding.py (2)
  • cx_header (97-103)
  • cx_print (64-84)
cortex/health_score.py (1)
  • overall_score (95-105)
cortex/updater.py (3)
cortex/progress_indicators.py (1)
  • duration_seconds (77-82)
cortex/cli.py (4)
  • progress_callback (885-892)
  • progress_callback (1243-1247)
  • progress_callback (2378-2384)
  • progress_callback (2411-2418)
cortex/update_checker.py (1)
  • ReleaseInfo (40-98)
🪛 GitHub Actions: CI
cortex/benchmark.py

[error] 18-18: UP035 typing.List is deprecated, use list instead.

🪛 GitHub Check: lint
cortex/output_formatter.py

[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.Tuple is deprecated, use tuple instead


[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.List is deprecated, use list instead

🪛 GitHub Check: Lint
cortex/output_formatter.py

[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.Tuple is deprecated, use tuple instead


[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.List is deprecated, use list instead

⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (3)
  • GitHub Check: test (3.12)
  • GitHub Check: test (3.10)
  • GitHub Check: test (3.11)
🔇 Additional comments (65)
cortex/wifi_driver.py (1)

330-330: LGTM!

The return type annotation modernization to DriverInfo | None is correct and consistent with the same pattern used in cortex/printer_setup.py.

cortex/stdin_handler.py (2)

107-108: LGTM!

Since Python 3.3, IOError is an alias for OSError, so catching only OSError is correct and cleaner.


312-312: LGTM!

The parameter type annotation modernization to dict | None is correct.

cortex/health_score.py (4)

13-13: LGTM!

Importing Callable from collections.abc instead of typing aligns with PEP 585 recommendations for Python 3.9+.


481-482: LGTM!

The exception handling modernization from IOError to OSError is correct. The json.JSONDecodeError is appropriately retained for JSON parsing errors.


501-502: LGTM!

Correct modernization of exception handling.


512-513: LGTM!

Consistent exception handling modernization with JSONDecodeError appropriately retained.

cortex/licensing.py (5)

84-86: LGTM!

The parameter type annotations are correctly modernized to PEP 604 union syntax.


110-110: LGTM!

Module-level type annotation correctly modernized.


254-254: LGTM!

Using a plain string instead of an f-string when no interpolation is needed is a minor cleanup.


295-295: LGTM!

Plain string usage is appropriate here.


306-306: LGTM!

Plain string usage is appropriate here.

cortex/semver_resolver.py (6)

120-121: LGTM!

Dataclass field type annotations correctly modernized to PEP 604 syntax.


187-187: LGTM!

Dataclass field type annotation correctly modernized.


264-264: LGTM!

Return type annotation correctly modernized.


286-286: LGTM!

Return type annotation correctly modernized.


515-517: LGTM!

Return type annotation correctly modernized.


618-618: LGTM!

Parameter type annotation correctly modernized using built-in list generic and PEP 604 union syntax.

cortex/version_manager.py (1)

32-33: LGTM!

The type annotations are correctly modernized to PEP 604 union syntax (str | None).

cortex/update_checker.py (1)

49-50: LGTM!

All type annotations are correctly modernized:

  • str | None for optional fields
  • SemanticVersion | None, ReleaseInfo | None for optional complex types
  • UpdateCheckResult | None for return types

Also applies to: 107-111, 132-132, 371-371

cortex/benchmark.py (1)

23-26: LGTM!

Import reordering and type hint modernization are correct:

  • Built-in list[...] replaces List[...]
  • Built-in tuple[...] replaces Tuple[...]
  • Imports follow proper ordering conventions

Also applies to: 60-60, 63-64, 98-98, 421-421, 466-468

cortex/updater.py (2)

16-16: Good practice: Callable imported from collections.abc.

Using collections.abc.Callable instead of typing.Callable aligns with Python 3.9+ best practices where typing.Callable is deprecated.


62-65: LGTM!

All type annotations are correctly modernized to PEP 604 union syntax and use proper Callable typing.

Also applies to: 84-84, 120-120, 254-254, 468-468

cortex/systemd_helper.py (2)

102-113: LGTM!

Dataclass field annotations are correctly modernized:

  • str | None for optional string fields
  • dict[str, str] for environment mapping
  • list[str] for collection fields
  • Proper use of field(default_factory=...) for mutable defaults

Also applies to: 133-133


153-153: LGTM!

Method signatures correctly modernized:

  • Return types use tuple[...] instead of Tuple[...]
  • Optional returns use ServiceStatus | None
  • Dictionary returns use dict[str, list[str]]

Also applies to: 182-182, 240-240, 297-297, 348-348, 355-355, 473-476

cortex/cli.py (3)

31-34: LGTM - Import reordering applied.

The imports from cortex.update_checker, cortex.updater, and cortex.version_manager have been reorganized, likely for import sorting compliance (I001). The functionality remains unchanged.


1221-1227: LGTM - Minor text formatting updates.

The console output messages for release notes and upgrade instructions are consistent with the rest of the CLI output style.


2548-2549: LGTM - Update notification message.

The startup update notification message formatting is consistent.

cortex/branding.py (5)

142-147: LGTM - Type hints modernized for cx_box.

The title and subtitle parameters now use Python 3.10+ union syntax (str | None) instead of Optional[str].


176-179: LGTM - Type hints modernized for cx_status_box.

The items parameter now uses built-in list[tuple[str, str, str]] instead of List[Tuple[str, str, str]].


223-228: LGTM - Type hints modernized for cx_table.

Parameters updated to use built-in generics and union syntax: list[str], list[list[str]], str | None, list[str] | None.


257-260: LGTM - Type hints modernized for cx_package_table.

The packages parameter now uses list[tuple[str, str, str]].


296-296: LGTM - Type hints modernized for cx_divider.

The title parameter now uses str | None instead of Optional[str].

cortex/printer_setup.py (11)

21-21: LGTM - Import reordering.

Branding imports reorganized for import sorting compliance.


106-119: LGTM - Type hints modernized for _run_command.

The method signature now uses list[str] for cmd and tuple[int, str, str] for the return type.


131-172: LGTM - Type hints modernized for detect_usb_printers.

Return type updated to list[PrinterDevice].


174-199: LGTM - Type hints modernized for detect_network_printers.

Return type updated to list[PrinterDevice].


201-235: LGTM - Type hints modernized for detect_configured_printers.

Return type updated to list[PrinterDevice].


237-268: LGTM - Type hints modernized for detect_scanners.

Return type updated to list[PrinterDevice].


291-320: LGTM - Type hints modernized for find_driver.

Return type updated to DriverInfo | None.


322-334: LGTM - Type hints modernized for get_driver_packages.

Return type updated to list[str].


336-396: LGTM - Type hints modernized for setup_printer.

Parameter driver updated to DriverInfo | None and return type to tuple[bool, str].


398-412: LGTM - Type hints modernized for test_print.

Return type updated to tuple[bool, str].


414-428: LGTM - Type hints modernized for test_scan.

Parameter scanner_uri updated to str | None and return type to tuple[bool, str].

cortex/gpu_manager.py (10)

23-23: LGTM - Import reordering.

Branding imports reorganized for import sorting compliance.


59-68: LGTM - Type hints modernized for GPUState dataclass.

Fields updated: devices: list[GPUDevice] and active_gpu: GPUDevice | None.


79-87: LGTM - Type hints modernized for AppGPUConfig dataclass.

Field updated: env_vars: dict[str, str].


127-144: LGTM - Type hints modernized for HybridGPUManager.__init__ and _run_command.

Instance variable _state and method signature updated to use modern type hints.


146-173: LGTM - Type hints modernized for detect_gpus.

Return type updated to list[GPUDevice].


175-201: LGTM - Type hints modernized for _parse_lspci_line.

Return type updated to GPUDevice | None.


203-231: LGTM - Type hints modernized for _detect_nvidia_gpu.

Return type updated to GPUDevice | None.


295-356: LGTM - Type hints modernized for switch_mode.

Return type updated to tuple[bool, str, str | None].


388-390: LGTM - Type hints modernized for get_battery_estimate.

Return type updated to dict[str, str].


520-524: LGTM - Type hints modernized for run_gpu_manager.

Parameter mode updated to str | None = None.

cortex/output_formatter.py (11)

79-87: LGTM - Type hints modernized for TableColumn dataclass.

Field width updated to int | None.


99-143: LGTM - Type hints modernized for format_box.

Parameters updated: title: str | None, subtitle: str | None, padding: tuple[int, int].


146-196: LGTM - Type hints modernized for format_status_box.

Parameter updated: items: list[StatusInfo].


199-244: LGTM - Type hints modernized for format_table.

Parameters updated: columns: list[TableColumn], rows: list[list[str]], title: str | None, row_styles: list[str] | None.


247-268: LGTM - Type hints modernized for format_package_table.

Parameter updated: packages: list[tuple[str, str, str]].


271-304: LGTM - Type hints modernized for format_dependency_tree.

Parameter updated: title: str | None.


307-339: LGTM - Type hints modernized for spinner_context.

Parameters updated: success_message: str | None, error_message: str | None. Return type correctly uses Generator[Status, None, None] from collections.abc.


354-364: LGTM - Type hints modernized for ProgressTracker.__init__.

Parameter and instance variables updated: total: int | None, _progress: Progress | None, _task_id: TaskID | None.


391-398: LGTM - Type hints modernized for ProgressTracker.update.

Parameter updated: description: str | None.


424-428: LGTM - Type hints modernized for MultiStepProgress.__init__.

Parameter and instance variables updated: steps: list[str], step_status: dict, _live: Live | None. The dict.fromkeys(steps, "pending") initialization is equivalent to the previous dict comprehension.


527-542: LGTM - Type hints modernized for helper functions.

print_status_box, print_table, and print_divider signatures updated to use list[...] and str | None.

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.

Comment on lines +10 to +14
from collections.abc import Generator
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Generator, List, Optional, Tuple
from typing import Any, List, Optional, Tuple
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Static analysis flagged deprecated typing imports.

Per the linting hints, line 14 still imports List and Tuple from typing (UP035: deprecated). After the type hint modernization, List, Optional, and Tuple are no longer used. The addition of Generator from collections.abc on line 10 is correct.

🔧 Suggested fix
 from collections.abc import Generator
 from contextlib import contextmanager
 from dataclasses import dataclass, field
 from enum import Enum
-from typing import Any, List, Optional, Tuple
+from typing import Any

If Any is also unused, remove the entire import line.

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
from collections.abc import Generator
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from typing import Any, Generator, List, Optional, Tuple
from typing import Any, List, Optional, Tuple
from collections.abc import Generator
from contextlib import contextmanager
from dataclasses import dataclass, field
from enum import Enum
from typing import Any
🧰 Tools
🪛 GitHub Check: lint

[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.Tuple is deprecated, use tuple instead


[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.List is deprecated, use list instead

🪛 GitHub Check: Lint

[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.Tuple is deprecated, use tuple instead


[failure] 14-14: Ruff (UP035)
cortex/output_formatter.py:14:1: UP035 typing.List is deprecated, use list instead

🤖 Prompt for AI Agents
In `@cortex/output_formatter.py` around lines 10 - 14, Remove deprecated typing
imports by deleting List, Tuple, and Optional from the typing import in
cortex/output_formatter.py; if typing.Any is also unused, remove the entire
"from typing import ..." line. Ensure you keep the valid imports already added
(Generator from collections.abc, contextmanager, dataclass, field, Enum) and
only import types that are actually referenced by functions/classes in this
module.

@mikejmorgan-ai mikejmorgan-ai merged commit f14a916 into main Jan 15, 2026
11 of 13 checks passed
@mikejmorgan-ai mikejmorgan-ai deleted the fix/ruff-autofix branch January 15, 2026 12:27
@sonarqubecloud
Copy link

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.

chore: Fix 164 ruff linting warnings (149 auto-fixable)

2 participants