Add Go tool
Review Request #10302 — Created Nov. 1, 2018 and discarded
This patch adds a Go Tool to Review Bot for static analysis of Go code.
It makes use of the following two Go commands:
go tool vet
# static code analysis to find possible bugs or suspicious
constructs
gofmt
# formats the code
Manual tests. Successfuly adds issues at the right line numbers.
Description | From | Last Updated |
---|---|---|
E999 SyntaxError: EOL while scanning string literal |
reviewbot | |
F841 local variable 'vet_output' is assigned to but never used |
reviewbot | |
F821 undefined name 'output' |
reviewbot | |
Single quotes. |
brennie | |
No blank line here. |
brennie | |
We might want to make a note that we are using gofmt over go fmt because the former does not … |
brennie | |
In the case of a string that contains single quotes, it is more readable to use double quotes, e.g. "%s's … |
brennie | |
No blank line here. |
brennie | |
I think this is a typo because line.split(':', 1) will always two values if : is in line. Should this … |
brennie | |
This can all be one line. |
david | |
Instead of ignoring all errors, how about just extra_ignore_errors=(2,) |
david | |
This will put all of the "options" into a single argument. Do we want to use settings['vet_options'].split()? |
david | |
Slightly better to do vet_args_list.append(path) |
david | |
The number of = characters should line up with the number of characters in the title: ======= Go Tool ======= |
david | |
Add an additional blank line here. |
david | |
The "note" is probably not necessary. |
david | |
The 'go' between run and go vet can be removed? |
ilaw | |
Should this be using single quotes? |
gojeffcho | |
E202 whitespace before ']' |
reviewbot |
- Commit:
-
0437f12a63e70c4f5451df2ac466e46de23e795a32b2511d6d2f75bda3aece4e796e46f6f961c080
- Diff:
-
Revision 2 (+92)
- Commit:
-
32b2511d6d2f75bda3aece4e796e46f6f961c080935d343aed4b1f6e4ed7a8944c7ac627d6329a90
- Diff:
-
Revision 3 (+92)
Checks run (2 succeeded)
-
-
-
-
We might want to make a note that we are using
gofmt
overgo fmt
because the former does not allow us to specify options that we want to use. -
In the case of a string that contains single quotes, it is more readable to use double quotes, e.g.
"%s's formatting differs from gofmt's"
-
-
I think this is a typo because
line.split(':', 1)
will always two values if:
is in line. Should this sayIf split does not return two values
?Also this should be in the except block.
Comments must be proper sentences.
- Description:
-
~ Add Go tool
~ This patch adds a Go Tool to Review Bot for static analysis of Go code.
+ It makes use of the following two Go commands: + + + + go tool vet
# static code analysis to find possible bugs or suspicious
constructs
+ + + + gofmt
# formats the code
- Testing Done:
-
~ Add more support for the Go language. This patch adds a Go Tool class which
~ Manual tests. Successfuly adds issues at the right line numbers.
- runs two commands on go files: - - - - 1) go tool vet # static code analysis to find possible bugs or suspicious
- constructs - - - - 2) gofmt # formats the code
- Commit:
-
935d343aed4b1f6e4ed7a8944c7ac627d6329a908c4b72e4df9ece1a27c4eb2e7c89a9629b396b50
Checks run (2 succeeded)
- Commit:
-
8c4b72e4df9ece1a27c4eb2e7c89a9629b396b5038c2f2b65e9482fabd5582f97f0c830a1aad633b
Checks run (2 succeeded)
- Commit:
-
38c2f2b65e9482fabd5582f97f0c830a1aad633baa2326d7df0c65f9d2f034b18fd8a1b3d1ddbce8