Skip to content

Commit

Permalink
[chore] Fix lint errors (#3218)
Browse files Browse the repository at this point in the history
* [chore] Fix lint errors under analyzer package

* Fix lint error in source manager test

* Use Sprint instead of Sprintf where appropriate
  • Loading branch information
mcastorina authored Aug 14, 2024
1 parent c381e90 commit 3db9ed7
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions pkg/analyzer/analyzers/huggingface/huggingface.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions pkg/analyzer/analyzers/openai/openai.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,21 +157,21 @@ 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 {
data.isAdmin = true
} else {
data.isRestricted = true
if err := analyzeScopes(key); err != nil {
return nil, fmt.Errorf(err.Error())
return nil, err
}
data.perms = getPermissions()
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/sources/source_manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
}
Expand Down

0 comments on commit 3db9ed7

Please sign in to comment.