Skip to content

Commit

Permalink
support v3 (#883)
Browse files Browse the repository at this point in the history
  • Loading branch information
laurentsimon committed Aug 23, 2021
1 parent bb70e15 commit d1de6cf
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 4 deletions.
10 changes: 8 additions & 2 deletions checks/binary_artifact.go
Original file line number Diff line number Diff line change
Expand Up @@ -96,12 +96,18 @@ func checkBinaryFileContent(path string, content []byte,
}

if _, ok := binaryFileTypes[t.Extension]; ok {
dl.Warn("binary detected: %s", path)
dl.Warn3(&checker.LogMessage{
Path: path, Type: checker.FileTypeBinary,
Text: "binary detected",
})
*pfound = true
return true, nil
} else if _, ok := binaryFileTypes[strings.ReplaceAll(filepath.Ext(path), ".", "")]; ok {
// Falling back to file based extension.
dl.Warn("binary detected: %s", path)
dl.Warn3(&checker.LogMessage{
Path: path, Type: checker.FileTypeBinary,
Text: "binary detected",
})
*pfound = true
return true, nil
}
Expand Down
8 changes: 6 additions & 2 deletions pkg/scorecard_result.go
Original file line number Diff line number Diff line change
Expand Up @@ -215,11 +215,15 @@ func detailsToString(details []checker.CheckDetail, logLevel zapcore.Level) (str
if v.Type == checker.DetailDebug && logLevel != zapcore.DebugLevel {
continue
}
if v.Msg.Path != "" {
switch {
case v.Msg.Path != "" && v.Msg.Offset != 0:
sa = append(sa, fmt.Sprintf("%s: %s: %s:%d", typeToString(v.Type), v.Msg.Text, v.Msg.Path, v.Msg.Offset))
} else {
case v.Msg.Path != "" && v.Msg.Offset == 0:
sa = append(sa, fmt.Sprintf("%s: %s: %s", typeToString(v.Type), v.Msg.Text, v.Msg.Path))
default:
sa = append(sa, fmt.Sprintf("%s: %s", typeToString(v.Type), v.Msg.Text))
}

default:
if v.Type == checker.DetailDebug && logLevel != zapcore.DebugLevel {
continue
Expand Down

0 comments on commit d1de6cf

Please sign in to comment.