Skip to content

bb insights

Publish and read Code Insights reports and annotations

8 commands.

bb insights annotation
Add, list, replace and delete Code Insights annotations (4 commands)
bb insights report
Publish, read, list and delete Code Insights reports (4 commands)

bb insights annotation

Add, list, replace and delete Code Insights annotations

add
Add annotations to a Code Insights report
delete
Delete annotation(s) by external id for a report
list
List annotations for a Code Insights report or commit
set
Create or replace a Code Insights report annotation

bb insights annotation add

Add annotations to a Code Insights report

bb insights annotation add <commit> <report-key> [flags]
# Attach a finding to a report; the body is a list, so it takes several
bb insights annotation add a1b2c3d lint --repo PROJ/repo --body \
  '[{"externalId":"lint-1","message":"Unused import","severity":"LOW","path":"src/main.go","line":3}]'
--body string
Raw JSON array payload for annotations

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Predicts the outcome from what it can read, without changing anything (predicted)

Output with --json, where ? marks a field that can be absent
data
  status  string   Outcome of the command.
  count   integer  How many annotations were added.

bb insights annotation delete

Delete annotation(s) by external id for a report

bb insights annotation delete <commit> <report-key> [flags]
# Remove one finding, by the id it was reported with
bb insights annotation delete a1b2c3d lint --external-id lint-1 --repo PROJ/repo
--external-id string
External annotation ID to delete
-y, --yes
Confirm without being asked; applies only when the target is named with --repo PROJECT/slug

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  status       string  Outcome of the command.
  externalId?  string  Annotation that was deleted, when a single one was named.

bb insights annotation list

List annotations for a Code Insights report or commit

bb insights annotation list <commit> [report-key] [flags]
# The findings of one report
bb insights annotation list a1b2c3d lint --repo PROJ/repo

# Of every report on the commit
bb insights annotation list a1b2c3d --repo PROJ/repo
--all
Return every result rather than the first --limit
--limit int
Maximum number of results to return (default 25)

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data           list of object
  externalId?  string                        Reporter's own identifier, used to update or delete a single annotation.
  reportKey?   string                        Report the annotation belongs to.
  path?        string                        File the finding is on.
  line?        integer                       Line within that file.
  message?     string                        What the reporter found.
  severity?    LOW|MEDIUM|HIGH
  type?        VULNERABILITY|CODE_SMELL|BUG
  link?        string                        Link to the finding in the reporting system.

bb insights annotation set

Create or replace a Code Insights report annotation

bb insights annotation set <commit> <report-key> <external-id> [flags]
# Report one finding, or replace it
bb insights annotation set a1b2c3d lint lint-2 --repo PROJ/repo \
  --message "SQL built from input" --severity HIGH --type VULNERABILITY \
  --path src/db.go --line 41
--line int32
Line number containing the annotation
--link string
Link associated with the annotation
--message string
Annotation message
--path string
File path containing the annotation
--severity string
Annotation severity (one of: LOW, MEDIUM, HIGH)
--type string
Annotation type (one of: BUG, CODE_SMELL, VULNERABILITY)

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  externalId?  string                        Reporter's own identifier, used to update or delete a single annotation.
  reportKey?   string                        Report the annotation belongs to.
  path?        string                        File the finding is on.
  line?        integer                       Line within that file.
  message?     string                        What the reporter found.
  severity?    LOW|MEDIUM|HIGH
  type?        VULNERABILITY|CODE_SMELL|BUG
  link?        string                        Link to the finding in the reporting system.

bb insights report

Publish, read, list and delete Code Insights reports

delete
Delete a Code Insights report
get
Get a Code Insights report
list
List Code Insights reports for a commit
set
Create or update a Code Insights report

bb insights report delete

Delete a Code Insights report

bb insights report delete <commit> <report-key> [flags]
# Remove a report and its findings from a commit
bb insights report delete a1b2c3d lint --repo PROJ/repo
-y, --yes
Confirm without being asked; applies only when the target is named with --repo PROJECT/slug

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  status  string  Outcome of the command.
  commit  string  Commit the report was attached to.
  key     string  Report key.

bb insights report get

Get a Code Insights report

bb insights report get <commit> <report-key>
# One report on a commit
bb insights report get a1b2c3d lint --repo PROJ/repo

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data
  key?          string          Report key, unique per commit.
  title?        string          Report title.
  details?      string          Longer description.
  result?       PASS|FAIL       Absent when the reporter did not state one.
  reporter?     string          Which system produced the report.
  link?         string          Link back to the reporting system.
  logoUrl?      string          Logo shown beside the report in the Bitbucket UI.
  createdDate?  integer         When the report was created, in milliseconds since the epoch.
  data?         list of object  Labelled figures attached to the report.
    title?      string          Label for the figure.
    type?       string          How to read value: NUMBER, PERCENTAGE, DURATION, TEXT or LINK.
    value?      map of any      The figure itself.

bb insights report list

List Code Insights reports for a commit

bb insights report list <commit> [flags]
# Every report on a commit
bb insights report list a1b2c3d --repo PROJ/repo
--all
Return every result rather than the first --limit
--limit int
Maximum number of results to return (default 25)

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Runs as usual: this command changes nothing, so there is nothing to hold back

Output with --json, where ? marks a field that can be absent
data            list of object
  key?          string          Report key, unique per commit.
  title?        string          Report title.
  details?      string          Longer description.
  result?       PASS|FAIL       Absent when the reporter did not state one.
  reporter?     string          Which system produced the report.
  link?         string          Link back to the reporting system.
  logoUrl?      string          Logo shown beside the report in the Bitbucket UI.
  createdDate?  integer         When the report was created, in milliseconds since the epoch.
  data?         list of object  Labelled figures attached to the report.
    title?      string          Label for the figure.
    type?       string          How to read value: NUMBER, PERCENTAGE, DURATION, TEXT or LINK.
    value?      map of any      The figure itself.

bb insights report set

Create or update a Code Insights report

bb insights report set <commit> <report-key> [flags]
# Publish a report on a commit, or replace it
bb insights report set a1b2c3d lint --repo PROJ/repo \
  --body '{"title":"Lint","result":"PASS","details":"412 files checked"}'
--body string
Raw JSON payload for Code Insights report

Inherited from bb insights:

--repo string
Repository as PROJECT/slug (defaults to the repository of the git checkout you are in, then BITBUCKET_PROJECT_KEY + BITBUCKET_REPO_SLUG)

Also takes the global flags.

Dry run: Checks your permission and the current state this depends on, without changing anything (preconditions-checked)

Output with --json, where ? marks a field that can be absent
data
  key?          string          Report key, unique per commit.
  title?        string          Report title.
  details?      string          Longer description.
  result?       PASS|FAIL       Absent when the reporter did not state one.
  reporter?     string          Which system produced the report.
  link?         string          Link back to the reporting system.
  logoUrl?      string          Logo shown beside the report in the Bitbucket UI.
  createdDate?  integer         When the report was created, in milliseconds since the epoch.
  data?         list of object  Labelled figures attached to the report.
    title?      string          Label for the figure.
    type?       string          How to read value: NUMBER, PERCENTAGE, DURATION, TEXT or LINK.
    value?      map of any      The figure itself.