Excluding Files, Folders, or Branches with Filters

The AI Code Review Agent offers powerful filters to exclude specific files and folders from code reviews and enables skipping automated reviews for selected Git branches. These filters can be configured at the Agent instance level, overriding the default behavior.

Files and folders filter

A list of files/folders that the AI Code Review Agent will not review if they are present in the diff. You can specify the files/folders to exclude from the review by name or glob/regex pattern. The Agent will automatically skip any files or folders that match the exclusion list.

This filter applies to both manual reviews initiated through the /review command and automated reviews triggered via webhook.

By default, these files are excluded: *.xml, *.json, *.properties, .gitignore, *.yml, *.md

Examples

Note:

  • Patterns are case sensitive.

  • Don’t use double quotes, single quotes or comma in the pattern.

  • Users can pass both types of patterns - Unix files system based glob pattern or regex.

Exclusion Rule for Files & FoldersApplicable PatternMatched ExamplesNot Matched Examples

Exclude all properties files in all folders and subfolders

*.properties

resource/config.properties, resource/server/server.properties

resource/config.yaml, resource/config.json

Exclude all files, folders and subfolders in folder starting with resources

resources/

resources/application.properties, resources/config/config.yaml

app/resources/file.txt, config/resources/service.properties

Exclude all files, folders and subfolders in folder src/com/resources

src/com/resources/

resources/application.properties, resources/config/config.yaml

app/resources/file.txt, config/resources/service.properties

Exclude all files, folders and subfolders in subfolder resource and in parent folder src

src/*/resource/*

src/com/resource/main.html,

src/com/resource/script/file.css, src/com/resource/app/script.js

src/resource/file.txt, src/com/config/file.txt, app/com/config/file.txt

Exclude non-css files from folder src/com/resource/ and subfolders

^src\/com\/resource\\/(?!.*\\.css$).*$

src/com/resource/main.html, src/com/resource/app/script.js,

src/com/config/file.txt

src/com/resource/script/file.css

Exclude specific file controller/webhook_controller.go

controller/webhook_controller.go

controller/webhook_controller.go

controller/controller.go, controller/webhook_service.go

Exclude non-css files from folder starting with config and its subfolders

^config\\/(?!.*\\.css$).*$

config/server.yml, config/util/conf.properties

config/profile.css, config/styles/main.css

Exclude all files & folders

*

resource/file.txt, config/file.properties, app/folder/

-

Exclude all files & folders starting with name bito in module folder

module/bito*

module/bito123, module/bitofile.js, module/bito/file.js

module/filebito.js, module/file2.txt, module/util/file.txt

Exclude single-character folder names

*/?/*

src/a/file.txt, app/b/folder/file.yaml

folder/file.txt, ab/folder/file.txt

Exclude all folders, subfolders and files in those folders except folder starting with service folder

^(?!service\\/).*$

config/file.txt, resources/file.yaml

service/file.txt, service/config/file.yaml

Exclude all files in all folders except .py, .go, and .java files

^(?!.*\\.(py|go|java)$).*$

config/file.txt, app/main.js

main.py, module/service.go, test/Example.java

Exclude non-css files from folder src/com/config and its subfolders

^config\\/(?!.*\\.css$).*$

config/server.yml, config/util/conf.properties

config/profile.css, config/styles/main.css

Source or Target branch filter

This filter allows users to skip automated reviews for pull requests based on the source or target branch. It is useful in scenarios where automated reviews are unnecessary or could potentially disrupt the workflow.

For example, this filter is useful in scenarios such as:

  • Merging to upstream branches from development branches.

  • Pull requests from PoC/experiment branches.

  • Aggregated code changes moving towards the main branch.

This filter applies only to automatically triggered reviews. Users should still be able to trigger reviews manually via the /review command.

By default, master and main branches are excluded.

Examples

Note:

  • Patterns are case sensitive.

  • Don’t use double quotes, single quotes or comma in the pattern.

  • Users can pass both types of patterns - Unix files system based glob pattern or regex.

Exclusion Rules for BranchPatternMatched ExamplesNot Matched Examples

Exclude any branch that starts with name BITO-

BITO-*

BITO-feature, BITO-123

feature-BITO, development

Exclude any branch that does not start with BITO-

^(?!BITO-).*

feature-123, release-v1.0

BITO-feature, BITO-123

Exclude any branch which is not BITO

^(?!BITO$).*

feature-BITO, development

BITO

Exclude branches like release/v1.0 and release/v1.0.1

release/v\\d+\\.\\d+(\\.\\d+)?

release/v1.0, release/v1.0.1

release/v1, release/v1.0.x

Exclude any branch ending with -test

*-test

feature-test, release-test

test-feature, release-testing

Exclude the branch that has keyword main

main

main, main-feature, mainline

master, development

Exclude the branch named main

^main$

main

main-feature, mainline, master, development

Exclude any branch name that does not start with feature- or release-

^(?!release-|feature-).*$

hotfix-123, development

feature-123, release-v1.0

Exclude branches with names containing digits

.*\\d+.*

feature-123, release-v1.0

feature-abc, main

Exclude branches with names ending with test or testing

.*(test|testing)$

feature-test, bugfix-testing

testing-feature, test-branch

Exclude branches with names containing a specific substring test

*test*

feature-test, test-branch, testing

feature, release

Exclude branches with names containing exactly three characters

^.{3}$

abc, 123

abcd, ab

Exclude branch names starting with release, hotfix, or development but not starting with Bito or feature

^(?!Bito|feature)(release|hotfix|development).*$

release-v1.0, hotfix-123, development-xyz

Bito-release, feature-hotfix, main-release

Exclude all branches where name do not contains version like 1.0, 1.0.1, etc.

^(?!.\\b\\d+\\.\\d+(\\.\\d+)?\\b).*

feature-xyz, main

release-v1.0, hotfix-1.0.1

Exclude all branches which are not alphanumeric

^.[^a-zA-Z0-9].$

feature-!abc, release-@123

feature-123, release-v1.0

Exclude all branches which contains space

.*\\s.*

feature 123, release v1.0

feature-123, release-v1.0

Draft pull requests filter

A binary setting that enables/disables automated review of pull requests (PR) based on the draft status. Enter True to disable automated review for draft pull requests, or False to enable it.

The default value is True which skips automated review of draft PR.

How to configure the filters?

Bito Cloud (Bito-hosted Agent)

You can configure filters using the Agent configuration page. For detailed instructions, please refer to the Install/run Using Bito Cloud documentation page.

CLI or webhooks service (self-hosted Agent)

You can configure filters using the bito-cra.properties file. Check the options exclude_branches, exclude_files, and exclude_draft_pr for more details.

GitHub Actions (self-hosted Agent)

You can configure filters using the GitHub Actions repository variables: EXCLUDE_BRANCHES, EXCLUDE_FILES, and EXCLUDE_DRAFT_PR. For detailed instructions, please refer to the Install/Run via GitHub Actions documentation page.

Last updated

Logo

Bito Inc. (c) 2024