Skip to content

Commit 47d6ca6

Browse files
jsvisakaralabe
authored andcommitted
all: add whitespace linter (ethereum#25312)
* golangci: typo Signed-off-by: Delweng <delweng@gmail.com> * golangci: add whietspace Signed-off-by: Delweng <delweng@gmail.com> * *: rm whitesapce using golangci-lint Signed-off-by: Delweng <delweng@gmail.com> * cmd/puppeth: revert accidental resurrection Co-authored-by: Péter Szilágyi <peterke@gmail.com>
1 parent 09124e8 commit 47d6ca6

File tree

90 files changed

+12
-164
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+12
-164
lines changed

.golangci.yml

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,16 @@ linters:
2828
- durationcheck
2929
- exportloopref
3030
- gosec
31+
- whitespace
3132

32-
#- structcheck # lots of false positives
33-
#- errcheck #lot of false positives
34-
# - contextcheck
35-
# - errchkjson # lots of false positives
36-
# - errorlint # this check crashes
37-
# - exhaustive # silly check
38-
# - makezero # false positives
39-
# - nilerr # several intentional
33+
# - structcheck # lots of false positives
34+
# - errcheck #lot of false positives
35+
# - contextcheck
36+
# - errchkjson # lots of false positives
37+
# - errorlint # this check crashes
38+
# - exhaustive # silly check
39+
# - makezero # false positives
40+
# - nilerr # several intentional
4041

4142
linters-settings:
4243
gofmt:
@@ -46,9 +47,9 @@ linters-settings:
4647
min-occurrences: 6 # minimum number of occurrences
4748
gosec:
4849
excludes:
49-
- G404 # Use of weak random number generator - lots of FP
50-
- G107 # Potential http request -- those are intentional
51-
- G306 # G306: Expect WriteFile permissions to be 0600 or less
50+
- G404 # Use of weak random number generator - lots of FP
51+
- G107 # Potential http request -- those are intentional
52+
- G306 # G306: Expect WriteFile permissions to be 0600 or less
5253

5354
issues:
5455
exclude-rules:

accounts/abi/bind/base_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ func (mc *mockPendingCaller) PendingCallContract(ctx context.Context, call ether
115115
}
116116

117117
func TestPassingBlockNumber(t *testing.T) {
118-
119118
mc := &mockPendingCaller{
120119
mockCaller: &mockCaller{
121120
codeAtBytes: []byte{1, 2, 3},

accounts/abi/error_handling.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,6 @@ func typeCheck(t Type, value reflect.Value) error {
7373
} else {
7474
return nil
7575
}
76-
7776
}
7877

7978
// typeErr returns a formatted type casting error.

accounts/abi/event_test.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,7 +161,6 @@ func TestEventMultiValueWithArrayUnpack(t *testing.T) {
161161
}
162162

163163
func TestEventTupleUnpack(t *testing.T) {
164-
165164
type EventTransfer struct {
166165
Value *big.Int
167166
}

accounts/abi/reflect.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,6 @@ func mapArgNamesToStructFields(argNames []string, value reflect.Value) (map[stri
220220

221221
// second round ~~~
222222
for _, argName := range argNames {
223-
224223
structFieldName := ToCamelCase(argName)
225224

226225
if structFieldName == "" {

accounts/abi/unpack.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,6 @@ func ReadFixedBytes(t Type, word []byte) (interface{}, error) {
115115

116116
reflect.Copy(array, reflect.ValueOf(word[0:t.Size]))
117117
return array.Interface(), nil
118-
119118
}
120119

121120
// forEachUnpack iteratively unpack elements.

accounts/keystore/keystore_test.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -377,7 +377,6 @@ func TestImportExport(t *testing.T) {
377377
if _, err = ks2.Import(json, "new", "new"); err == nil {
378378
t.Errorf("importing a key twice succeeded")
379379
}
380-
381380
}
382381

383382
// TestImportRace tests the keystore on races.
@@ -402,7 +401,6 @@ func TestImportRace(t *testing.T) {
402401
if _, err := ks2.Import(json, "new", "new"); err != nil {
403402
atomic.AddUint32(&atom, 1)
404403
}
405-
406404
}()
407405
}
408406
wg.Wait()

accounts/keystore/passphrase.go

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,6 @@ func (ks keyStorePassphrase) JoinPath(filename string) string {
138138

139139
// Encryptdata encrypts the data given as 'data' with the password 'auth'.
140140
func EncryptDataV3(data, auth []byte, scryptN, scryptP int) (CryptoJSON, error) {
141-
142141
salt := make([]byte, 32)
143142
if _, err := io.ReadFull(rand.Reader, salt); err != nil {
144143
panic("reading from crypto/rand failed: " + err.Error())
@@ -341,7 +340,6 @@ func getKDFKey(cryptoJSON CryptoJSON, auth string) ([]byte, error) {
341340
r := ensureInt(cryptoJSON.KDFParams["r"])
342341
p := ensureInt(cryptoJSON.KDFParams["p"])
343342
return scrypt.Key(authArray, salt, n, r, p, dkLen)
344-
345343
} else if cryptoJSON.KDF == "pbkdf2" {
346344
c := ensureInt(cryptoJSON.KDFParams["c"])
347345
prf := cryptoJSON.KDFParams["prf"].(string)

accounts/usbwallet/wallet.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -526,7 +526,6 @@ func (w *wallet) signHash(account accounts.Account, hash []byte) ([]byte, error)
526526

527527
// SignData signs keccak256(data). The mimetype parameter describes the type of data being signed
528528
func (w *wallet) SignData(account accounts.Account, mimeType string, data []byte) ([]byte, error) {
529-
530529
// Unless we are doing 712 signing, simply dispatch to signHash
531530
if !(mimeType == accounts.MimetypeTypedData && len(data) == 66 && data[0] == 0x19 && data[1] == 0x01) {
532531
return w.signHash(account, crypto.Keccak256(data))

cmd/clef/main.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -759,7 +759,6 @@ func confirm(text string) bool {
759759
}
760760

761761
func testExternalUI(api *core.SignerAPI) {
762-
763762
ctx := context.WithValue(context.Background(), "remote", "clef binary")
764763
ctx = context.WithValue(ctx, "scheme", "in-proc")
765764
ctx = context.WithValue(ctx, "local", "main")
@@ -859,7 +858,6 @@ func testExternalUI(api *core.SignerAPI) {
859858
expectDeny("signdata - text", err)
860859
}
861860
{ // Sign transaction
862-
863861
api.UI.ShowInfo("Please reject next transaction")
864862
time.Sleep(delay)
865863
data := hexutil.Bytes([]byte{})
@@ -902,7 +900,6 @@ func testExternalUI(api *core.SignerAPI) {
902900
}
903901
result := fmt.Sprintf("Tests completed. %d errors:\n%s\n", len(errs), strings.Join(errs, "\n"))
904902
api.UI.ShowInfo(result)
905-
906903
}
907904

908905
type encryptedSeedStorage struct {
@@ -939,7 +936,6 @@ func decryptSeed(keyjson []byte, auth string) ([]byte, error) {
939936

940937
// GenDoc outputs examples of all structures used in json-rpc communication
941938
func GenDoc(ctx *cli.Context) error {
942-
943939
var (
944940
a = common.HexToAddress("0xdeadbeef000000000000000000000000deadbeef")
945941
b = common.HexToAddress("0x1111111122222222222233333333334444444444")
@@ -1049,7 +1045,6 @@ func GenDoc(ctx *cli.Context) error {
10491045
var tx types.Transaction
10501046
tx.UnmarshalBinary(rlpdata)
10511047
add("OnApproved - SignTransactionResult", desc, &ethapi.SignTransactionResult{Raw: rlpdata, Tx: &tx})
1052-
10531048
}
10541049
{ // User input
10551050
add("UserInputRequest", "Sent when clef needs the user to provide data. If 'password' is true, the input field should be treated accordingly (echo-free)",

0 commit comments

Comments
 (0)