Skip to content

Commit

Permalink
Fix linter issues (#1472)
Browse files Browse the repository at this point in the history
Co-authored-by: Azeem Shaikh <azeems@google.com>
  • Loading branch information
azeemshaikh38 and azeemsgoogle authored Jan 12, 2022
1 parent f2c57d2 commit 696553b
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions checks/pinned_dependencies.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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,
Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion checks/raw/branch_protection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
4 changes: 2 additions & 2 deletions checks/shell_download_validate.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -453,7 +453,7 @@ func isGoUnpinnedDownload(cmd []string) bool {
continue
}
hash := parts[1]
if hashRegex.Match([]byte(hash)) {
if hashRegex.MatchString(hash) {
return false
}
}
Expand Down
2 changes: 1 addition & 1 deletion cron/data/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down

0 comments on commit 696553b

Please sign in to comment.