Create a report with annotations from a ReSharper inspections XML, and a corresponding build status with the status of the report.
Add the following snippet to the script section of
your bitbucket-pipelines.yml
file:
script:
- pipe: docker://loremfoobar/resharper-inspections-bitbucket-pipe:1.1.0
variables:
INSPECTIONS_XML_PATH: "<string>"
# BITBUCKET_USERNAME: "<string>" # Optional
# BITBUCKET_APP_PASSWORD: "<string>" # Optional
# CREATE_BUILD_STATUS: "<boolean>" # Optional, default "true"
# INCLUDE_ONLY_ISSUES_IN_DIFF: "<boolean>" # Optional, default "false"
# DEBUG: "<boolean>" # Optional
Variable | Usage |
---|---|
INSPECTIONS_XML_PATH (*) | Path to inspections xml file, relative to current directory. You can use patterns that are supported by DirectoryInfo.GetFiles. |
BITBUCKET_USERNAME | Bitbucket username, required to create build status and to get PR diff. Note that this should be an account name, not the email. |
BITBUCKET_APP_PASSWORD | Bitbucket app password, required to create build status and to get PR diff. |
CREATE_BUILD_STATUS | Whether to create a new build status reflecting the results of the report. Default: true . |
FAIL_WHEN_ISSUES_FOUND | Whether to fail current build step if any issues found. Default: false . |
INCLUDE_ONLY_ISSUES_IN_DIFF | Whether to include only issues found in changes of current PR/commit. Default: false . |
DEBUG | Turn on extra debug information. Default: false . |
(*) = required variable.
You need to create the inspections XML file before calling the pipe. To create the inspections XML file see InspectCode Command-Line Tool .
App password is required for 2 pipe features:
- Create build status when
CREATE_BUILD_STATUS="true"
. Required permission: Repositories - Read. - Get diff (
INCLUDE_ONLY_ISSUES_IN_DIFF="true"
when in PRs). Required permission: Pull requests - Read.
See Atlassian documentation on how to generate an app password .
Basic example:
script:
- pipe: docker://loremfoobar/resharper-inspections-bitbucket-pipe:1.1.0
variables:
INSPECTIONS_XML_PATH: "inspect.xml"
With pattern:
script:
- pipe: docker://loremfoobar/resharper-inspections-bitbucket-pipe:1.1.0
variables:
INSPECTIONS_XML_PATH: "src/*/inspect.xml"
With app password (you should use secure variables for username and app password):
script:
- pipe: docker://loremfoobar/resharper-inspections-bitbucket-pipe:1.1.0
variables:
INSPECTIONS_XML_PATH: "inspect.xml"
BITBUCKET_USERNAME: $USERNAME
BITBUCKET_APP_PASSWORD: $APP_PASSWORD
With build status creation disabled:
script:
- pipe: docker://loremfoobar/resharper-inspections-bitbucket-pipe:1.1.0
variables:
INSPECTIONS_XML_PATH: "inspect.xml"
BITBUCKET_USERNAME: $USERNAME
BITBUCKET_APP_PASSWORD: $APP_PASSWORD
CREATE_BUILD_STATUS: "false"
If you're reporting an issue, please include:
- the version of the pipe
- relevant logs and error messages
- steps to reproduce