-
Notifications
You must be signed in to change notification settings - Fork 32
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
Changes from 4 commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
455af2a
Add linter documentation
hasit ba319c5
docs: Move linter documentation to tools folder
hasit 1d04172
Add more tools
hasit 191e19e
Add LanguageTool documentation and configuration
hasit 2303cd0
Update Biome documentation and configuration
hasit 78159d2
docs: Update linter documentation and configuration
hasit 0b59424
chore: Update tools category label in _category_.yml
hasit 0fda09b
chore: Update tools category label and add new tools
hasit 27c6bb1
docs: Fix typo in Biome linter documentation
hasit 23acf22
chore: Add SwiftLint documentation and configuration
hasit ba5b505
Add golangci-lint, PHPStan, and SwiftLint documentation and configura…
hasit 9d01dfe
Add Yamllint documentation and configuration
hasit 9276d99
Add Checkov and Gitleaks documentation and configuration
hasit File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
label: Linters | ||
position: 2 | ||
collapsible: true | ||
collapsed: true |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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: 3 | ||
--- | ||
|
||
[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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
title: Markdownlint | ||
sidebar_label: Markdownlint | ||
description: CodeRabbit's guide to Markdownlint. | ||
sidebar_position: 3 | ||
--- | ||
|
||
[Markdownlint](https://github.com/DavidAnson/markdownlint) is a linter for Markdown files. | ||
|
||
## Files | ||
|
||
Markdownlint will run on files with the following extensions: | ||
|
||
- `.md` | ||
- `.markdown` | ||
|
||
## Configuration | ||
|
||
Markdownlint supports the following config files: | ||
|
||
- `.markdownlint.jsonc` | ||
- `.markdownlint.json` | ||
- `.markdownlint.yaml` | ||
- `.markdownlint.yml` | ||
|
||
CodeRabbit will use the following settings based on the profile selected if no config file is found: | ||
|
||
### Chill | ||
|
||
```json | ||
{ | ||
"default": true, | ||
"line-length": false, | ||
"no-duplicate-heading": { | ||
"siblings_only": true | ||
}, | ||
"no-trailing-punctuation": { | ||
"punctuation": ".,;:" | ||
}, | ||
"ol-prefix": false, | ||
"list-marker-space": false, | ||
"no-inline-html": false, | ||
"first-line-h1": false, | ||
"no-trailing-spaces": false, | ||
"single-h1": false, | ||
"blank_lines": false, | ||
} | ||
``` | ||
|
||
### Assertive | ||
|
||
```json | ||
{ | ||
"default": true, | ||
"line-length": false, | ||
"no-duplicate-heading": { | ||
"siblings_only": true | ||
}, | ||
"no-trailing-punctuation": { | ||
"punctuation": ".,;:" | ||
}, | ||
"ol-prefix": true, | ||
"list-marker-space": false, | ||
"no-inline-html": true, | ||
"first-line-h1": true, | ||
"no-trailing-spaces": true, | ||
"single-h1": true, | ||
"blank_lines": true, | ||
} | ||
|
||
``` | ||
|
||
## Links | ||
|
||
- [Markdownlint Configuration](https://github.com/DavidAnson/markdownlint?tab=readme-ov-file#configuration) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,128 @@ | ||
--- | ||
title: Ruff | ||
sidebar_label: Ruff | ||
description: CodeRabbit's guide to Ruff. | ||
sidebar_position: 2 | ||
--- | ||
|
||
[Ruff](https://docs.astral.sh/ruff/) is a linter and code formatter for Python. | ||
|
||
## Files | ||
|
||
Ruff will run on files with the following extensions: | ||
|
||
- `.py` | ||
|
||
## Configuration | ||
|
||
Ruff supports the following config files: | ||
|
||
- `pyproject.toml` | ||
- `ruff.toml` | ||
- `.ruff.toml` | ||
|
||
CodeRabbit will use the following settings based on the profile selected if no config file is found: | ||
|
||
### Chill | ||
|
||
```toml | ||
[lint] | ||
select = [ | ||
# pycodestyle subset rules | ||
"E7", | ||
"E9", | ||
# Pyflakes | ||
"F", | ||
# flake8-bugbear | ||
"B", | ||
# flake8-simplify | ||
"SIM", | ||
# isort subset rules | ||
"I002", | ||
] | ||
[lint.per-file-ignores] | ||
"**/__init__.py" = ["E402"] | ||
"**/conftest.py" = ["E402"] | ||
``` | ||
|
||
### Assertive | ||
|
||
```toml | ||
[lint] | ||
select = [ | ||
# pycodestyle subset rules | ||
"E7", | ||
"E9", | ||
# Pyflakes | ||
"F", | ||
# flake8-bugbear | ||
"B", | ||
# flake8-simplify | ||
"SIM", | ||
# isort subset rules | ||
"I002", | ||
# pycodestyle subset rules | ||
"E4", | ||
"E101", | ||
# mccabe | ||
"C90", | ||
# flake8-annotations | ||
"ANN", | ||
# flake8-async | ||
"ASYNC", | ||
# flake8-trio | ||
"TRIO", | ||
# flake8-bandit | ||
"S", | ||
# flake8-blind-except | ||
"BLE", | ||
# flake8-boolean-trap | ||
"FBT", | ||
# flake8-commas | ||
"COM", | ||
# flake8-comprehensions | ||
"C4", | ||
# flake8-datetimez | ||
"DTZ", | ||
# flake8-debugger | ||
"T10", | ||
# flake8-django | ||
"DJ", | ||
# flake8-executable | ||
"EXE", | ||
# flake8-implicit-str-concat | ||
"ISC", | ||
# flake8-logging | ||
"LOG", | ||
# flake8-logging-format | ||
"G", | ||
# flake8-pie | ||
"PIE", | ||
# flake8-pytest-style | ||
"PT", | ||
# flake8-raise | ||
"RSE", | ||
# flake8-return | ||
"RET", | ||
# flake8-unused-arguments | ||
"ARG", | ||
# tryceratops | ||
"TRY", | ||
# flynt | ||
"FLY", | ||
# Ruff-specific rules | ||
"RUF", | ||
# pyupgrade | ||
"UP", | ||
] | ||
[lint.per-file-ignores] | ||
"**/__init__.py" = ["E402"] | ||
"**/conftest.py" = ["E402"] | ||
"**/*_test.py" = ["S101"] | ||
"**/test_*.py" = ["S101"] | ||
"**/{test,tests}/**/*.py" = ["S101"] | ||
``` | ||
|
||
## Links | ||
|
||
- [Ruff Configuration](https://docs.astral.sh/ruff/configuration/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
--- | ||
title: ShellCheck | ||
sidebar_label: ShellCheck | ||
description: CodeRabbit's guide to ShellCheck. | ||
sidebar_position: 1 | ||
--- | ||
|
||
[ShellCheck](https://www.shellcheck.net/) is a linter for shell scripts. | ||
|
||
## Files | ||
|
||
ShellCheck will run on files with the following extensions: | ||
|
||
- `.sh` | ||
- `.bash` | ||
- `.ksh` | ||
- `.dash` | ||
|
||
## Configuration | ||
|
||
CodeRabbit will use the following settings based on the profile selected: | ||
|
||
### Chill | ||
|
||
```shell | ||
--severity=warning | ||
``` | ||
|
||
### Assertive | ||
|
||
```shell | ||
--severity=style | ||
``` | ||
|
||
## Links | ||
|
||
- [ShellCheck Uncyclo](https://www.shellcheck.net/wiki/) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: Tools | ||
sidebar_label: Tools | ||
description: Overview of CodeRabbit's supported linters and security analysis tools. | ||
sidebar_position: 1 | ||
--- | ||
|
||
CodeRabbit supports various linters and security analysis tools to improve the code review process. The output of these tools is used to enhance the feedback provided by CodeRabbit, making it possible to provide 1-click fixes for common issues. | ||
|
||
## Enabling/Disabling Tools | ||
|
||
You can enable or disable tools by setting `reviews.tools.<linter>.enabled` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → Linter → Enabled" field in CodeRabbit's settings page. | ||
|
||
## Customizing Tools | ||
|
||
CodeRabbit supports customizing the strictness of tools by setting `reviews.profile` in your project's `.coderabbit.yaml` file or setting the "Review → Profile" field in CodeRabbit's settings page. The following profiles are available: | ||
|
||
- `Chill` - Yields less feedback, that may be considered lenient. | ||
- `Assertive` - Yields more feedback, that may be considered nit-picky. | ||
|
||
Apart from the overall profile, you can also configure each tool by providing a configuration file (specific to the tool) in your project. This would allow you to further customize the tool's behavior, by enabling/disabling specific rules, setting rule severity, etc. | ||
hasit marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
## Checking Tool Output | ||
|
||
When a tool is enabled, CodeRabbit will run it on your change request and attach the output under "Review details" comment in the change request. The output will be displayed in a structured format, with information on the file, line number, and the issue detected. For example: | ||
|
||
```text | ||
Ruff | ||
fib.py | ||
21-21: f-string without any placeholders | ||
|
||
Remove extraneous f prefix | ||
|
||
(F541) | ||
``` | ||
|
||
## Supported Tools | ||
|
||
- [Ruff](./ruff.md) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.