Skip to content

Commit

Permalink
ci: fix linter issues
Browse files Browse the repository at this point in the history
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
  • Loading branch information
caarlos0 committed Oct 9, 2019
1 parent 9423bb2 commit 21843b5
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
3 changes: 2 additions & 1 deletion Makefile
Expand Up @@ -36,7 +36,8 @@ lint:
# TODO: fix lll issues
# TODO: fix funlen issues
# TODO: fix godox issues
./bin/golangci-lint run --tests=false --enable-all --disable=lll --disable funlen --disable godox ./...
# TODO: fix wsl issues
./bin/golangci-lint run --tests=false --enable-all --disable wsl --disable lll --disable funlen --disable godox ./...
./bin/misspell -error **/*
.PHONY: lint

Expand Down
12 changes: 5 additions & 7 deletions internal/pipe/changelog/changelog.go
Expand Up @@ -122,8 +122,8 @@ func sortEntries(ctx *context.Context, entries []string) []string {
var result = make([]string, len(entries))
copy(result, entries)
sort.Slice(result, func(i, j int) bool {
_, imsg := extractCommitInfo(result[i])
_, jmsg := extractCommitInfo(result[j])
var imsg = extractCommitInfo(result[i])
var jmsg = extractCommitInfo(result[j])
if direction == "asc" {
return strings.Compare(imsg, jmsg) < 0
}
Expand All @@ -134,17 +134,15 @@ func sortEntries(ctx *context.Context, entries []string) []string {

func remove(filter *regexp.Regexp, entries []string) (result []string) {
for _, entry := range entries {
_, msg := extractCommitInfo(entry)
if !filter.MatchString(msg) {
if !filter.MatchString(extractCommitInfo(entry)) {
result = append(result, entry)
}
}
return result
}

func extractCommitInfo(line string) (hash, msg string) {
ss := strings.Split(line, " ")
return ss[0], strings.Join(ss[1:], " ")
func extractCommitInfo(line string) string {
return strings.Join(strings.Split(line, " ")[1:], " ")
}

func getChangelog(tag string) (string, error) {
Expand Down
3 changes: 1 addition & 2 deletions internal/pipe/changelog/changelog_test.go
Expand Up @@ -192,8 +192,7 @@ func TestChangelogSort(t *testing.T) {
require.Len(t, entries, len(cfg.Entries))
var changes []string
for _, line := range entries {
_, msg := extractCommitInfo(line)
changes = append(changes, msg)
changes = append(changes, extractCommitInfo(line))
}
require.EqualValues(t, cfg.Entries, changes)
})
Expand Down

0 comments on commit 21843b5

Please sign in to comment.