File tree 3 files changed +36
-2
lines changed 3 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -2,6 +2,7 @@ package commands
2
2
3
3
import (
4
4
"fmt"
5
+ "slices"
5
6
"sort"
6
7
"strings"
7
8
@@ -106,8 +107,20 @@ func (c *helpCommand) printPresets() {
106
107
}
107
108
108
109
func printLinters (lcs []* linter.Config ) {
109
- sort .Slice (lcs , func (i , j int ) bool {
110
- return lcs [i ].Name () < lcs [j ].Name ()
110
+ slices .SortFunc (lcs , func (a , b * linter.Config ) int {
111
+ if a .IsDeprecated () && b .IsDeprecated () {
112
+ return strings .Compare (a .Name (), b .Name ())
113
+ }
114
+
115
+ if a .IsDeprecated () {
116
+ return 1
117
+ }
118
+
119
+ if b .IsDeprecated () {
120
+ return - 1
121
+ }
122
+
123
+ return strings .Compare (a .Name (), b .Name ())
111
124
})
112
125
113
126
for _ , lc := range lcs {
Original file line number Diff line number Diff line change 5
5
"os"
6
6
"path/filepath"
7
7
"reflect"
8
+ "slices"
8
9
"sort"
9
10
"strings"
10
11
"unicode"
@@ -53,6 +54,22 @@ func getLintersListMarkdown(enabled bool) string {
53
54
return neededLcs [i ].Name < neededLcs [j ].Name
54
55
})
55
56
57
+ slices .SortFunc (neededLcs , func (a , b * types.LinterWrapper ) int {
58
+ if a .IsDeprecated () && b .IsDeprecated () {
59
+ return strings .Compare (a .Name , b .Name )
60
+ }
61
+
62
+ if a .IsDeprecated () {
63
+ return 1
64
+ }
65
+
66
+ if b .IsDeprecated () {
67
+ return - 1
68
+ }
69
+
70
+ return strings .Compare (a .Name , b .Name )
71
+ })
72
+
56
73
lines := []string {
57
74
"|Name|Description|Presets|AutoFix|Since|" ,
58
75
"|---|---|---|---|---|---|" ,
Original file line number Diff line number Diff line change @@ -45,3 +45,7 @@ type LinterWrapper struct {
45
45
Since string `json:"since,omitempty"`
46
46
Deprecation * Deprecation `json:"deprecation,omitempty"`
47
47
}
48
+
49
+ func (l * LinterWrapper ) IsDeprecated () bool {
50
+ return l .Deprecation != nil
51
+ }
You can’t perform that action at this time.
0 commit comments