mirror of
https://github.com/ossf/scorecard.git
synced 2024-09-11 08:55:27 +03:00
Fix linter issues (#1472)
Co-authored-by: Azeem Shaikh <azeems@google.com>
This commit is contained in:
parent
f2c57d2590
commit
696553be2d
@ -399,7 +399,7 @@ func validateDockerfileIsPinned(pathfn string, content []byte,
|
||||
// (1): name = <>@sha245:hash
|
||||
// (2): name = XXX where XXX was pinned
|
||||
pinned := pinnedAsNames[name]
|
||||
if pinned || regex.Match([]byte(name)) {
|
||||
if pinned || regex.MatchString(name) {
|
||||
// Record the asName.
|
||||
pinnedAsNames[asName] = true
|
||||
continue
|
||||
@ -420,7 +420,7 @@ func validateDockerfileIsPinned(pathfn string, content []byte,
|
||||
case len(valueList) == 1:
|
||||
name := valueList[0]
|
||||
pinned := pinnedAsNames[name]
|
||||
if !pinned && !regex.Match([]byte(name)) {
|
||||
if !pinned && !regex.MatchString(name) {
|
||||
ret = false
|
||||
dl.Warn3(&checker.LogMessage{
|
||||
Path: pathfn,
|
||||
@ -630,7 +630,7 @@ func validateGitHubActionWorkflow(pathfn string, content []byte,
|
||||
|
||||
// Ensure a hash at least as large as SHA1 is used (40 hex characters).
|
||||
// Example: action-name@hash
|
||||
match := hashRegex.Match([]byte(execAction.Uses.Value))
|
||||
match := hashRegex.MatchString(execAction.Uses.Value)
|
||||
if !match {
|
||||
dl.Warn3(&checker.LogMessage{
|
||||
Path: pathfn, Type: checker.FileTypeSource,
|
||||
|
@ -51,7 +51,7 @@ func BranchProtection(c clients.RepoClient) (checker.BranchProtectionsData, erro
|
||||
}
|
||||
|
||||
// TODO: if this is a sha, get the associated branch. for now, ignore.
|
||||
if commit.Match([]byte(release.TargetCommitish)) {
|
||||
if commit.MatchString(release.TargetCommitish) {
|
||||
continue
|
||||
}
|
||||
|
||||
|
@ -443,7 +443,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
|
||||
// Consider strings that are not URLs as local folders
|
||||
// which are pinned.
|
||||
regex := regexp.MustCompile(`\w+\.\w+/\w+`)
|
||||
if !regex.Match([]byte(pkg)) {
|
||||
if !regex.MatchString(pkg) {
|
||||
return false
|
||||
}
|
||||
// Verify pkg = name@hash
|
||||
@ -453,7 +453,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
|
||||
continue
|
||||
}
|
||||
hash := parts[1]
|
||||
if hashRegex.Match([]byte(hash)) {
|
||||
if hashRegex.MatchString(hash) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
@ -26,7 +26,7 @@ func (s CSVStrings) MarshalCSV() ([]byte, error) {
|
||||
|
||||
// UnmarshalCSV implements []byte -> []string de-serializtion.
|
||||
func (s *CSVStrings) UnmarshalCSV(input []byte) error {
|
||||
if len(input) == 0 || string(input) == "" {
|
||||
if len(input) == 0 {
|
||||
*s = nil
|
||||
return nil
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user