Customization
Tailor Diamond to your team’s specific needs and coding standards
Making Diamond work for your team
While Diamond works effectively out of the box, you can customize its behavior to better match your team’s specific needs and coding standards. Diamond offers two primary customization options: Filters and Custom rules.
Diamond's customization interface
Filters: Controlling what Diamond ignores
Filters allow you to specify certain situations where Diamond should not leave comments. This helps reduce noise and ensures Diamond focuses on what matters most to your team.
Common filter use cases:
- Ignore test files or generated code: Prevent Diamond from flagging issues in non-production code
- Skip specific types of comments: Turn off categories of feedback that aren’t relevant to your team
- Ignore certain repositories or directories: Focus Diamond’s attention where it matters most
- Exclude specific patterns: Define patterns that Diamond should not flag (e.g., team-specific style conventions)
To set up filters:
- Go to the Diamond settings page
- Select the repository you want to customize
- Click on the “Filters” tab
- Create and save your filters
Custom rules: Teaching Diamond your standards
Custom rules allow you to define explicit guidelines for Diamond to follow when reviewing your code. This is especially powerful for enforcing team-specific best practices.
With custom rules, you can:
- Define coding standards specific to your codebase
- Implement architectural guidelines for your team
- Enforce security or performance best practices
- Ensure consistent patterns across your repositories
Diamond provides templates for common rule sets to help you get started:
- Language-specific style guides (JavaScript, Python, Go, etc.)
- Security best practices
- Performance optimization guidelines
- Accessibility standards
The fastest way to see immediate value from custom rules is to directly paste in your organization’s existing coding guidelines or documentation. Diamond will automatically interpret these and apply them during code review.
To set up custom rules:
- Go to the Diamond settings page
- Select the repository you want to customize
- Click on the “Custom rules” tab
- Choose a template or create your own rules
- Save your configuration
Excluding files from Diamond review
For large repositories, you may want to exclude certain files from Diamond’s analysis. This is particularly useful for:
- Data files that don’t need to be reviewed
- Generated code that is automatically created by tools
- Any files that would make a PR too big for Diamond to analyze
You can exclude files by marking them as generated files in your repository’s .gitattributes
file:
Files marked as linguist-generated
will be:
- Automatically collapsed in GitHub pull request views
- Excluded from Diamond’s analysis when determining if a PR is too large
- Skipped during Diamond’s code review process
For more information, see GitHub’s documentation on customizing how changed files appear on GitHub.