mirror of
https://github.com/scratchfoundation/golangci-lint.git
synced 2025-08-28 22:28:43 -04:00
Add versions, improve deprecation system, improve linters page (#1854)
This commit is contained in:
parent
b6a6faa982
commit
8db518cee0
5 changed files with 156 additions and 39 deletions
|
@ -20,6 +20,12 @@ const (
|
|||
PresetUnused = "unused" // Related to the detection of unused code.
|
||||
)
|
||||
|
||||
type Deprecation struct {
|
||||
Since string
|
||||
Message string
|
||||
Replacement string
|
||||
}
|
||||
|
||||
type Config struct {
|
||||
Linter Linter
|
||||
EnabledByDefault bool
|
||||
|
@ -29,11 +35,13 @@ type Config struct {
|
|||
InPresets []string
|
||||
AlternativeNames []string
|
||||
|
||||
OriginalURL string // URL of original (not forked) repo, needed for autogenerated README
|
||||
CanAutoFix bool
|
||||
IsSlow bool
|
||||
DoesChangeTypes bool
|
||||
DeprecatedMessage string
|
||||
OriginalURL string // URL of original (not forked) repo, needed for autogenerated README
|
||||
CanAutoFix bool
|
||||
IsSlow bool
|
||||
DoesChangeTypes bool
|
||||
|
||||
Since string
|
||||
Deprecation *Deprecation
|
||||
}
|
||||
|
||||
func (lc *Config) ConsiderSlow() *Config {
|
||||
|
@ -82,13 +90,22 @@ func (lc *Config) WithChangeTypes() *Config {
|
|||
return lc
|
||||
}
|
||||
|
||||
func (lc *Config) Deprecated(message string) *Config {
|
||||
lc.DeprecatedMessage = message
|
||||
func (lc *Config) WithSince(version string) *Config {
|
||||
lc.Since = version
|
||||
return lc
|
||||
}
|
||||
|
||||
func (lc *Config) Deprecated(message, version, replacement string) *Config {
|
||||
lc.Deprecation = &Deprecation{
|
||||
Since: version,
|
||||
Message: message,
|
||||
Replacement: replacement,
|
||||
}
|
||||
return lc
|
||||
}
|
||||
|
||||
func (lc *Config) IsDeprecated() bool {
|
||||
return lc.DeprecatedMessage != ""
|
||||
return lc.Deprecation != nil
|
||||
}
|
||||
|
||||
func (lc *Config) AllNames() []string {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue