Skip to content

Commit

Permalink
Fix linter failures
Browse files Browse the repository at this point in the history
  • Loading branch information
azeemsgoogle committed Jul 20, 2022
1 parent fe5f107 commit eac6e26
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 9 deletions.
4 changes: 2 additions & 2 deletions github/github.go
Expand Up @@ -20,10 +20,10 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"log"
"net/http"
"net/url"
"os"

"github.com/ossf/scorecard/v4/clients/githubrepo/roundtripper"
sclog "github.com/ossf/scorecard/v4/log"
Expand Down Expand Up @@ -123,7 +123,7 @@ func (c *Client) ParseFromFile(filepath string) (RepoInfo, error) {
var ret RepoInfo

log.Printf("getting repo info from file: %s", filepath)
repoInfo, err := ioutil.ReadFile(filepath)
repoInfo, err := os.ReadFile(filepath)
if err != nil {
return ret, fmt.Errorf("reading GitHub event path: %w", err)
}
Expand Down
9 changes: 6 additions & 3 deletions install/install.go
Expand Up @@ -19,8 +19,8 @@ package install
import (
"context"
"fmt"
"io/ioutil"
"log"
"os"

"github.com/google/go-github/v42/github"

Expand All @@ -42,8 +42,11 @@ var workflowFiles = []string{
// organization.
// TODO(install): Improve description.
// TODO(install): Accept a context instead of setting one.
//nolint:gocognit
// TODO(lint): cognitive complexity 31 of func `Run` is high (> 30) (gocognit).
//
// TODO(lint): cognitive complexity 31 of func `Run` is high (> 30) (gocognit).
//
//nolint:gocognit
func Run(o *options.Options) error {
err := o.Validate()
if err != nil {
Expand All @@ -69,7 +72,7 @@ func Run(o *options.Options) error {
}

// Get yml file into byte array.
workflowContent, err := ioutil.ReadFile(o.ConfigPath)
workflowContent, err := os.ReadFile(o.ConfigPath)
if err != nil {
return fmt.Errorf("reading scorecard workflow file: %w", err)
}
Expand Down
3 changes: 1 addition & 2 deletions signing/signing.go
Expand Up @@ -22,7 +22,6 @@ import (
"encoding/json"
"fmt"
"io"
"io/ioutil"
"net/http"
"net/url"
"os"
Expand Down Expand Up @@ -78,7 +77,7 @@ func GetJSONScorecardResults() ([]byte, error) {
}

// Get json output data from file.
jsonPayload, err := ioutil.ReadFile(os.Getenv(options.EnvInputResultsFile))
jsonPayload, err := os.ReadFile(os.Getenv(options.EnvInputResultsFile))
if err != nil {
return nil, fmt.Errorf("reading scorecard json results from file: %w", err)
}
Expand Down
4 changes: 2 additions & 2 deletions signing/signing_test.go
Expand Up @@ -17,7 +17,7 @@
package signing

import (
"io/ioutil"
"os"
"testing"
)

Expand Down Expand Up @@ -76,7 +76,7 @@ import (
func Test_ProcessSignature(t *testing.T) {
t.Parallel()

jsonPayload, err := ioutil.ReadFile("testdata/results.json")
jsonPayload, err := os.ReadFile("testdata/results.json")
repoName := "ossf-tests/scorecard-action"
repoRef := "refs/heads/main"
accessToken := ""
Expand Down

0 comments on commit eac6e26

Please sign in to comment.