Skip to content

Add linter documentation #59

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 13 commits into from
Jul 15, 2024
Merged
2 changes: 1 addition & 1 deletion docs/guides/commands.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ sidebar_label: CodeRabbit Commands
description:
CodeRabbit offers various commands that can be invoked as PR comments to
control the review process.
sidebar_position: 3
sidebar_position: 4
---

The following commands are available (invoked as PR comments):
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/delete-account.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Delete CodeRabbit Account
sidebar_label: Delete CodeRabbit Account
# description:
sidebar_position: 3
sidebar_position: 5
---

The guide explains how to delete your CodeRabbit account and all the data
Expand Down
3 changes: 1 addition & 2 deletions docs/guides/ondemand-reports.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ title: On-demand Reports
sidebar_label: On-demand Reports (Beta)
description:
CodeRabbit offers a way to generate on-demand reports using a simple API request
sidebar_position: 5
sidebar_position: 6
---

```mdx-code-block
Expand Down Expand Up @@ -54,7 +54,6 @@ Sample output:
]
```


:::info

If you get a 401 UNAUTHORIZED error, check if you're passing the right API key in the `x-coderabbitai-api-key` header
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/review-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ description:
CodeRabbit offers various customization options to tailor the reviews to your
specific requirements. Customizations can be made using one of the below
options.
sidebar_position: 2
sidebar_position: 3
---

The guide explains how to add custom review instructions for the entire project.
Expand Down
4 changes: 4 additions & 0 deletions docs/guides/tools/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
label: Tools
position: 2
collapsible: true
collapsed: true
198 changes: 198 additions & 0 deletions docs/guides/tools/biome.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,198 @@
---
title: Biome
sidebar_label: Biome
description: CodeRabbit's guide to Biome.
sidebar_position: 5
---

