status-go/geth
Alex Kohler 228bda9fb3 Remove //nolint: gas directives from fmt.Fprintf #590 (#656)
Summary:
Filter out gas linter error checks for fmt.Fprintf commands. This required defining a custom linter around gas that additionally included the offending code.

Notes:

Gas format, without piping it through gometalinter, gives output like this:

$ gas -fmt=csv geth/jail/console/console.go
geth/jail/console/console.go,21,Errors unhandled.,LOW,HIGH,"fmt.Fprintf(w, ""%s: %s"", consoleEventName, formatForConsole(fn.ArgumentList))"
Gometalinter, by default, does not grab the line of code when it filters gas errors. To resolve this, I created a wrapper around gas (I wasn't sure what to call this "gas wrapper", I opted for gasv2, open to other names).

The first part of the regular expression was taken directly from gometalinter (see https://github.com/alecthomas/gometalinter/blob/master/linters.go#L236), and I then appended ,\".*\" to additionally grab the line of code of the offending line. Lastly, I excluded ".*Errors unhandled.*fmt.Fprintf.*" to filter out only fmt.Fprintf errors around omitted errors.

Also as a result of this change, gas lint output will now include the offending code.

Closes #590
2018-02-14 19:58:20 +02:00
..
account Group tests in a dedicated testing package (#629) 2018-02-08 13:52:47 +01:00
api Fix async status api (#663) 2018-02-14 17:32:36 +01:00
common Remove //nolint: gas directives from fmt.Fprintf #590 (#656) 2018-02-14 19:58:20 +02:00
jail Remove //nolint: gas directives from fmt.Fprintf #590 (#656) 2018-02-14 19:58:20 +02:00
log Remove //nolint: gas directives from fmt.Fprintf #590 (#656) 2018-02-14 19:58:20 +02:00
mailservice Enable gometalinter on tests and fix static analysis issues #631 (#644) 2018-02-12 13:16:06 +02:00
node Fix async status api (#663) 2018-02-14 17:32:36 +01:00
notification Update notify interface and mark old one as deprecated 2017-10-24 00:47:09 +03:00
params Enable ethereum metrics collection (#616) 2018-02-05 21:25:40 +02:00
rpc Add a test case to reproduce the issue (#548) 2018-01-11 18:17:41 +01:00
signal Enforce type safety in `NodeCrashEvent` #602 (#607) 2018-02-05 11:37:59 +01:00
transactions Group tests in a dedicated testing package (#629) 2018-02-08 13:52:47 +01:00