Skip to content

Commit

Permalink
add markdown format as alias for markup
Browse files Browse the repository at this point in the history
  • Loading branch information
reuvenharrison committed Feb 12, 2025
1 parent 04f9c59 commit 72fc958
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 5 deletions.
3 changes: 2 additions & 1 deletion formatters/interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ var formatters = map[Format]Formatter{
FormatJSON: JSONFormatter{},
FormatText: TEXTFormatter{},
FormatMarkup: MarkupFormatter{},
FormatMarkdown: MarkupFormatter{},
FormatSingleLine: SingleLineFormatter{},
FormatHTML: HTMLFormatter{},
FormatGithubActions: GitHubActionsFormatter{},
Expand All @@ -45,7 +46,7 @@ func Lookup(format string, opts FormatterOpts) (Formatter, error) {
return newJSONFormatter(l), nil
case FormatText:
return newTEXTFormatter(l), nil
case FormatMarkup:
case FormatMarkup, FormatMarkdown:
return newMarkupFormatter(l), nil
case FormatSingleLine:
return newSingleLineFormatter(l), nil
Expand Down
6 changes: 4 additions & 2 deletions formatters/interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,12 @@ func TestUnsupportedLookup(t *testing.T) {

func TestDiffOutputFormats(t *testing.T) {
supportedFormats := formatters.SupportedFormatsByContentType(formatters.OutputDiff)
assert.Len(t, supportedFormats, 5)
assert.Len(t, supportedFormats, 6)
assert.Contains(t, supportedFormats, string(formatters.FormatYAML))
assert.Contains(t, supportedFormats, string(formatters.FormatJSON))
assert.Contains(t, supportedFormats, string(formatters.FormatText))
assert.Contains(t, supportedFormats, string(formatters.FormatMarkup))
assert.Contains(t, supportedFormats, string(formatters.FormatMarkdown))
assert.Contains(t, supportedFormats, string(formatters.FormatHTML))
}

Expand All @@ -32,11 +33,12 @@ func TestSummaryOutputFormats(t *testing.T) {

func TestChangelogOutputFormats(t *testing.T) {
supportedFormats := formatters.SupportedFormatsByContentType(formatters.OutputChangelog)
assert.Len(t, supportedFormats, 8)
assert.Len(t, supportedFormats, 9)
assert.Contains(t, supportedFormats, string(formatters.FormatYAML))
assert.Contains(t, supportedFormats, string(formatters.FormatJSON))
assert.Contains(t, supportedFormats, string(formatters.FormatText))
assert.Contains(t, supportedFormats, string(formatters.FormatMarkup))
assert.Contains(t, supportedFormats, string(formatters.FormatMarkdown))
assert.Contains(t, supportedFormats, string(formatters.FormatSingleLine))
assert.Contains(t, supportedFormats, string(formatters.FormatHTML))
assert.Contains(t, supportedFormats, string(formatters.FormatGithubActions))
Expand Down
2 changes: 2 additions & 0 deletions formatters/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const (
FormatJSON Format = "json"
FormatText Format = "text"
FormatMarkup Format = "markup"
FormatMarkdown Format = "markdown"
FormatSingleLine Format = "singleline"
FormatHTML Format = "html"
FormatGithubActions Format = "githubactions"
Expand All @@ -22,6 +23,7 @@ func GetSupportedFormats() []string {
string(FormatJSON),
string(FormatText),
string(FormatMarkup),
string(FormatMarkdown),
string(FormatSingleLine),
string(FormatHTML),
string(FormatGithubActions),
Expand Down
2 changes: 1 addition & 1 deletion formatters/types_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@ import (
)

func TestTypes(t *testing.T) {
require.Equal(t, formatters.GetSupportedFormats(), []string{"yaml", "json", "text", "markup", "singleline", "html", "githubactions", "junit", "sarif"})
require.Equal(t, formatters.GetSupportedFormats(), []string{"yaml", "json", "text", "markup", "markdown", "singleline", "html", "githubactions", "junit", "sarif"})
}
2 changes: 1 addition & 1 deletion internal/viper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ func TestViper_InvalidFormat(t *testing.T) {

cmd := cobra.Command{}

require.EqualError(t, internal.RunViper(&cmd, v), "failed to load config file: invalid format \"invalid\", allowed values: yaml, json, text, markup, singleline, html, githubactions, junit, sarif")
require.EqualError(t, internal.RunViper(&cmd, v), "failed to load config file: invalid format \"invalid\", allowed values: yaml, json, text, markup, markdown, singleline, html, githubactions, junit, sarif")
}

func TestViper_InvalidFailOn(t *testing.T) {
Expand Down

0 comments on commit 72fc958

Please sign in to comment.