Skip to content

Commit

Permalink
Clean up some colourizing switch statements
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Cummer committed Jun 16, 2018
1 parent 66b6947 commit d74c4eb
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 15 deletions.
10 changes: 3 additions & 7 deletions jenkins/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -67,16 +67,12 @@ func (widget *Widget) contentFrom(view *View) string {
}

func (widget *Widget) jobColor(job *Job) string {
var color string

switch job.Color {
case "blue":
color = "green"
return "blue"
case "red":
color = "red"
return "red"
default:
color = "white"
return "white"
}

return color
}
12 changes: 4 additions & 8 deletions jira/widget.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,20 +66,16 @@ func (widget *Widget) contentFrom(searchResult *SearchResult) string {
}

func (widget *Widget) issueTypeColor(issue *Issue) string {
var color string

switch issue.IssueFields.IssueType.Name {
case "Bug":
color = "red"
return "red"
case "Story":
color = "blue"
return "blue"
case "Task":
color = "orange"
return "orange"
default:
color = "white"
return "white"
}

return color
}

func getProjects() []string {
Expand Down

0 comments on commit d74c4eb

Please sign in to comment.