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
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
Add linter documentation
- Update sidebar positions in documentation guides
  • Loading branch information
hasit committed Jul 13, 2024
commit 455af2a3e0e2bdb0cff9bdfddafa0a88356da335
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
4 changes: 4 additions & 0 deletions docs/guides/linters/_category_.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
label: Linters
position: 2
collapsible: true
collapsed: true
23 changes: 23 additions & 0 deletions docs/guides/linters/linters.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
title: Linters
sidebar_label: Linters
description: Overview of CodeRabbit's supported linters and security analysis tools.
sidebar_position: 1
---

CodeRabbit supports various linters and security analysis tools to help you maintain code quality.

## Enabling/Disabling Linters

You can enable or disable linters by setting `reviews.tools.<linter>.enabled` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → Linter" field in CodeRabbit's settings page.

## Customizing Linters

CodeRabbit supports customizing the strictness of linters 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.

## Linters

- [Ruff](./ruff.md)
122 changes: 122 additions & 0 deletions docs/guides/linters/ruff.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
---
title: Ruff
sidebar_label: Ruff
description: Overview of CodeRabbit's supported linters and security analysis tools.
sidebar_position: 1
---

Ruff is a linter and code formatter for Python.

## Settings

Ruff supports the following config files:

- `pyproject.toml`
- `ruff.toml`
- `.ruff.toml`

CodeRabbit will use the following settings 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](https://docs.astral.sh/ruff/configuration/)
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