Configuration
Configuration
HyperLint offers a variety of configuration options through the .hyperlint/config.yaml
file in your GitHub repository. Configuration is in YAML format. Here’s a full example for your reference:
content_dir: /reviewer: custom_comment: null custom_style_guide: check_status_upon_review_failure: failure enabled: true path_to_style_guide_dir: null enabled: true external_link_validation: check_status_upon_review_failure: failure enabled: true ignore_file_keywords: [] ignore_url_keywords: [] ignore_on_labels: [] limit_num_comments: 10 limit_num_reviews: null summarize_pull_request: enabled: true vale_style_guide: check_status_upon_review_failure: failure enabled: true
Configurations are set per repository and must be in .hyperlint/config.yaml
. This file is only read from the main/default branch.
One thing to note is that to avoid overloading the GitHub API, we cache the config file in the .hyperlint/config.yaml
file. It may take several minutes to propagate config file changes.
Here are the key configuration properties:
content_dir
- Specifies the root directory for content files
- Default: ”/”
- Examples: ”/”, “/content”, “/docs”
- We will not review any files outside of this directory
content_dir: "/docs"
Review Specific Configurations
These configurations control various aspects of the review process and are nested under the reviewer
key in the config.yaml
file.
ignore_on_labels
Hyperlint will ignore pull requests with labels specified in this list. This means you won’t receive reviews or comments while those labels are present.
reviewer: ignore_on_labels: ['custom-ignore-label']
In order to receive a review, you will need to:
- Remove the ignored label.
- Push a new commit.
vale_style_guide
- Enables/disables the Vale style guide checker.
- Default:
enabled: true
- Note: This feature is currently EXPERIMENTAL.
check_status_upon_review_failure
: Controls whether the pull request check status is marked as “failure” if Vale finds issues. Default:failure
.
reviewer: vale_style_guide: enabled: true check_status_upon_review_failure: failure
custom_style_guide
There are two ways of specifying a custom style guide:
- As a single file.
- As a directory containing multiple files.
For simple style guides, using a single file is recommended. For more complex ones, a directory is more suitable.
For instance, you might have the following files in your .hyperlint/style_guide
folder:
formatting.mdgrammar.md
Here are the parameters under the custom_style_guide
configuration:
enabled
: Enables/disables custom style guide checking. Default:enabled: true
.path_to_style_guide
: Optional: Specifies the path to a single style guide file.path_to_style_guide_dir
: Optional: Specifies the path to a style guide directory.check_status_upon_review_failure
: Controls whether the pull request check status is marked as “failure” if the custom style guide finds issues. Default:failure
.
reviewer: custom_style_guide: enabled: true path_to_style_guide: ".hyperlint/style_guide.md" # Note: This MUST be an absolute path from the root of the repository. path_to_style_guide_dir: "./hyperlint/style_guide/" check_status_upon_review_failure: failure
The path_to_style_guide
can also begin with a /
, which will be interpreted as a path relative to the root of the repository.
external_link_validation
- Enables/disables external link checking functionality.
- Default:
enabled: true
check_status_upon_review_failure
: Controls whether the pull request check status is marked as “failure” if broken links are found. Default:failure
.
reviewer: external_link_validation: enabled: true check_status_upon_review_failure: failure ignore_file_keywords: ['changelog'] ignore_url_keywords: ['.gov']
ignore_file_keywords
- When performing a link check, ignore files that contain these keywords.
- Default:
[]
ignore_url_keywords
- When performing a link check, ignore links that contain these keywords.
- Default:
[]
limit_num_comments
- Limits the number of inline comments Hyperlint will generate.
- Default:
10
- Set to
null
for unlimited comments.
reviewer: limit_num_comments: 20
limit_num_reviews
- Limits the number of reviews Hyperlint will generate.
- Default:
null
(unlimited). - Set to a number to limit reviews.
reviewer: limit_num_reviews: 1
summarize_pull_request
- Enables/disables the pull request summary feature.
- Default:
enabled: true
reviewer: summarize_pull_request: enabled: true
custom_comment
- Allows you to add a custom comment to every review.
- Default:
null
(no custom comment).
reviewer: custom_comment: "This pull request has been reviewed by Hyperlint."