[chore] Fix lint errors (#3218)

* [chore] Fix lint errors under analyzer package

* Fix lint error in source manager test

* Use Sprint instead of Sprintf where appropriate
This commit is contained in:
Miccah 2024-08-14 13:49:24 -07:00 committed by GitHub
parent c381e901cc
commit 3db9ed7c74
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 10 additions and 10 deletions

View file

@ -550,12 +550,12 @@ func printOrgs(tokenJSON HFTokenJSON) {
enterprise := ""
role := ""
if org.IsEnterprise {
enterprise = color.New(color.FgGreen).Sprintf("True")
enterprise = color.New(color.FgGreen).Sprint("True")
} else {
enterprise = "False"
}
if org.Role == "admin" {
role = color.New(color.FgGreen).Sprintf("Admin")
role = color.New(color.FgGreen).Sprint("Admin")
} else {
role = org.Role
}
@ -641,18 +641,18 @@ func printModelsTable(models []Model) {
for _, model := range models {
var name, read, write, private string
if model.Permissions.Read {
read = color.New(color.FgGreen).Sprintf("True")
read = color.New(color.FgGreen).Sprint("True")
} else {
read = "False"
}
if model.Permissions.Write {
write = color.New(color.FgGreen).Sprintf("True")
write = color.New(color.FgGreen).Sprint("True")
} else {
write = "False"
}
if model.Private {
private = color.New(color.FgGreen).Sprintf("True")
name = color.New(color.FgGreen).Sprintf(model.Name)
private = color.New(color.FgGreen).Sprint("True")
name = color.New(color.FgGreen).Sprint(model.Name)
} else {
private = "False"
name = model.Name

View file

@ -157,13 +157,13 @@ func AnalyzePermissions(cfg *config.Config, key string) (*AnalyzerJSON, error) {
meJSON, err := getUserData(cfg, key)
if err != nil {
return nil, fmt.Errorf(err.Error())
return nil, err
}
data.me = meJSON
isAdmin, err := checkAdminKey(cfg, key)
if err != nil {
return nil, fmt.Errorf(err.Error())
return nil, err
}
if isAdmin {
@ -171,7 +171,7 @@ func AnalyzePermissions(cfg *config.Config, key string) (*AnalyzerJSON, error) {
} else {
data.isRestricted = true
if err := analyzeScopes(key); err != nil {
return nil, fmt.Errorf(err.Error())
return nil, err
}
data.perms = getPermissions()
}

View file

@ -207,7 +207,7 @@ func (c *unitChunker) ChunkUnit(ctx context.Context, unit SourceUnit, rep ChunkR
continue
}
if step.err != "" {
if err := rep.ChunkErr(ctx, fmt.Errorf(step.err)); err != nil {
if err := rep.ChunkErr(ctx, fmt.Errorf("%s", step.err)); err != nil {
return err
}
}