Gofmt Tool for Review Bot
Review Request #11265 — Created Nov. 4, 2020 and submitted
The tool is designed to be a lightweight solution capable of checking
whether a file is correctly formatted or not based ongo fmt
output.
Unfortunately, other go commands such asgo vet
are better suited to
inherit from the RepositoryTool, as they require the ability to check
entire packages to properly test and vet files.
Manual testing was done to confirm that
go fmt
is working correctly.
Description | From | Last Updated |
---|---|---|
This is the user-visible name, so let's use name = 'go fmt' |
david | |
This is short enough that we can fit it all on one line: gofmt_output = execute(['go', 'fmt', path]) |
david | |
If you add rich_text=True to this function call, it should format the go fmt as a code block. |
david | |
I don't think we need the empty line here? |
ceciliawei |
-
-
bot/reviewbot/tools/gofmt.py (Diff revision 1) This is the user-visible name, so let's use
name = 'go fmt'
-
bot/reviewbot/tools/gofmt.py (Diff revision 1) This is short enough that we can fit it all on one line:
gofmt_output = execute(['go', 'fmt', path])
-
bot/reviewbot/tools/gofmt.py (Diff revision 1) If you add
rich_text=True
to this function call, it should format thego fmt
as a code block.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 2 (+54) |
||||
Added Files: |
Checks run (2 succeeded)
Change Summary:
Included try/except just in case the execute command fails. This change is based on feedback that Christian has given me on different Review Bot review requests
Summary: |
|
||||
---|---|---|---|---|---|
Commit: |
|
||||
People: |
|
||||
Diff: |
Revision 3 (+65) |
Checks run (2 succeeded)
Change Summary:
Removed unnecessary blank line.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 4 (+64) |
Checks run (2 succeeded)
Change Summary:
Fixed
logger.exception
formatting.
Commit: |
|
||||
---|---|---|---|---|---|
Diff: |
Revision 5 (+64) |