Skip to content

Commit

Permalink
fix: Confusing function name (#152)
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitpokhrel authored Oct 2, 2021
1 parent ee10a7f commit 2a9d4f4
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion internal/cmd/issue/edit/edit.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ func edit(cmd *cobra.Command, args []string) {

body := params.body
if isADF {
body = md.JiraToGithubFlavored(body)
body = md.ToJiraMD(body)
}

er := jira.EditRequest{
Expand Down
2 changes: 1 addition & 1 deletion pkg/jira/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ func (c *Client) getRequestData(req *CreateRequest) *createRequest {

switch v := req.Body.(type) {
case string:
cf.Description = md.JiraToGithubFlavored(v)
cf.Description = md.ToJiraMD(v)
case *adf.ADF:
cf.Description = v
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/jira/issue.go
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,7 @@ type issueCommentRequest struct {
// AddIssueComment adds comment to an issue using POST /issue/{key}/comment endpoint.
// It only supports plain text comments at the moment.
func (c *Client) AddIssueComment(key, comment string) error {
body, err := json.Marshal(&issueCommentRequest{Body: md.JiraToGithubFlavored(comment)})
body, err := json.Marshal(&issueCommentRequest{Body: md.ToJiraMD(comment)})
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/md/md.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import (
bf "github.com/russross/blackfriday/v2"
)

// JiraToGithubFlavored translates Jira flavored markdown to Github flavored markdown.
func JiraToGithubFlavored(jfm string) string {
// ToJiraMD translates CommonMark to Jira flavored markdown.
func ToJiraMD(jfm string) string {
if jfm == "" {
return jfm
}
Expand Down
4 changes: 2 additions & 2 deletions pkg/md/md_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import (
"github.com/stretchr/testify/assert"
)

func TestJiraToGithubFlavored(t *testing.T) {
func TestToJiraMD(t *testing.T) {
jfm := `# H1
Some _Markdown_ text.
Expand Down Expand Up @@ -105,5 +105,5 @@ func main\(\) {
fmt.Println\("hello world"\)
}` + "```\n\n"

assert.Equal(t, expected, JiraToGithubFlavored(jfm))
assert.Equal(t, expected, ToJiraMD(jfm))
}

0 comments on commit 2a9d4f4

Please sign in to comment.