Skip to content

Commit a6711f9

Browse files
committed
chore: rename functions
1 parent 4c5acca commit a6711f9

4 files changed

+16
-16
lines changed

pkg/printers/githubaction.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func NewGitHubAction(w io.Writer) *GitHubAction {
2121

2222
func (p *GitHubAction) Print(issues []result.Issue) error {
2323
for ind := range issues {
24-
_, err := fmt.Fprintln(p.w, formatIssueAsGithub(&issues[ind]))
24+
_, err := fmt.Fprintln(p.w, formatIssueAsGitHub(&issues[ind]))
2525
if err != nil {
2626
return err
2727
}
@@ -30,7 +30,7 @@ func (p *GitHubAction) Print(issues []result.Issue) error {
3030
}
3131

3232
// print each line as: ::error file=app.js,line=10,col=15::Something went wrong
33-
func formatIssueAsGithub(issue *result.Issue) string {
33+
func formatIssueAsGitHub(issue *result.Issue) string {
3434
severity := defaultGithubSeverity
3535
if issue.Severity != "" {
3636
severity = issue.Severity

pkg/printers/githubaction_problem_matchers.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ func (p *GitHubActionProblemMatchers) Print(issues []result.Issue) error {
8888
_, _ = fmt.Fprintln(p.w, "::add-matcher::"+filename)
8989

9090
for ind := range issues {
91-
_, err := fmt.Fprintln(p.w, formatIssueAsGitHub(&issues[ind]))
91+
_, err := fmt.Fprintln(p.w, formatIssueAsProblemMatcher(&issues[ind]))
9292
if err != nil {
9393
return err
9494
}
@@ -136,7 +136,7 @@ func generateProblemMatcher() GHProblemMatchers {
136136
}
137137
}
138138

139-
func formatIssueAsGitHub(issue *result.Issue) string {
139+
func formatIssueAsProblemMatcher(issue *result.Issue) string {
140140
severity := defaultGitHubSeverity
141141
if issue.Severity != "" {
142142
severity = issue.Severity

pkg/printers/githubaction_problem_matchers_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ error path/to/fileb.go:300:9: another issue (linter-b)
6767
assert.Equal(t, expected, buf.String())
6868
}
6969

70-
func Test_formatIssueAsGitHub(t *testing.T) {
70+
func Test_formatIssueAsProblemMatcher(t *testing.T) {
7171
sampleIssue := result.Issue{
7272
FromLinter: "sample-linter",
7373
Text: "some issue",
@@ -78,13 +78,13 @@ func Test_formatIssueAsGitHub(t *testing.T) {
7878
Column: 4,
7979
},
8080
}
81-
require.Equal(t, "error\tpath/to/file.go:10:4:\tsome issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
81+
require.Equal(t, "error\tpath/to/file.go:10:4:\tsome issue (sample-linter)", formatIssueAsProblemMatcher(&sampleIssue))
8282

8383
sampleIssue.Pos.Column = 0
84-
require.Equal(t, "error\tpath/to/file.go:10:\tsome issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
84+
require.Equal(t, "error\tpath/to/file.go:10:\tsome issue (sample-linter)", formatIssueAsProblemMatcher(&sampleIssue))
8585
}
8686

87-
func Test_formatIssueAsGitHub_Windows(t *testing.T) {
87+
func Test_formatIssueAsProblemMatcher_Windows(t *testing.T) {
8888
if runtime.GOOS != "windows" {
8989
t.Skip("Skipping test on non Windows")
9090
}
@@ -99,10 +99,10 @@ func Test_formatIssueAsGitHub_Windows(t *testing.T) {
9999
Column: 4,
100100
},
101101
}
102-
require.Equal(t, "error\tpath/to/file.go:10:4:\tsome issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
102+
require.Equal(t, "error\tpath/to/file.go:10:4:\tsome issue (sample-linter)", formatIssueAsProblemMatcher(&sampleIssue))
103103

104104
sampleIssue.Pos.Column = 0
105-
require.Equal(t, "error\tpath/to/file.go:10:\tsome issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
105+
require.Equal(t, "error\tpath/to/file.go:10:\tsome issue (sample-linter)", formatIssueAsProblemMatcher(&sampleIssue))
106106
}
107107

108108
func Test_generateProblemMatcher(t *testing.T) {

pkg/printers/githubaction_test.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ func TestGitHubAction_Print(t *testing.T) {
5656
assert.Equal(t, expected, buf.String())
5757
}
5858

59-
func Test_formatIssueAsGithub(t *testing.T) {
59+
func Test_formatIssueAsGitHub(t *testing.T) {
6060
sampleIssue := result.Issue{
6161
FromLinter: "sample-linter",
6262
Text: "some issue",
@@ -67,13 +67,13 @@ func Test_formatIssueAsGithub(t *testing.T) {
6767
Column: 4,
6868
},
6969
}
70-
require.Equal(t, "::error file=path/to/file.go,line=10,col=4::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))
70+
require.Equal(t, "::error file=path/to/file.go,line=10,col=4::some issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
7171

7272
sampleIssue.Pos.Column = 0
73-
require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))
73+
require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
7474
}
7575

76-
func Test_formatIssueAsGithub_Windows(t *testing.T) {
76+
func Test_formatIssueAsGitHub_Windows(t *testing.T) {
7777
if runtime.GOOS != "windows" {
7878
t.Skip("Skipping test on non Windows")
7979
}
@@ -88,8 +88,8 @@ func Test_formatIssueAsGithub_Windows(t *testing.T) {
8888
Column: 4,
8989
},
9090
}
91-
require.Equal(t, "::error file=path/to/file.go,line=10,col=4::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))
91+
require.Equal(t, "::error file=path/to/file.go,line=10,col=4::some issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
9292

9393
sampleIssue.Pos.Column = 0
94-
require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGithub(&sampleIssue))
94+
require.Equal(t, "::error file=path/to/file.go,line=10::some issue (sample-linter)", formatIssueAsGitHub(&sampleIssue))
9595
}

0 commit comments

Comments
 (0)