Skip to content

Commit 35d60fc

Browse files
mjunaidcaclaude
andcommitted
fix(cli): resolve all ruff lint errors
- Remove unused Path import from interactive.py - Fix line length issues by shortening error messages - Remove unused variable assignments in tests - Shorten docstring to fit line limit 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent c6a2464 commit 35d60fc

6 files changed

Lines changed: 21 additions & 38 deletions

File tree

packages/cli/src/taskflow/commands/interactive.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
"""
1212

1313
import shlex
14-
from pathlib import Path
1514

1615
from prompt_toolkit import PromptSession
1716
from prompt_toolkit.history import FileHistory

packages/cli/src/taskflow/commands/task.py

Lines changed: 17 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,8 @@ def add_task(
122122
# Validate creator exists
123123
if storage.get_worker(creator) is None:
124124
console.print(
125-
f"[red]Error: Creator '{creator}' not found. Add worker first with 'taskflow worker add'[/red]"
125+
f"[red]Error: Creator '{creator}' not found. "
126+
"Add worker first with 'taskflow worker add'[/red]"
126127
)
127128
raise typer.Exit(1)
128129

@@ -154,9 +155,8 @@ def add_task(
154155
# Validate priority
155156
valid_priorities = ["low", "medium", "high", "critical"]
156157
if priority not in valid_priorities:
157-
console.print(
158-
f"[red]Error: Invalid priority '{priority}'. Must be one of: {', '.join(valid_priorities)}[/red]"
159-
)
158+
opts = ", ".join(valid_priorities)
159+
console.print(f"[red]Error: Invalid priority '{priority}'. Must be one of: {opts}[/red]")
160160
raise typer.Exit(1)
161161

162162
# Parse due date
@@ -267,7 +267,8 @@ def add_subtask(
267267
# Validate creator exists
268268
if storage.get_worker(creator) is None:
269269
console.print(
270-
f"[red]Error: Creator '{creator}' not found. Add worker first with 'taskflow worker add'[/red]"
270+
f"[red]Error: Creator '{creator}' not found. "
271+
"Add worker first with 'taskflow worker add'[/red]"
271272
)
272273
raise typer.Exit(1)
273274

@@ -287,9 +288,8 @@ def add_subtask(
287288
# Validate priority
288289
valid_priorities = ["low", "medium", "high", "critical"]
289290
if priority not in valid_priorities:
290-
console.print(
291-
f"[red]Error: Invalid priority '{priority}'. Must be one of: {', '.join(valid_priorities)}[/red]"
292-
)
291+
opts = ", ".join(valid_priorities)
292+
console.print(f"[red]Error: Invalid priority '{priority}'. Must be one of: {opts}[/red]")
293293
raise typer.Exit(1)
294294

295295
# Generate task ID
@@ -334,7 +334,7 @@ def add_subtask(
334334

335335
# Show success message
336336
console.print(
337-
f"[green]✓[/green] Subtask [bold]#{task.id}[/bold] created successfully under parent #{parent_id}"
337+
f"[green]✓[/green] Subtask [bold]#{task.id}[/bold] created under parent #{parent_id}"
338338
)
339339
console.print(f" Title: {task.title}")
340340
console.print(f" Project: [cyan]{task.project_slug}[/cyan] (inherited from parent)")
@@ -394,18 +394,16 @@ def list_tasks(
394394
if priority:
395395
valid_priorities = ["low", "medium", "high", "critical"]
396396
if priority not in valid_priorities:
397-
console.print(
398-
f"[red]Error: Invalid priority '{priority}'. Must be one of: {', '.join(valid_priorities)}[/red]"
399-
)
397+
opts = ", ".join(valid_priorities)
398+
console.print(f"[red]Error: Invalid priority '{priority}'. Options: {opts}[/red]")
400399
raise typer.Exit(1)
401400

402401
# Validate sort field
403402
if sort:
404403
valid_sort_fields = ["created", "updated", "priority", "due_date"]
405404
if sort not in valid_sort_fields:
406-
console.print(
407-
f"[red]Error: Invalid sort field '{sort}'. Must be one of: {', '.join(valid_sort_fields)}[/red]"
408-
)
405+
opts = ", ".join(valid_sort_fields)
406+
console.print(f"[red]Error: Invalid sort field '{sort}'. Must be one of: {opts}[/red]")
409407
raise typer.Exit(1)
410408

411409
# Parse due date filters
@@ -558,17 +556,6 @@ def list_tasks(
558556
# Format assigned
559557
assigned_display = task.assigned_to if task.assigned_to else "-"
560558

561-
# Format title with due date icons
562-
title_display = f"TEST-{task.title}" # TEMPORARY DEBUG
563-
if task.due_date:
564-
days_until_due = (task.due_date.date() - today.date()).days
565-
if days_until_due < 0:
566-
# Overdue - red circle (avoid emoji in tests, use [red] markup instead)
567-
title_display = f"[red]🔴[/red] {task.title}"
568-
elif days_until_due <= 2:
569-
# Due within 2 days - warning (avoid emoji in tests, use [yellow] markup instead)
570-
title_display = f"[yellow]⚠️[/yellow] {task.title}"
571-
572559
# Add row directly without unpacking
573560
if has_due_dates:
574561
if task.due_date:
@@ -901,9 +888,8 @@ def edit_task(
901888
# Validate status
902889
valid_statuses = ["pending", "in_progress", "review", "completed", "blocked"]
903890
if status not in valid_statuses:
904-
console.print(
905-
f"[red]Error: Invalid status '{status}'. Must be one of: {', '.join(valid_statuses)}[/red]"
906-
)
891+
opts = ", ".join(valid_statuses)
892+
console.print(f"[red]Error: Invalid status '{status}'. Must be one of: {opts}[/red]")
907893
raise typer.Exit(1)
908894
task.status = status # type: ignore
909895
changes["status"] = status
@@ -912,9 +898,8 @@ def edit_task(
912898
# Validate priority
913899
valid_priorities = ["low", "medium", "high", "critical"]
914900
if priority not in valid_priorities:
915-
console.print(
916-
f"[red]Error: Invalid priority '{priority}'. Must be one of: {', '.join(valid_priorities)}[/red]"
917-
)
901+
opts = ", ".join(valid_priorities)
902+
console.print(f"[red]Error: Invalid priority '{priority}'. Options: {opts}[/red]")
918903
raise typer.Exit(1)
919904
task.priority = priority # type: ignore
920905
changes["priority"] = priority

packages/cli/src/taskflow/commands/workflow.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,8 @@ def progress_task(
117117
# Validate task is in progress
118118
if task.status != "in_progress":
119119
console.print(
120-
f"[red]Error: Task must be in_progress to update progress (current: {task.status})[/red]"
120+
f"[red]Error: Task must be in_progress to update progress "
121+
f"(current: {task.status})[/red]"
121122
)
122123
raise typer.Exit(1)
123124

packages/cli/tests/test_audit.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ def test_log_action_persisted(self, initialized_taskflow_dir):
150150
storage.add_worker(worker)
151151

152152
# Log action
153-
log = log_action(storage=storage, action="completed", actor_id="@sarah", task_id=1)
153+
log_action(storage=storage, action="completed", actor_id="@sarah", task_id=1)
154154

155155
# Verify persistence
156156
logs = storage.get_audit_logs(task_id=1)

packages/cli/tests/test_demo.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -132,8 +132,6 @@ def test_demo_cleanup_removes_data(self, temp_taskflow):
132132
# The .taskflow directory should still exist (for init)
133133
# but demo workers/tasks should be removed
134134
workers = storage.list_workers()
135-
tasks = storage.list_tasks()
136-
projects = storage.list_projects()
137135

138136
# If cleanup worked, demo-specific data should be gone
139137
# Note: We can't be 100% certain without --no-cleanup, but we can check

packages/cli/tests/test_subtask.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ def test_subtask_progress_rollup_average(self, temp_taskflow):
259259
assert parent_progress == 50
260260

261261
def test_all_subtasks_complete_marks_parent_complete(self, temp_taskflow):
262-
"""Test that when all subtasks complete, parent shows 100% via calculate_subtask_progress."""
262+
"""Test: when all subtasks complete, parent shows 100% via calculate_subtask_progress."""
263263
from taskflow.commands.task import calculate_subtask_progress
264264

265265
# Create parent and subtasks

0 commit comments

Comments
 (0)