mirror of
https://github.com/ivuorinen/coderabbit.git
synced 2026-03-17 20:00:54 +00:00
feat: add validation tooling and expand path review instructions
Add pre-commit hooks (YAML lint, schema validation, editorconfig), CI workflow, and new path instructions for test files, Dockerfiles, config files, and archival docs.
This commit is contained in:
15
.editorconfig
Normal file
15
.editorconfig
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
root = true
|
||||||
|
|
||||||
|
[*]
|
||||||
|
charset = utf-8
|
||||||
|
end_of_line = lf
|
||||||
|
insert_final_newline = true
|
||||||
|
trim_trailing_whitespace = true
|
||||||
|
indent_style = space
|
||||||
|
indent_size = 2
|
||||||
|
|
||||||
|
[*.md]
|
||||||
|
trim_trailing_whitespace = false
|
||||||
|
|
||||||
|
[Makefile]
|
||||||
|
indent_style = tab
|
||||||
21
.github/workflows/validate.yml
vendored
Normal file
21
.github/workflows/validate.yml
vendored
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
---
|
||||||
|
name: Validate Configuration
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
pull_request:
|
||||||
|
branches: [main]
|
||||||
|
|
||||||
|
permissions:
|
||||||
|
contents: read
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
validate:
|
||||||
|
runs-on: ubuntu-latest
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
- uses: actions/setup-python@v5
|
||||||
|
with:
|
||||||
|
python-version: '3.12'
|
||||||
|
- uses: pre-commit/action@v3.0.1
|
||||||
6
.gitignore
vendored
Normal file
6
.gitignore
vendored
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
# Python
|
||||||
|
__pycache__/
|
||||||
|
*.py[cod]
|
||||||
|
|
||||||
|
# Pre-commit
|
||||||
|
.pre-commit-cache/
|
||||||
35
.pre-commit-config.yaml
Normal file
35
.pre-commit-config.yaml
Normal file
@@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
repos:
|
||||||
|
# Standard hooks: basic file hygiene
|
||||||
|
- repo: https://github.com/pre-commit/pre-commit-hooks
|
||||||
|
rev: v6.0.0
|
||||||
|
hooks:
|
||||||
|
- id: check-yaml
|
||||||
|
args: ['--allow-multiple-documents']
|
||||||
|
- id: end-of-file-fixer
|
||||||
|
- id: trailing-whitespace
|
||||||
|
- id: check-merge-conflict
|
||||||
|
|
||||||
|
# YAML linting
|
||||||
|
- repo: https://github.com/adrienverge/yamllint
|
||||||
|
rev: v1.38.0
|
||||||
|
hooks:
|
||||||
|
- id: yamllint
|
||||||
|
args: [--strict]
|
||||||
|
|
||||||
|
# JSON Schema validation against CodeRabbit's official schema
|
||||||
|
- repo: https://github.com/python-jsonschema/check-jsonschema
|
||||||
|
rev: 0.37.0
|
||||||
|
hooks:
|
||||||
|
- id: check-jsonschema
|
||||||
|
name: Validate coderabbit.yaml against schema
|
||||||
|
files: ^coderabbit\.yaml$
|
||||||
|
args:
|
||||||
|
- '--schemafile'
|
||||||
|
- 'https://storage.googleapis.com/coderabbit_public_assets/schema.v2.json'
|
||||||
|
|
||||||
|
# EditorConfig compliance
|
||||||
|
- repo: https://github.com/editorconfig-checker/editorconfig-checker.python
|
||||||
|
rev: '3.6.1'
|
||||||
|
hooks:
|
||||||
|
- id: editorconfig-checker
|
||||||
13
.yamllint.yaml
Normal file
13
.yamllint.yaml
Normal file
@@ -0,0 +1,13 @@
|
|||||||
|
---
|
||||||
|
extends: default
|
||||||
|
rules:
|
||||||
|
line-length:
|
||||||
|
max: 120
|
||||||
|
allow-non-breakable-words: true
|
||||||
|
allow-non-breakable-inline-mappings: true
|
||||||
|
truthy:
|
||||||
|
check-keys: false
|
||||||
|
allowed-values: ['true', 'false', 'on', 'off']
|
||||||
|
comments:
|
||||||
|
min-spaces-from-content: 1
|
||||||
|
document-start: enable
|
||||||
@@ -21,4 +21,3 @@ This way the repository is always using the latest configuration.
|
|||||||
- [YouTube Channel](https://www.youtube.com/@CodeRabbitAI) - Official YouTube channel with tutorials and updates.
|
- [YouTube Channel](https://www.youtube.com/@CodeRabbitAI) - Official YouTube channel with tutorials and updates.
|
||||||
- [AI Code Reviewer Examples](https://www.coderabbit.ai/blog/how-to-use-an-ai-code-reviewer-on-github-in-4-examples) - Four practical examples of using CodeRabbit.
|
- [AI Code Reviewer Examples](https://www.coderabbit.ai/blog/how-to-use-an-ai-code-reviewer-on-github-in-4-examples) - Four practical examples of using CodeRabbit.
|
||||||
- [OpenAPI Documentation](https://api.coderabbit.ai/api/swagger/) - Complete Swagger documentation for CodeRabbit's REST API endpoints.
|
- [OpenAPI Documentation](https://api.coderabbit.ai/api/swagger/) - Complete Swagger documentation for CodeRabbit's REST API endpoints.
|
||||||
|
|
||||||
|
|||||||
@@ -68,15 +68,37 @@ reviews:
|
|||||||
instructions: >-
|
instructions: >-
|
||||||
When a project contains a `docs/` directory:
|
When a project contains a `docs/` directory:
|
||||||
1. Consider the files in the `docs/` directory tree the core/main/in-depth
|
1. Consider the files in the `docs/` directory tree the core/main/in-depth
|
||||||
documentation of the project. Also consider the 'docs/**.md' files the
|
documentation of the project. Also consider the 'docs/**.md' files the
|
||||||
second place to look for project documentation after the 'README.md' file.
|
second place to look for project documentation after the 'README.md' file.
|
||||||
2. When reviewing the documentation files (e.g. `docs/**.md`),
|
2. When reviewing the documentation files (e.g. `docs/**.md`),
|
||||||
they should additionally be linted with help from the tool `markdownlint`, pointing out any issues.
|
they should additionally be linted with help from the tool `markdownlint`, pointing out any issues.
|
||||||
3. When reviewing the documentation files in `docs/` directory, they should
|
3. When reviewing the documentation files in `docs/` directory, they should
|
||||||
additionally be linted with help from the tool `languagetool`, pointing out any issues.
|
additionally be linted with help from the tool `languagetool`, pointing out any issues.
|
||||||
4. Focus on grammar, spelling, and punctuation.
|
4. Focus on grammar, spelling, and punctuation.
|
||||||
5. Also consider readability and clarity of contents.
|
5. Also consider readability and clarity of contents.
|
||||||
6. Avoid gender-specific language and use the imperative form.
|
6. Avoid gender-specific language and use the imperative form.
|
||||||
|
- path: "docs/plans/**"
|
||||||
|
instructions: >-
|
||||||
|
These are historical design and planning documents. They may contain
|
||||||
|
outdated information and do not reflect current implementation.
|
||||||
|
Do not enforce current coding standards or suggest updates to align
|
||||||
|
with current practices. Focus only on grammar, spelling, and
|
||||||
|
readability if changes are being reviewed.
|
||||||
|
- path: "**/*.{test,spec}.*"
|
||||||
|
instructions: >-
|
||||||
|
These are test files. Focus on test coverage completeness,
|
||||||
|
assertion quality, and avoiding flaky test patterns.
|
||||||
|
Some duplication in tests is acceptable for readability —
|
||||||
|
do not enforce DRY as aggressively as in production code.
|
||||||
|
- path: "**/Dockerfile*"
|
||||||
|
instructions: >-
|
||||||
|
Review Dockerfiles for security best practices (non-root user,
|
||||||
|
minimal base images, no secrets baked into layers), multi-stage
|
||||||
|
build opportunities, and layer caching efficiency.
|
||||||
|
- path: "**/*.{json,yaml,yml,toml}"
|
||||||
|
instructions: >-
|
||||||
|
Configuration files: verify valid structure, ensure no hardcoded
|
||||||
|
secrets or credentials, and check consistency with project conventions.
|
||||||
abort_on_close: true
|
abort_on_close: true
|
||||||
disable_cache: false
|
disable_cache: false
|
||||||
auto_review:
|
auto_review:
|
||||||
@@ -222,4 +244,3 @@ code_generation:
|
|||||||
path_instructions: []
|
path_instructions: []
|
||||||
unit_tests:
|
unit_tests:
|
||||||
path_instructions: []
|
path_instructions: []
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user