Skip to content

Commit

Permalink
fix lint
Browse files Browse the repository at this point in the history
  • Loading branch information
James-Pickett committed Apr 16, 2024
1 parent 42118ef commit 9e914f2
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
4 changes: 1 addition & 3 deletions .golangci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
run:
skip-dirs:
- test-cmds
timeout: 5m

linters:
Expand Down Expand Up @@ -36,4 +34,4 @@ issues:
# False positive: https://github.com/kunwardeep/paralleltest/issues/8.
- linters:
- paralleltest
text: "does not use range value in test Run"
text: "does not use range value in test Run"
2 changes: 1 addition & 1 deletion cross_language_tests/aes_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ func TestAesRuby(t *testing.T) {
{AuthData: mkrand(t, 32), Plaintext: mkrand(t, 1024)},
}

//#nosec G306 -- Need readable files
for _, tt := range tests {
tt := tt
t.Run("", func(t *testing.T) {
Expand All @@ -60,6 +59,7 @@ func TestAesRuby(t *testing.T) {

b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))
})

Expand Down
5 changes: 4 additions & 1 deletion cross_language_tests/boxer_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,6 @@ func TestBoxerRuby(t *testing.T) {
}

// Ruby Decrypt Tests
//#nosec G306 -- Need readable files
for _, message := range testMessages {
message := message

Expand All @@ -93,6 +92,7 @@ func TestBoxerRuby(t *testing.T) {

b, err := msgpack.Marshal(rubyCommand)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(rubyInFile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
Expand Down Expand Up @@ -160,6 +160,7 @@ func TestBoxerRuby(t *testing.T) {
var png bytes.Buffer
pngFile := path.Join(dir, ulid.New()+".png")
require.NoError(t, aliceBoxer.EncodePng(responseTo, message, &png))
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(pngFile, png.Bytes(), 0644))

tests := []boxerCrossTestCase{
Expand Down Expand Up @@ -200,6 +201,7 @@ func TestBoxerRuby(t *testing.T) {
//
b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
Expand Down Expand Up @@ -248,6 +250,7 @@ func TestBoxerRuby(t *testing.T) {

b, err := msgpack.Marshal(rubyCommand)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(rubyInFile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
Expand Down
5 changes: 3 additions & 2 deletions cross_language_tests/challenge_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -225,7 +225,6 @@ func TestChallenge_GoGenerate_RubyRespond(t *testing.T) {
}
}

// #nosec G306 -- Need readable files
func rubyChallengeExec(rubyCmd, dir string, inputData rubyChallengeCmd) ([]byte, error) {
testCaseBytes, err := msgpack.Marshal(inputData)
if err != nil {
Expand All @@ -236,7 +235,9 @@ func rubyChallengeExec(rubyCmd, dir string, inputData rubyChallengeCmd) ([]byte,

inFilePath := filepath.Join(dir, "in")

if err := os.WriteFile(inFilePath, testCaseBytesBase64, 0644); err != nil {
//#nosec G306 -- Need readable files
err = os.WriteFile(inFilePath, testCaseBytesBase64, 0644)
if err != nil {
return nil, err
}

Expand Down
5 changes: 4 additions & 1 deletion cross_language_tests/rsa_cross_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,6 @@ func TestRsaRuby(t *testing.T) {
{Plaintext: mkrand(t, 128)},
}

//#nosec G306 -- Need readable files
for _, tt := range tests {
tt := tt
t.Run("", func(t *testing.T) {
Expand Down Expand Up @@ -72,6 +71,7 @@ func TestRsaRuby(t *testing.T) {

b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

cmd := exec.CommandContext(ctx, "ruby", rsaRB, "decrypt", testfile, path.Join(dir, "ruby-decrypt"))
Expand All @@ -98,6 +98,7 @@ func TestRsaRuby(t *testing.T) {

b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

cmd := exec.CommandContext(ctx, "ruby", rsaRB, "encrypt", testfile, path.Join(dir, "ruby-encrypt"))
Expand Down Expand Up @@ -130,6 +131,7 @@ func TestRsaRuby(t *testing.T) {

b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

cmd := exec.CommandContext(ctx, "ruby", rsaRB, "verify", testfile, path.Join(dir, "ruby-verify"))
Expand Down Expand Up @@ -157,6 +159,7 @@ func TestRsaRuby(t *testing.T) {

b, err := msgpack.Marshal(tt)
require.NoError(t, err)
//#nosec G306 -- Need readable files
require.NoError(t, os.WriteFile(testfile, []byte(base64.StdEncoding.EncodeToString(b)), 0644))

cmd := exec.CommandContext(ctx, "ruby", rsaRB, "sign", testfile, path.Join(dir, "ruby-signed"))
Expand Down

0 comments on commit 9e914f2

Please sign in to comment.