Skip to main content

Overview

A directory scope applies its own code review settings to one or more folders of a repository. Use it for monorepos, where areas have different standards or owners. Kody uses a single configuration per pull request: Directory → Repository → Global.
Learn how settings flow between levels in Config Inheritance & Overrides.

How it works

  • A directory scope can hold one folder or several. All of its folders share the same settings.
  • Folders can be at any depth, for example api/src/services.
  • You can add as many directory scopes as you need.
  • A folder belongs to one directory scope only. Folders inside a folder that already has a scope are not selectable.

Selection rules

Kody checks which directory scopes the pull request touches:
  • One scope touched: uses that scope’s settings. Files outside any scope do not change this.
  • No scope touched: uses the repository’s settings, or Global if the repository has none.
  • Two or more scopes touched: uses the repository’s settings, or Global if the repository has none.
Kody uses one configuration per pull request to keep reviews predictable. Mixing configurations causes conflicts.

Examples

You added a scope for src/microservice-alpha. A pull request changes files in src/microservice-alpha and in unconfigured folders.Uses the microservice-alpha settings.

Setup

  1. In the sidebar, pick the repository in the scope picker at the top of the Code review group.
  2. Open the picker again and choose Add directory scope at the bottom.
  3. In the Add directory scope dialog, tick the folders under Select directories. They are listed under Selected directories. Click Add directory scope.
  4. Pick the new scope. It appears indented under its repository in the picker. Change settings on any page and click Save settings.
To change the folders later, open the ⋯ menu next to the scope picker and choose Edit directories, then Save directories. Delete configuration removes the scope; the repository’s settings apply to those folders again.

kodus-config.yml and directory scopes

  • Kody reads kodus-config.yml from the root of the repository’s default branch only. It never reads a kodus-config.yml placed inside a folder.
  • It reads the root file only when Prefer kodus-config.yml settings is on at the repository scope. The switch also appears at directory scope, but it does not change a review: turning it on there does not make Kody read a file for that directory, and turning it off does not stop the repository’s file from applying.
  • A setting overridden on the directory scope takes precedence over the same setting in the repository’s file.
  • To keep a directory scope’s settings in files, use a centralized config repository, where a kodus-config.yml in the scope’s folder is synced into the directory scope’s settings.
See General for the file itself and Config Inheritance & Overrides for the order.

Kody Rules in a directory scope

A pull request is reviewed with the directory scope’s Kody Rules under the same selection as the settings above. When no single scope is selected, the rules of all the repository’s directory scopes apply. See Rule Inheritance.