reviewbot.tools.rustfmt¶
Review Bot tool to run rustfmt.
Classes
|
Review Bot tool to run rustfmt. |
- class RustfmtTool(settings=None, **kwargs)[source]¶
Bases:
BaseTool
Review Bot tool to run rustfmt.
- 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 that Rust code style matches rustfmt.'[source]¶
A short description of the tool.
- Type:
str
- exe_dependencies = ['rustfmt'][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 = ['*.rs'][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('^error: (?P<text>.*)\\n --> .*?:(?P<linenum>\\d+):(?P<column>\\d+)$', 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 rustfmt.**kwargs (
dict
, unused) – Additional keyword arguments.
- __annotations__ = {}¶