-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: duplicate linter structure to avoid side-effect of the seriali…
…zation
- Loading branch information
Showing
4 changed files
with
70 additions
and
22 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,16 +1,41 @@ | ||
package types | ||
|
||
import "github.com/golangci/golangci-lint/pkg/lint/linter" | ||
import ( | ||
"golang.org/x/tools/go/packages" | ||
) | ||
|
||
type CLIHelp struct { | ||
Enable string `json:"enable"` | ||
Disable string `json:"disable"` | ||
Help string `json:"help"` | ||
} | ||
|
||
type Deprecation struct { | ||
Since string `json:"since,omitempty"` | ||
Message string `json:"message,omitempty"` | ||
Replacement string `json:"replacement,omitempty"` | ||
} | ||
|
||
// LinterWrapper same fields but with struct tags. | ||
// The field Name and Desc are added to have the information about the linter. | ||
// The field Linter is removed (not serializable). | ||
type LinterWrapper struct { | ||
*linter.Config | ||
Name string `json:"name"` // From linter. | ||
Desc string `json:"desc"` // From linter. | ||
|
||
EnabledByDefault bool `json:"enabledByDefault,omitempty"` | ||
|
||
LoadMode packages.LoadMode `json:"loadMode,omitempty"` | ||
|
||
InPresets []string `json:"inPresets,omitempty"` | ||
AlternativeNames []string `json:"alternativeNames,omitempty"` | ||
|
||
OriginalURL string `json:"originalURL,omitempty"` // URL of original (not forked) repo, needed for autogenerated README | ||
Internal bool `json:"internal"` // Internal linters cannot be disabled (ex: typecheck). | ||
CanAutoFix bool `json:"canAutoFix,omitempty"` | ||
IsSlow bool `json:"isSlow"` | ||
DoesChangeTypes bool `json:"doesChangeTypes,omitempty"` | ||
|
||
Name string `json:"name"` | ||
Desc string `json:"desc"` | ||
Since string `json:"since,omitempty"` | ||
Deprecation *Deprecation `json:"deprecation,omitempty"` | ||
} |