reviewbot.tools.pmd¶
Review Bot tool to run PMD.
Classes
|
Review Bot tool to run PMD. |
- class PMDTool(**kwargs)[source]¶
Bases:
JavaToolMixin
,FilePatternsFromSettingMixin
,BaseTool
Review Bot tool to run PMD.
- 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 errors using the PMD source code checker.'[source]¶
A short description of the tool.
- Type:
str
- exe_dependencies = ['java', 'pmd'][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_extensions_setting = 'file_ext'[source]¶
The name of a tool setting for a comma-separated list of extensions.
- Type:
str
- options = [{'name': 'rulesets', 'field_type': 'django.forms.CharField', 'default': '', 'field_options': {'label': 'Rulesets', 'help_text': ('A comma-separated list of rulesets to apply or a ruleset XML configuration, starting with "<?xml"',), 'required': True}, 'widget': {'type': 'django.forms.Textarea', 'attrs': {'cols': 80, 'rows': 10}}}, {'name': 'file_ext', 'field_type': 'django.forms.CharField', 'default': 'java', 'field_options': {'label': 'Scan files', 'help_text': 'Comma-separated list of file extensions to scan. Leave it empty to check all files.', 'required': False}}][source]¶
Configurable options defined for the tool.
Each item in the list is a dictionary representing a form field to display in the Review Board administration UI. Keys include:
field_type
(str
):The full path as a string to a Django form field class to render.
name
(str
):The name/ID of the field. This will map to the key in the settings provided to
handle_files()
andhandle_file()
.default
(object
, optional):The default value for the field.
field_options
(dict
, optional):Additional options to pass to the form field’s constructor.
widget
(dict
, optional):Information on the Django form field widget class used to render the field. This dictionary includes the following keys:
type
(str
):The full path as a string to a Django form field widget class.
attrs
(dict
, optional):A dictionary of attributes passed to the widget’s constructor.
- Type:
list
- property pmd_version: int[source]¶
The version of PMD installed.
- Type:
int
- Raises:
Exception –
The –
- build_base_command(**kwargs)[source]¶
Build the base command line used to review files.
This creates a command line for running PMD that specifies the correct output format and the rulesets (generating a temporary ruleset configuration file, if needed).
- 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
, optional) – The common base command line used for reviewing a file.**kwargs (
dict
, unused) – Additional keyword arguments.
- __annotations__ = {'_base_command': 'list[str]', '_pmd_version': 'Optional[int]'}¶