You can now use BrowserStack Code Quality to review pull requests made on your GitHub, Bitbucket, GitLab or Azure DevOps (merge requests) repositories. When a new pull request is made, BrowserStack Code Qualityautomatically scans the changed files and reports various issues on BrowserStack Code Quality UI. Thus BrowserStack Code Quality facilitates a more effective and easier review of changes in your code.

Setting up pull request workflow

To set up pull request workflow you should configure webhooks and enable pull request workflow for your repositories.

Configuring webhooks for pull request workflow

GitHub, Bitbucket, GitLab or Azure DevOps notify BrowserStack Code Quality when a new pull request is created via webhooks. If the repository credentials (or version control account) configured in BrowserStack Code Quality for a repository has sufficient privileges, BrowserStack Code Quality will automatically setup webhook on GitHub, Bitbucket, GitLab or Azure DevOps.

Note:If your BrowserStack Code Quality and version control system (such as Bitbucket) is hosted on different networks, you may have to make BrowserStack Code Quality available to the other network through URL forwarding. Read this guide on URL forwarding for information.

Enabling pull request workflow for a repository

You can enable pull request workflow in BrowserStack Code Quality while linking a repository or later on when you decide to enable it. Enabling it during linking a repository is easy. Just select (or check) “Enable pull request” option from link repository pop-up.

You can update this setting or enable pull request at a later point in time from the “Edit repository” pop-up.

1. Using Version Control Account (VCA)

  1. For creating a new version control, refer to these steps.
  2. Once the new VCA account is already created, users can Edit repository or Link repository to this VCA account.
  3. Select your VCA account from the Repository Type dropdown list.
  4. The default repositories will be fetched for that selected repository type.
  5. Type in a repository name of your choice in the Repository Name field and select the desired language (e.g. C/Java or etc.)
  6. By default, the Enable Pull Request radio button is disabled. Tick the checkbox to enable the pull request workflow.
  7. Click on the “Link Repository” button in case of linking the repository, else click on the “Save” button if you are editing the repository.
Note:
VCA supports GitHub, Bitbucket, Gitlab and Azure DevOps platforms.

2. Using GIT account

  1. Select the repository type as “Git”.
  2. Enter the valid Git URL.
  3. Users can link repositories using SSH. Refer to these steps. (Pull request workflow is not supported for SSH)
  4. Enter your username and password.
  5. Type in a repository name of your choice in the Repository Name field and select the desired language (e.g. C/Java or etc.)
  6. When the user enters the valid username and password, then the pull request workflow is enabled, else it is disabled.
  7. Select your desired account type. Depending on your Git URL, the account type will be auto-populated.
  8. Select your host type. Host types can be cloud and on-premise. Depending on your Git URL, the host type will be auto-populated.
  9. Click on the Link Repository button to link Git account with repository or else, click on the “Save” button if you edited the repository.
Note:
1. Recommendation Engine radio button is visible to only selected languages such as Java/ C++/ C.
2. Git account supports GitHub and Bitbucket platforms.
3. Git pull request support will not be available for BrowserStack Code Quality cloud accounts.

Using pull request workflow

When a new pull request is created on your GitHub, Bitbucket, GitLab or Azure DevOps repository, BrowserStack Code Quality automatically scans the changed files. Status of this scan can be monitored from GitHub, Bitbucket, GitLab or Azure DevOps.

Pull request scan status can also be monitored from the “Development History” page in BrowserStack Code Quality UI.

Pull request review can be done from the “Development History” page in a repository. This page may not be available if the pull request workflow is disabled. Read the documentation on enabling pull request workflow to know more.

Steps:

  1. Open “Development History” page from node summary bar
  2. Navigate to the pull requests tab.
  3. A list of available pull requests can be seen here
  4. Select a pull request you want to review by clicking it.
  5. Pull request details pop-up will open
  6. Various kinds of issues such as code issues, anti-patterns, etc that are newly created, fixed, or carried over can be seen here.
  7. Use code lane view on the left-hand side to quickly locate issues in a file by clicking them.
  8. Issues will also be annotated on the margin of the code view.

Pull requests Quality Gate

Quality Gate states whether your pull request has passed or failed in quality, depending on certain configurations. There is a default configuration file, but the user can update the configuration file with respective thresholds depending on the requirements.

Refer to this article to understand more about the Embold configuration JSON file.

Beta limitations

  • On-premise and cloud versions of Bitbucket, Github, and GitLab are supported.
  • The cloud version of Azure DevOps is supported and can be linked through a version control account.
  • Pull request workflow will not be available for open-source cloud accounts.
  • Forked repositories are not supported.
    For more information on the version control account refer to this article.