• Get Review Board
  • What's New
  • Products
  • Review Board Code review, image review, and document review
  • Documentation
  • Release Notes
  • Power Pack Enterprise integrations, reports, and enhanced document review
  • Try for 60 Days
  • Purchase
  • RBCommons Review Board as a Service, hosted by us
  • Pricing
  • RBTools Command line tools and Python API for Review Board
  • Documentation
  • Release Notes
  • Review Bot Automated code review, connecting tools you already use
  • Documentation
  • Release Notes
  • RB Gateway Manage Git and Mercurial repositories in your network
  • Documentation
  • Release Notes
  • Learn and Explore
  • What is Code Review?
  • Documentation
  • Frequently Asked Questions
  • Support Options
  • Third-Party Integrations
  • Demo
  • Review Board RBTools Power Pack Review Bot Djblets RB Gateway
    1. Review Bot 4.x
    2. Version 4.x
    3. Version 3.0
    4. Version 2.0
    5. Version 1.0
    6. Module and Class Reference
    7. reviewbot.processing.review
  • Home
  • Installation
  • Manually Installing Review Bot
  • Review Bot Docker Images
  • Upgrading Review Bot
  • Configuring Review Bot
  • Review Bot Tools
  • Cargo Tool
  • Checkstyle
  • Clang Static Analyzer
  • Cppcheck
  • Cpplint
  • Doc8
  • FBInfer
  • Flake8
  • Go Fmt
  • Go Tool
  • JSHint
  • PMD
  • Pycodestyle
  • Pydocstyle
  • Pyflakes
  • RuboCop
  • Rust Fmt
  • Secret Scanner
  • ShellCheck
  • Module and Class Reference
  • reviewbot.tools.base
  • reviewbot.tools.base.mixins
  • reviewbot.tools.base.registry
  • reviewbot.tools.base.tool
  • reviewbot.testing.testcases
  • reviewbot.testing.utils
  • reviewbot.tools.testing
  • reviewbot.tools.testing.decorators
  • reviewbot.tools.testing.testcases
  • reviewbot.processing.review
  • reviewbot.utils.api
  • reviewbot.utils.filesystem
  • reviewbot.utils.log
  • reviewbot.utils.process
  • reviewbot.utils.text
  • reviewbot.celery
  • reviewbot.config
  • reviewbot.deprecation
  • reviewbot.errors
  • reviewbot.repositories
  • reviewbot.tasks
  • reviewbot.tools.cargotool
  • reviewbot.tools.checkstyle
  • reviewbot.tools.clang
  • reviewbot.tools.cppcheck
  • reviewbot.tools.cpplint
  • reviewbot.tools.doc8
  • reviewbot.tools.fbinfer
  • reviewbot.tools.flake8
  • reviewbot.tools.gofmt
  • reviewbot.tools.gotool
  • reviewbot.tools.jshint
  • reviewbot.tools.pmd
  • reviewbot.tools.pycodestyle
  • reviewbot.tools.pydocstyle
  • reviewbot.tools.pyflakes
  • reviewbot.tools.rbsecretscanner
  • reviewbot.tools.rubocop
  • reviewbot.tools.rustfmt
  • reviewbot.tools.shellcheck
  • General Index
  • Python Module Index
  • Release Notes
  • reviewbot.processing.review¶

    Module Attributes

    logger

    The logger for the module.

    Classes

    File(review, api_filediff)

    Represents a file in the review.

    Review(api_root, review_request_id, ...)

    An object which orchestrates the creation of a review.

    ReviewFileStatus(value[, names, module, ...])

    The change status of a file.

    logger = <Logger reviewbot.processing.review (WARNING)>[source]¶

    The logger for the module.

    New in version 3.0.

    class ReviewFileStatus(value, names=None, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]¶

    Bases: Enum

    The change status of a file.

    New in version 3.0.

    CREATED = 'created'[source]¶
    DELETED = 'deleted'[source]¶
    MODIFIED = 'modified'[source]¶
    MOVED = 'moved'[source]¶
    COPIED = 'copied'[source]¶
    classmethod for_filediff(filediff)[source]¶

    Return a status for a FileDiff.

    Parameters:

    filediff (rbtools.api.resource.Resource) – The filediff resource.

    Returns:

    The resulting status.

    Return type:

    ReviewFileStatus

    Raises:

    ValueError – The status for the FileDiff is unknown/unsupported.

    class File(review, api_filediff)[source]¶

    Bases: object

    Represents a file in the review.

    Information about the file can be retreived through this class, including retrieving the actual body of the original or patched file.

    Allows comments to be made to the file in the review.

    COMMENT_MAX_LINES = 10[source]¶

    The maximum number of lines allowed for a comment.

    If a comment exceeds this count, it will be capped and a line range will be provided in the comment.

    __init__(review, api_filediff)[source]¶

    Initialize the File.

    Parameters:
    • review (Review) – The review object.

    • api_filediff (rbtools.api.resource.Resource) – The filediff resource.

    property patched_file_contents[source]¶

    The patched contents of the file.

    Returns:

    The contents of the patched file.

    Return type:

    bytes

    property original_file_contents[source]¶

    The original contents of the file.

    Returns:

    The contents of the original file.

    Return type:

    bytes

    get_patched_file_path()[source]¶

    Fetch the patched file and return the filename of it.

    Changed in version 3.0: Empty files no longer return None.

    Returns:

    The filename of a new temporary file containing the patched file contents. If the file is deleted, this will return None.

    Return type:

    str

    get_original_file_path()[source]¶

    Fetch the original file and return the filename of it.

    Changed in version 3.0: Empty files no longer return None.

    Returns:

    The filename of a new temporary file containing the original file contents. If the file is new, this will return None.

    Return type:

    str

    get_lines(first_line, num_lines=1, original=False)[source]¶

    Return the lines from the file in the given range.

    This can be used to extract lines from the original or modified file, as represented in the diff data. Some tool implementations can use this to provide more informative results (e.g., by providing suggested fixes to lines based on diffed/delta information coming from the program backing the tool).

    Parameters:
    • first_line (int) – The first line in the range.

    • num_lines (int, optional) – The maximum number of lines to return.

    • original (bool, optional) – Whether to return lines from the original (unmodified) file.

    Returns:

    The list of lines, up to the maximum requested. This will be empty if the lines could not be found.

    Return type:

    list of str

    apply_patch(root_target_dir)[source]¶

    Apply the patch for this file to the filesystem.

    The file will be written relative to the current directory.

    New in version 3.0.

    Parameters:

    root_target_dir (str) – The root directory for the project. No files are allowed to be created, modified, deleted, or linked to outside of this path.

    Raises:

    reviewbot.errors.SuspiciousFilePath – The patch tried to work with a file outside of root_target_dir.

    comment(text, first_line, num_lines=1, start_column=None, error_code=None, issue=None, rich_text=False, original=False, text_extra=None, severity=None)[source]¶

    Make a comment on the file.

    Changed in version 3.0: Added error_code, severity, start_column, and text_extra arguments.

    Parameters:
    • text (str) – The text of the comment.

    • first_line (int) – The line number that the comment starts on. If None, the comment is considered to be for the entire file.

    • num_lines (int, optional) – The number of lines that the comment should span.

    • start_column (int, optional) – The starting column within the code line where an error applied, as reported by a linter. If provided, this will be appended to the text.

    • error_code (str, optional) – An error code for the error being reported. If provided, this will be appended to the text.

    • issue (bool, optional) – Whether an issue should be opened.

    • rich_text (bool, optional) – Whether the comment text should be formatted using Markdown.

    • original (bool, optional) – If True, the first_line argument corresponds to the line number in the original file, instead of the patched file.

    • severity (str, optional) – A tool-specific, human-readable indication of the severity of this comment.

    • text_extra (list of tuple, optional) – Additional data to append to the text in Key: Value form. Each item is an ordered tuple of (Key, Value). These will be placed after the default items (“Column” and “Error code”).

    class Review(api_root, review_request_id, diff_revision, settings)[source]¶

    Bases: object

    An object which orchestrates the creation of a review.

    body_top = ''[source]¶

    Additional text to show above the comments in the review.

    body_bottom = ''[source]¶

    Additional text to show below the comments in the review.

    __init__(api_root, review_request_id, diff_revision, settings)[source]¶

    Initialize the review.

    Parameters:
    • api_root (rbtools.api.resource.Resource) – The API root.

    • review_request_id (int) – The ID of the review request being reviewed (ID for use in the API, which is the “display_id” field).

    • diff_revision (int) – The diff revision being reviewed.

    • settings (dict) – The settings provided by the extension when triggering the task.

    general_comment(text, issue=None, rich_text=False)[source]¶

    Make a general comment.

    Parameters:
    • text (str) – The text of the comment.

    • issue (bool, optional) – Whether an issue should be opened.

    • rich_text (bool, optional) – Whether the comment text should be formatted using Markdown.

    publish()[source]¶

    Upload the review to Review Board.

    property has_comments[source]¶

    Whether the review has comments.

    property patch_contents[source]¶

    The contents of the patch.

    Returns:

    The contents of the patch associated with the review request and diff revision.

    Return type:

    str

    get_patch_file_path()[source]¶

    Fetch the patch and return the filename of it.

    Returns:

    The filename of a new temporary file containing the patch contents. If the patch is empty, return None.

    Return type:

    str

    Keep up with the latest Review Board releases, security updates, and helpful information.

    About
    News
    Demo
    RBCommons Hosting
    Integrations
    Happy Users
    Support Options
    Documentation
    FAQ
    User Manual
    RBTools
    Administration Guide
    Power Pack
    Release Notes
    Downloads
    Review Board
    RBTools
    Djblets
    Power Pack
    Package Store
    PGP Signatures
    Contributing
    Bug Tracker
    Submit Patches
    Development Setup
    Wiki
    Follow Us
    Mailing Lists
    Reddit
    Twitter
    Mastodon
    Facebook
    YouTube

    Copyright © 2006-2025 Beanbag, Inc. All rights reserved.

    Terms of Service — Privacy Policy — AI Ethics Policy — Branding

    On this page

    • [Top]
    • logger
    • ReviewFileStatus
      • ReviewFileStatus.CREATED
      • ReviewFileStatus.DELETED
      • ReviewFileStatus.MODIFIED
      • ReviewFileStatus.MOVED
      • ReviewFileStatus.COPIED
      • ReviewFileStatus.for_filediff()
    • File
      • File.COMMENT_MAX_LINES
      • File.__init__()
      • File.patched_file_contents
      • File.original_file_contents
      • File.get_patched_file_path()
      • File.get_original_file_path()
      • File.get_lines()
      • File.apply_patch()
      • File.comment()
    • Review
      • Review.body_top
      • Review.body_bottom
      • Review.__init__()
      • Review.general_comment()
      • Review.publish()
      • Review.has_comments
      • Review.patch_contents
      • Review.get_patch_file_path()