Skip to content

Commit

Permalink
feat: add more labels and backwards compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
seyLu committed Sep 2, 2023
1 parent 6ad04a8 commit fe7c399
Show file tree
Hide file tree
Showing 8 changed files with 188 additions and 21 deletions.
File renamed without changes.
20 changes: 20 additions & 0 deletions labels/affects_labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
- name: 'Affects: Game Assets'
color: '#fbbc9d'
description: Issues relating directly to art and game assets.
- name: 'Affects: Game Logic/Controls'
color: '#fbbc9d'
description: Issues relating directly to game logic and controls.
- name: 'Affects: Game Performance'
color: '#fbbc9d'
description: Issues relating directly to squeezing game performance.
- name: 'Affects: Game Rendering'
color: '#fbbc9d'
description: Issues relating directly to game rendering.
- name: 'Affects: Infra'
color: '#fbbc9d'
description: Related to configuration, automation, CI, etc.
- name: 'Affects: Player Experience'
color: '#fbbc9d'
description: Issues relating directly to game design & player experience.
- name: 'Affects: Project Management'
color: '#fbbc9d'
56 changes: 56 additions & 0 deletions labels/labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
- name: 'Priority: Critical'
color: '#7c0a02'
- name: 'Priority: High'
color: '#b22222'
- name: 'Priority: Medium'
color: '#ff8597'
- name: 'Priority: Low'
color: '#ffccc9'
- name: 'Type: Bug'
color: '#ff9900'
description: Something isn't working.
- name: 'Type: Documentation'
color: '#ff9900'
description: Improvements or additions to documentation.
- name: 'Type: Feature Request'
color: '#ff9900'
description: Issue describes a feature or enhancement we'd like to implement.
- name: 'Type: Question'
color: '#ff9900'
description: This issue doesn't require code. A question needs an answer.
- name: 'Type: Refactor/Clean-up'
color: '#ff9900'
description: Issues related to reorganization/clean-up of data or code (e.g. for
maintainability).
- name: 'Type: Suggestion'
color: '#ff9900'
- name: 'State: Blocked'
color: '#e07bf9'
description: Work has stopped, waiting for something (Info, Dependent fix, etc.
See comments).
- name: 'State: In Review'
color: '#e07bf9'
description: This issue is waiting for review to finish.
- name: 'State: Work In Progress'
color: '#e07bf9'
description: This issue is being actively worked on.
- name: 'Affects: Game Assets'
color: '#fbbc9d'
description: Issues relating directly to art and game assets.
- name: 'Affects: Game Logic/Controls'
color: '#fbbc9d'
description: Issues relating directly to game logic and controls.
- name: 'Affects: Game Performance'
color: '#fbbc9d'
description: Issues relating directly to squeezing game performance.
- name: 'Affects: Game Rendering'
color: '#fbbc9d'
description: Issues relating directly to game rendering.
- name: 'Affects: Infra'
color: '#fbbc9d'
description: Related to configuration, automation, CI, etc.
- name: 'Affects: Player Experience'
color: '#fbbc9d'
description: Issues relating directly to game design & player experience.
- name: 'Affects: Project Management'
color: '#fbbc9d'
4 changes: 2 additions & 2 deletions labels/priority_labels.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
- name: 'Priority: High'
color: '#b22222'
- name: 'Priority: Medium'
color: '#e88a1a'
color: '#ff8597'
- name: 'Priority: Low'
color: '#f1bc31'
color: '#ffccc9'
10 changes: 10 additions & 0 deletions labels/state_labels.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
- name: 'State: Blocked'
color: '#e07bf9'
description: Work has stopped, waiting for something (Info, Dependent fix, etc.
See comments).
- name: 'State: In Review'
color: '#e07bf9'
description: This issue is waiting for review to finish.
- name: 'State: Work In Progress'
color: '#e07bf9'
description: This issue is being actively worked on.
12 changes: 6 additions & 6 deletions labels/type_labels.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
- name: 'Type: Bug'
color: '#d73a4a'
color: '#ff9900'
description: Something isn't working.
- name: 'Type: Documentation'
color: '#a2eeef'
color: '#ff9900'
description: Improvements or additions to documentation.
- name: 'Type: Feature Request'
color: '#e88a1a'
color: '#ff9900'
description: Issue describes a feature or enhancement we'd like to implement.
- name: 'Type: Question'
color: '#d876e3'
color: '#ff9900'
description: This issue doesn't require code. A question needs an answer.
- name: 'Type: Refactor/Clean-up'
color: '#a0855b'
color: '#ff9900'
description: Issues related to reorganization/clean-up of data or code (e.g. for
maintainability).
- name: 'Type: Suggestion'
color: '#ac8daf'
color: '#ff9900'
103 changes: 92 additions & 11 deletions scripts/_dump_labels.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@