[Biome](https://biomejs.dev/) is linter for JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS.

## Files

Biome will run on files with the following extensions:

- `.js`
- `.ts`
- `.cjs`
- `.mjs`
- `.d.cts`
- `.d.mts`
- `.jsx`
- `.tsx`
- `.json`
- `.jsonc`
- `.css`

## Configuration

Biome supports the following config files:

- `biome.jsonc`
- `biome.json`

CodeRabbit will use the following settings based on the profile selected if no config file is found:

### Chill

```json
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"all": false,
"recommended": true,
"a11y": {
"recommended": false
},
"correctness": {
"useExhaustiveDependencies": "off",
"noInnerDeclarations": "off"
},
"style": {
"recommended": false,
"noArguments": "warn",
"noCommaOperator": "warn",
"noUselessElse": "warn",
"useAsConstAssertion": "off",
"useBlockStatements": "off",
"useConsistentArrayType": "off",
"useDefaultParameterLast": "warn",
"useEnumInitializers": "off",
"useExponentiationOperator": "warn",
"useExportType": "off",
"useFragmentSyntax": "off",
"useImportType": "off",
"useLiteralEnumMembers": "warn",
"useShorthandArrayType": "off",
"noUnusedTemplateLiteral": "off"
},
"complexity": {
"noForEach": "off",
"noExcessiveCognitiveComplexity": {
"level": "off",
"options": {
"maxAllowedComplexity": 25
}
},
"useLiteralKeys": "off",
"useArrowFunction": "off",
"useFlatMap": "off"
},
"suspicious": {
"noArrayIndexKey": "off",
"noExplicitAny": "off",
"noImplicitAnyLet": "off",
"noDoubleEquals": "off"
},
"nursery": {
"all": false
}
}
},
"css": {
"linter": {
"enabled": true
},
"parser": {
"cssModules": true
}
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
}
}
```

### Assertive

```json
{
"$schema": "https://biomejs.dev/schemas/1.8.3/schema.json",
"organizeImports": {
"enabled": false
},
"formatter": {
"enabled": false
},
"linter": {
"enabled": true,
"rules": {
"all": false,
"recommended": true,
"a11y": {
"recommended": ""
},
"correctness": {
"useExhaustiveDependencies": "off",
"noInnerDeclarations": "warn"
},
"style": {
"recommended": true,
"noArguments": "warn",
"noCommaOperator": "warn",
"noUselessElse": "warn",
"useAsConstAssertion": "off",
"useBlockStatements": "off",
"useConsistentArrayType": "off",
"useDefaultParameterLast": "warn",
"useEnumInitializers": "off",
"useExponentiationOperator": "warn",
"useExportType": "off",
"useFragmentSyntax": "off",
"useImportType": "off",
"useLiteralEnumMembers": "warn",
"useShorthandArrayType": "off",
"noUnusedTemplateLiteral": "off"
},
"complexity": {
"noForEach": "off",
"noExcessiveCognitiveComplexity": {
"level": ,
"options": {
"maxAllowedComplexity": 25
}
},
"useLiteralKeys": "off",
"useArrowFunction": "",
"useFlatMap": ""
},
"suspicious": {
"noArrayIndexKey": "",
"noExplicitAny": "",
"noImplicitAnyLet": "",
"noDoubleEquals": ""
},
"nursery": {
"all": false
}
}
},
"css": {
"linter": {
"enabled": true
},
"parser": {
"cssModules": true
}
},
"javascript": {
"parser": {
"unsafeParameterDecoratorsEnabled": true
}
}
}

```

## Links

- [Biome Configuration](https://biomejs.dev/reference/configuration/)
42 changes: 42 additions & 0 deletions docs/guides/tools/hadolint.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
---
title: Hadolint
sidebar_label: Hadolint
description: CodeRabbit's guide to Hadolint.
sidebar_position: 6
---

[Hadolint](https://github.com/hadolint/hadolint) is a Dockerfile linter.

## Files

Hadolint will run on files with the following file names:

- `Dockerfile`
- `*.dockerfile`
- `Dockerfile.*`

## Configuration

Hadolint supports the following config files:

- `.hadolint.yaml`

CodeRabbit will ignore the following severity levels if no config file is found:

### Chill

- `none`
- `ignore`
- `style`
- `info`
- `warning`

### Assertive

- `none`
- `ignore`
- `style`

## Links

- [Hadolint Configuration](https://github.com/hadolint/hadolint?tab=readme-ov-file#configure)
37 changes: 37 additions & 0 deletions docs/guides/tools/languagetool.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
title: LanguageTool
sidebar_label: LanguageTool
description: CodeRabbit's guide to LanguageTool.
sidebar_position: 4
---

[LanguageTool](https://github.com/languagetool-org/languagetool) is a style and grammar checker.

## Files

LanguageTool will run on files with the following extensions:

- `.md`
- `.mdx`
- `.markdown`
- `.txt`

## Configuration

LanguageTool's style and grammar check depends on the language selected in CodeRabbit's configuration. You can set the language by setting the `language` field in your project's `.coderabbit.yaml` file or setting the "Review Language" field in CodeRabbit's settings page.

CodeRabbit allows further configuring LanguageTool by setting specific rules and categories to be enabled/disabled. This can be done under the `reviews.tools.languagetool` field in your project's `.coderabbit.yaml` file or setting the various options under "Review → Tools → LanguageTool" in CodeRabbit's settings page. The following options are available:

- `enabled` - Enable or disable LanguageTool.
- `enabled_rules` - Enable specific rules.
- `disabled_rules` - Disable specific rules.
- `enabled_categories` - Enable specific categories.
- `disabled_categories` - Disable specific categories.
- `enabled_only`- Enable only the rules and categories of IDs are specified with 'enabledRules' or 'enabledCategories'.
- `level` - Set the level of feedback to be provided by LanguageTool. The following levels are available:
- `default` - Provides feedback on common issues.
- `picky` - Provides feedback on more issues, rules that you might only find useful when checking formal text.

## Links

- [LanguageTool Rules](https://community.languagetool.org/rule/list?lang=en)
Loading