mirror of
https://github.com/mgechev/revive.git
synced 2025-11-25 22:12:38 +02:00
refactor: removes get from getters names (#1373)
This commit is contained in:
10
cli/main.go
10
cli/main.go
@@ -101,24 +101,24 @@ var (
|
|||||||
|
|
||||||
var originalUsage = flag.Usage
|
var originalUsage = flag.Usage
|
||||||
|
|
||||||
func getLogo() string {
|
func logo() string {
|
||||||
return color.YellowString(` _ __ _____ _(_)__ _____
|
return color.YellowString(` _ __ _____ _(_)__ _____
|
||||||
| '__/ _ \ \ / / \ \ / / _ \
|
| '__/ _ \ \ / / \ \ / / _ \
|
||||||
| | | __/\ V /| |\ V / __/
|
| | | __/\ V /| |\ V / __/
|
||||||
|_| \___| \_/ |_| \_/ \___|`)
|
|_| \___| \_/ |_| \_/ \___|`)
|
||||||
}
|
}
|
||||||
|
|
||||||
func getCall() string {
|
func call() string {
|
||||||
return color.MagentaString("revive -config c.toml -formatter friendly -exclude a.go -exclude b.go ./...")
|
return color.MagentaString("revive -config c.toml -formatter friendly -exclude a.go -exclude b.go ./...")
|
||||||
}
|
}
|
||||||
|
|
||||||
func getBanner() string {
|
func banner() string {
|
||||||
return fmt.Sprintf(`
|
return fmt.Sprintf(`
|
||||||
%s
|
%s
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
%s
|
%s
|
||||||
`, getLogo(), getCall())
|
`, logo(), call())
|
||||||
}
|
}
|
||||||
|
|
||||||
func buildDefaultConfigPath() string {
|
func buildDefaultConfigPath() string {
|
||||||
@@ -150,7 +150,7 @@ func initConfig() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
flag.Usage = func() {
|
flag.Usage = func() {
|
||||||
fmt.Println(getBanner())
|
fmt.Println(banner())
|
||||||
originalUsage()
|
originalUsage()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -43,7 +43,7 @@ func (*Checkstyle) Format(failures <-chan lint.Failure, config lint.Config) (str
|
|||||||
Severity: severity(config, failure),
|
Severity: severity(config, failure),
|
||||||
RuleName: failure.RuleName,
|
RuleName: failure.RuleName,
|
||||||
}
|
}
|
||||||
fn := failure.GetFilename()
|
fn := failure.Filename()
|
||||||
if issues[fn] == nil {
|
if issues[fn] == nil {
|
||||||
issues[fn] = []issue{}
|
issues[fn] = []issue{}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ func (*Friendly) printHeaderRow(sb *strings.Builder, failure lint.Failure, sever
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (*Friendly) printFilePosition(sb *strings.Builder, failure lint.Failure) {
|
func (*Friendly) printFilePosition(sb *strings.Builder, failure lint.Failure) {
|
||||||
fmt.Fprintf(sb, " %s:%d:%d", failure.GetFilename(), failure.Position.Start.Line, failure.Position.Start.Column)
|
fmt.Fprintf(sb, " %s:%d:%d", failure.Filename(), failure.Position.Start.Line, failure.Position.Start.Column)
|
||||||
}
|
}
|
||||||
|
|
||||||
type statEntry struct {
|
type statEntry struct {
|
||||||
|
|||||||
@@ -27,7 +27,7 @@ func formatFailure(failure lint.Failure, severity lint.Severity) []string {
|
|||||||
if severity == lint.SeverityWarning {
|
if severity == lint.SeverityWarning {
|
||||||
fName = color.YellowString(fURL)
|
fName = color.YellowString(fURL)
|
||||||
}
|
}
|
||||||
return []string{failure.GetFilename(), pos, fName, fString}
|
return []string{failure.Filename(), pos, fName, fString}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Format formats the failures gotten from the lint.
|
// Format formats the failures gotten from the lint.
|
||||||
|
|||||||
@@ -81,7 +81,14 @@ type Failure struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetFilename returns the filename.
|
// GetFilename returns the filename.
|
||||||
|
//
|
||||||
|
// Deprecated: Use [Filename].
|
||||||
func (f *Failure) GetFilename() string {
|
func (f *Failure) GetFilename() string {
|
||||||
|
return f.Filename()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filename returns the filename.
|
||||||
|
func (f *Failure) Filename() string {
|
||||||
return f.Position.Start.Filename
|
return f.Position.Start.Filename
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -75,9 +75,9 @@ func (r *Revive) Lint(patterns ...*LintPattern) (<-chan lint.Failure, error) {
|
|||||||
|
|
||||||
for _, lintpkg := range patterns {
|
for _, lintpkg := range patterns {
|
||||||
if lintpkg.IsExclude() {
|
if lintpkg.IsExclude() {
|
||||||
excludePatterns = append(excludePatterns, lintpkg.GetPattern())
|
excludePatterns = append(excludePatterns, lintpkg.Pattern())
|
||||||
} else {
|
} else {
|
||||||
includePatterns = append(includePatterns, lintpkg.GetPattern())
|
includePatterns = append(includePatterns, lintpkg.Pattern())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,14 @@ func (p *LintPattern) IsExclude() bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// GetPattern - returns the actual pattern
|
// GetPattern - returns the actual pattern
|
||||||
|
//
|
||||||
|
// Deprecated: Use [Pattern].
|
||||||
func (p *LintPattern) GetPattern() string {
|
func (p *LintPattern) GetPattern() string {
|
||||||
|
return p.Pattern()
|
||||||
|
}
|
||||||
|
|
||||||
|
// Pattern - returns the actual pattern
|
||||||
|
func (p *LintPattern) Pattern() string {
|
||||||
return p.pattern
|
return p.pattern
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user