@dataclass(frozen=True)
class LABELS:
REMOVE_DEFAULT: tuple[str, ...] = (
_REMOVE: tuple[str, ...] = (
"bug",
"dependencies",
"documentation",
Expand All @@ -46,42 +46,95 @@ class LABELS:
},
{
"name": "Priority: Medium",
"color": "#e88a1a",
"color": "#ff8597",
},
{
"name": "Priority: Low",
"color": "#f1bc31",
"color": "#ffccc9",
},
)
TYPE: tuple[dict[str, str], ...] = (
{
"name": "Type: Bug",
"color": "#d73a4a",
"color": "#ff9900",
"description": "Something isn't working.",
},
{
"name": "Type: Documentation",
"color": "#a2eeef",
"color": "#ff9900",
"description": "Improvements or additions to documentation.",
},
{
"name": "Type: Feature Request",
"color": "#e88a1a",
"color": "#ff9900",
"description": "Issue describes a feature or enhancement we'd like to implement.",
},
{
"name": "Type: Question",
"color": "#d876e3",
"color": "#ff9900",
"description": "This issue doesn't require code. A question needs an answer.",
},
{
"name": "Type: Refactor/Clean-up",
"color": "#a0855b",
"color": "#ff9900",
"description": "Issues related to reorganization/clean-up of data or code (e.g. for maintainability).",
},
{
"name": "Type: Suggestion",
"color": "#ac8daf",
"color": "#ff9900",
},
)
STATE: tuple[dict[str, str], ...] = (
{
"name": "State: Blocked",
"color": "#e07bf9",
"description": "Work has stopped, waiting for something (Info, Dependent fix, etc. See comments).",
},
{
"name": "State: In Review",
"color": "#e07bf9",
"description": "This issue is waiting for review to finish.",
},
{
"name": "State: Work In Progress",
"color": "#e07bf9",
"description": "This issue is being actively worked on.",
},
)
AFFECTS: tuple[dict[str, str], ...] = (
{
"name": "Affects: Game Assets",
"color": "#fbbc9d",
"description": "Issues relating directly to art and game assets.",
},
{
"name": "Affects: Game Logic/Controls",
"color": "#fbbc9d",
"description": "Issues relating directly to game logic and controls.",
},
{
"name": "Affects: Game Performance",
"color": "#fbbc9d",
"description": "Issues relating directly to squeezing game performance.",
},
{
"name": "Affects: Game Rendering",
"color": "#fbbc9d",
"description": "Issues relating directly to game rendering.",
},
{
"name": "Affects: Infra",
"color": "#fbbc9d",
"description": "Related to configuration, automation, CI, etc.",
},
{
"name": "Affects: Player Experience",
"color": "#fbbc9d",
"description": "Issues relating directly to game design & player experience.",
},
{
"name": "Affects: Project Management",
"color": "#fbbc9d",
},
)

Expand Down Expand Up @@ -113,12 +166,22 @@ class LABELS:
if os.path.isfile(file_path):
os.remove(file_path)

# @TODO remove
legacy_labels: tuple[dict[str, str], ...] = ()

for field in LABELS.__dataclass_fields__:
labels = getattr(LABELS, field)
labels: tuple[dict[str, str], ...] | tuple[str, ...] = getattr(LABELS, field)
labels_file: str = os.path.join(LABELS_PATH, f"{field.lower()}_labels.{EXT}")

# @TODO remove
if not (
isinstance(labels, tuple)
and all(isinstance(label, str) for label in labels)
):
legacy_labels += labels # type: ignore

with open(labels_file, "w+") as f:
logging.info(f"Dumping to {labels_file}.")
logging.info(f"Dumping to {f.name}.")

if EXT == "yaml":
print(
Expand All @@ -132,4 +195,22 @@ class LABELS:
elif EXT == "json":
json.dump(labels, f, indent=2)

# backwards compatibility
# @TODO remove
legacy_labels_file: str = os.path.join(LABELS_PATH, f"labels.{EXT}")
with open(legacy_labels_file, "w+") as f:
logging.info(f"Dumping to {f.name}.")

if EXT == "yaml":
print(
yaml.dump(
data=list(legacy_labels),
default_flow_style=False,
sort_keys=False,
),
file=f,
)
elif EXT == "json":
json.dump(legacy_labels, f, indent=2)

logging.info("Finished dumping of labels.")
4 changes: 2 additions & 2 deletions scripts/setup_issue_label.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,12 @@ def validate_env(env: str) -> str:
@dataclass(frozen=True)
class BasePath:
CWD: str = os.path.dirname(__file__)
CONFIG: str = "config"
LABELS: str = "labels"


@dataclass(frozen=True)
class LabelFile:
_BASE_FILE: str = os.path.join(BasePath.CWD, "..", BasePath.CONFIG, "labels")
_BASE_FILE: str = os.path.join(BasePath.CWD, "..", BasePath.LABELS, "labels")
YAML: str = f"{_BASE_FILE}.yaml"
JSON: str = f"{_BASE_FILE}.json"

Expand Down

0 comments on commit fe7c399

Please sign in to comment.