Skip to content

Add labels to Issue and update printer to display them#18

Open
kaar wants to merge 1 commit intomasterfrom
add-issue-labels
Open

Add labels to Issue and update printer to display them#18
kaar wants to merge 1 commit intomasterfrom
add-issue-labels

Conversation

@kaar
Copy link
Copy Markdown
Owner

@kaar kaar commented May 22, 2025

Introduce a Label class and integrate it into the Issue model. Update the display logic to show labels associated with an issue.

@kaar kaar requested a review from Copilot May 22, 2025 18:59
Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request introduces a Label class and integrates it into the Issue model, while also updating the printer to display these labels alongside the issue title.

  • Added a new Label dataclass and updated the Issue dataclass to include labels.
  • Updated GraphQL queries in client.py to retrieve label information and modified printer.py to show labels in the issue title display.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
linear/printer.py Updated title_text to include label display in issue titles.
linear/client.py Introduced Label class, added labels field to Issue, and updated GraphQL queries to fetch label data.

Comment thread linear/printer.py
# Show labels if present
if issue.labels:
label_strs = [
f"{Style.BRIGHT}{Fore.WHITE if not label.color else ''}[{label.name}]{Style.RESET_ALL}"
Copy link

Copilot AI May 22, 2025

Choose a reason for hiding this comment

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

The conditional for displaying a label's color is potentially confusing. If label.color is provided, no color code is applied; consider revisiting the logic or adding a comment to clarify the intended behavior.

Suggested change
f"{Style.BRIGHT}{Fore.WHITE if not label.color else ''}[{label.name}]{Style.RESET_ALL}"
# Use the label's color if provided; otherwise, default to white.
f"{Style.BRIGHT}{label.color if label.color else Fore.WHITE}[{label.name}]{Style.RESET_ALL}"

Copilot uses AI. Check for mistakes.
Comment thread linear/client.py
labels=[
Label.from_dict(label)
for label in issue.get("labels", {}).get("nodes", [])
] if "labels" in issue else None,
Copy link

Copilot AI May 22, 2025

Choose a reason for hiding this comment

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

[nitpick] For consistency in handling collections, consider defaulting the labels field to an empty list instead of None when the key 'labels' is not present. This can simplify later processing of the labels.

Suggested change
] if "labels" in issue else None,
],

Copilot uses AI. Check for mistakes.
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.

2 participants