reviewbot.tools.gofmt¶
Review Bot tool to run go fmt.
Classes
|
Review Bot tool to run go fmt. |
- class GofmtTool(settings=None, **kwargs)[source]¶
Bases:
BaseTool
Review Bot tool to run go fmt.
- version = '1.0'[source]¶
The compatibility version of the tool.
This should only be changed for major breaking updates. It will break compatibility with existing integration configurations, requiring manual updates to those configurations. Any existing configurations referencing the old version will not be run, unless an older version of the tool is being handled through another Review Bot worker providing the older tool.
- Type:
str
- description = 'Checks code for styling using "go fmt".'[source]¶
A short description of the tool.
- Type:
str
- exe_dependencies = ['go'][source]¶
A list of executable tools required by the tool.
Each is the name of an executable on the filesystem, either in the
PATH
or defined in theexe_paths
configuration.These will be checked when the worker starts. If a dependency for a tool is missing, the worker will not enable it.
New in version 3.0: Tools that previously implemented
check_dependencies()
may want to be updated to use this.- Type:
dict
- file_patterns = ['*.go'][source]¶
A list of filename patterns this tool can process.
This is intended for tools that have a fixed list of file extensions or specific filenames they should process. Each entry is a glob file pattern (e.g.,
*.py
,.config/*.xml
,dockerfile
, etc.), and must be lowercase (as filenames will be normalized to lowercase for comparison). Seefnmatch
for pattern rules.Tools can leave this empty to process all files, or can override
get_can_handle_file()
to implement custom logic (e.g., basing matching off a tool’s settings, or providing case-sensitive matches).New in version 3.0.
- Type:
list
ofstr
- ERROR_RE = re.compile('^(.*\\.go):(?P<linenum>\\d+):(?P<column>\\d+): (?P<text>.*)$', re.MULTILINE)[source]¶
- build_base_command(**kwargs)[source]¶
Build the base command line used to review files.
- Parameters:
**kwargs (
dict
, unused) – Additional keyword arguments.- Returns:
The base command line.
- Return type:
list
ofstr
- handle_file(f, path, base_command, **kwargs)[source]¶
Perform a review of a single file.
- Parameters:
f (
reviewbot.processing.review.File
) – The file to process.path (
str
) – The local path to the patched file to review.base_command (
list
ofstr
) – The base command used to run pyflakes.**kwargs (
dict
, unused) – Additional keyword arguments.
- __annotations__ = {}¶