Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Enable some linters that are disabled by default #104

Merged
merged 6 commits into from
Jul 13, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions .github/linters/.golangci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,19 @@
issues:
include:
- EXC0001
- EXC0002
- EXC0003
- EXC0004
- EXC0005
- EXC0006
- EXC0007
- EXC0008
- EXC0009
- EXC0010
- EXC0011
- EXC0012
- EXC0013
- EXC0014
exclude-rules:
- path: /
linters:
Expand All @@ -20,3 +35,6 @@ issues:

linters:
enable-all: true
enable:
- revive
- misspell
4 changes: 2 additions & 2 deletions heap/heap_sort.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ type (
}
)

// HeapSort solves the problem in O(n*Log n) time and O(n) space.
func HeapSort(list []int) []int {
// Sort solves the problem in O(n*Log n) time and O(n) space.
func Sort(list []int) []int {
sorted := []int{}
heap := NewMinHeap()
for _, val := range list {
Expand Down
6 changes: 3 additions & 3 deletions heap/heap_sort_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ import (
)

/*
TestHeapSort tests solution(s) with the following signature and problem description:
TestSort tests solution(s) with the following signature and problem description:

func HeapSort(list []int) []int

Given a list of integers like {3,1,2}, return a sorted set like {1,2,3} using Heap Sort.
*/
func TestHeapSort(t *testing.T) {
func TestSort(t *testing.T) {
tests := []struct {
list []int
sorted []int
Expand All @@ -28,7 +28,7 @@ func TestHeapSort(t *testing.T) {
}

for i, test := range tests {
if got := HeapSort(test.list); !reflect.DeepEqual(got, test.sorted) {
if got := Sort(test.list); !reflect.DeepEqual(got, test.sorted) {
t.Fatalf("Failed test case #%d. Want %v got %v", i, test.sorted, got)
}
}
Expand Down
Loading