From 455af2a3e0e2bdb0cff9bdfddafa0a88356da335 Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Sat, 13 Jul 2024 00:31:35 -0700 Subject: [PATCH 01/13] Add linter documentation - Update sidebar positions in documentation guides --- docs/guides/commands.md | 2 +- docs/guides/delete-account.md | 2 +- docs/guides/linters/_category_.yml | 4 + docs/guides/linters/linters.md | 23 ++++++ docs/guides/linters/ruff.md | 122 +++++++++++++++++++++++++++++ docs/guides/ondemand-reports.md | 3 +- docs/guides/review-instructions.md | 2 +- 7 files changed, 153 insertions(+), 5 deletions(-) create mode 100644 docs/guides/linters/_category_.yml create mode 100644 docs/guides/linters/linters.md create mode 100644 docs/guides/linters/ruff.md diff --git a/docs/guides/commands.md b/docs/guides/commands.md index f5894524..e73ab263 100644 --- a/docs/guides/commands.md +++ b/docs/guides/commands.md @@ -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): diff --git a/docs/guides/delete-account.md b/docs/guides/delete-account.md index 425a2b01..c7493f48 100644 --- a/docs/guides/delete-account.md +++ b/docs/guides/delete-account.md @@ -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 diff --git a/docs/guides/linters/_category_.yml b/docs/guides/linters/_category_.yml new file mode 100644 index 00000000..b35588dd --- /dev/null +++ b/docs/guides/linters/_category_.yml @@ -0,0 +1,4 @@ +label: Linters +position: 2 +collapsible: true +collapsed: true diff --git a/docs/guides/linters/linters.md b/docs/guides/linters/linters.md new file mode 100644 index 00000000..b9e12564 --- /dev/null +++ b/docs/guides/linters/linters.md @@ -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..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) diff --git a/docs/guides/linters/ruff.md b/docs/guides/linters/ruff.md new file mode 100644 index 00000000..5977159f --- /dev/null +++ b/docs/guides/linters/ruff.md @@ -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/) diff --git a/docs/guides/ondemand-reports.md b/docs/guides/ondemand-reports.md index 3d4f9bd1..a2bcf236 100644 --- a/docs/guides/ondemand-reports.md +++ b/docs/guides/ondemand-reports.md @@ -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 @@ -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 diff --git a/docs/guides/review-instructions.md b/docs/guides/review-instructions.md index 180bc035..8c71b86e 100644 --- a/docs/guides/review-instructions.md +++ b/docs/guides/review-instructions.md @@ -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. From ba319c517cff8f5e05cb704f5e1a167612e0e19d Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 07:17:35 -0700 Subject: [PATCH 02/13] docs: Move linter documentation to tools folder --- docs/guides/linters/linters.md | 23 ----------- docs/guides/{linters => tools}/_category_.yml | 0 docs/guides/tools/linters.md | 39 +++++++++++++++++++ docs/guides/{linters => tools}/ruff.md | 2 +- 4 files changed, 40 insertions(+), 24 deletions(-) delete mode 100644 docs/guides/linters/linters.md rename docs/guides/{linters => tools}/_category_.yml (100%) create mode 100644 docs/guides/tools/linters.md rename docs/guides/{linters => tools}/ruff.md (95%) diff --git a/docs/guides/linters/linters.md b/docs/guides/linters/linters.md deleted file mode 100644 index b9e12564..00000000 --- a/docs/guides/linters/linters.md +++ /dev/null @@ -1,23 +0,0 @@ ---- -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..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) diff --git a/docs/guides/linters/_category_.yml b/docs/guides/tools/_category_.yml similarity index 100% rename from docs/guides/linters/_category_.yml rename to docs/guides/tools/_category_.yml diff --git a/docs/guides/tools/linters.md b/docs/guides/tools/linters.md new file mode 100644 index 00000000..31bc9af8 --- /dev/null +++ b/docs/guides/tools/linters.md @@ -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..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. + +## 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) diff --git a/docs/guides/linters/ruff.md b/docs/guides/tools/ruff.md similarity index 95% rename from docs/guides/linters/ruff.md rename to docs/guides/tools/ruff.md index 5977159f..ddba2366 100644 --- a/docs/guides/linters/ruff.md +++ b/docs/guides/tools/ruff.md @@ -1,7 +1,7 @@ --- title: Ruff sidebar_label: Ruff -description: Overview of CodeRabbit's supported linters and security analysis tools. +description: CodeRabbit's guide to Ruff. sidebar_position: 1 --- From 1d0417278e337cc5db5aba9fcdc335d7854d66a9 Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 08:02:41 -0700 Subject: [PATCH 03/13] Add more tools --- docs/guides/tools/markdownlint.md | 75 +++++++++++++++++++++++++++++++ docs/guides/tools/ruff.md | 16 ++++--- docs/guides/tools/shellcheck.md | 37 +++++++++++++++ 3 files changed, 123 insertions(+), 5 deletions(-) create mode 100644 docs/guides/tools/markdownlint.md create mode 100644 docs/guides/tools/shellcheck.md diff --git a/docs/guides/tools/markdownlint.md b/docs/guides/tools/markdownlint.md new file mode 100644 index 00000000..40799e39 --- /dev/null +++ b/docs/guides/tools/markdownlint.md @@ -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` + +## Settings + +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) diff --git a/docs/guides/tools/ruff.md b/docs/guides/tools/ruff.md index ddba2366..e52e907f 100644 --- a/docs/guides/tools/ruff.md +++ b/docs/guides/tools/ruff.md @@ -2,10 +2,16 @@ title: Ruff sidebar_label: Ruff description: CodeRabbit's guide to Ruff. -sidebar_position: 1 +sidebar_position: 2 --- -Ruff is a linter and code formatter for Python. +[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` ## Settings @@ -15,7 +21,7 @@ Ruff supports the following config files: - `ruff.toml` - `.ruff.toml` -CodeRabbit will use the following settings if no config file is found: +CodeRabbit will use the following settings based on the profile selected if no config file is found: ### Chill @@ -117,6 +123,6 @@ select = [ "**/{test,tests}/**/*.py" = ["S101"] ``` -Links: +## Links -- [Ruff](https://docs.astral.sh/ruff/configuration/) +- [Ruff Configuration](https://docs.astral.sh/ruff/configuration/) diff --git a/docs/guides/tools/shellcheck.md b/docs/guides/tools/shellcheck.md new file mode 100644 index 00000000..03adb92e --- /dev/null +++ b/docs/guides/tools/shellcheck.md @@ -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` + +## Settings + +CodeRabbit will use the following settings based on the profile selected: + +### Chill + +```shell +--severity=warning +``` + +### Assertive + +```shell +--severity=style +``` + +## Links + +- [ShellCheck Wiki](https://www.shellcheck.net/wiki/) From 191e19e7e3ae21e6bb31cfdde6d8ed0a4a9405a9 Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 08:24:09 -0700 Subject: [PATCH 04/13] Add LanguageTool documentation and configuration --- docs/guides/tools/languagetool.md | 37 ++++++++++++++++++++++ docs/guides/tools/markdownlint.md | 2 +- docs/guides/tools/ruff.md | 2 +- docs/guides/tools/shellcheck.md | 2 +- docs/guides/tools/{linters.md => tools.md} | 0 5 files changed, 40 insertions(+), 3 deletions(-) create mode 100644 docs/guides/tools/languagetool.md rename docs/guides/tools/{linters.md => tools.md} (100%) diff --git a/docs/guides/tools/languagetool.md b/docs/guides/tools/languagetool.md new file mode 100644 index 00000000..30461d7e --- /dev/null +++ b/docs/guides/tools/languagetool.md @@ -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) diff --git a/docs/guides/tools/markdownlint.md b/docs/guides/tools/markdownlint.md index 40799e39..26a65509 100644 --- a/docs/guides/tools/markdownlint.md +++ b/docs/guides/tools/markdownlint.md @@ -14,7 +14,7 @@ Markdownlint will run on files with the following extensions: - `.md` - `.markdown` -## Settings +## Configuration Markdownlint supports the following config files: diff --git a/docs/guides/tools/ruff.md b/docs/guides/tools/ruff.md index e52e907f..ac5476ec 100644 --- a/docs/guides/tools/ruff.md +++ b/docs/guides/tools/ruff.md @@ -13,7 +13,7 @@ Ruff will run on files with the following extensions: - `.py` -## Settings +## Configuration Ruff supports the following config files: diff --git a/docs/guides/tools/shellcheck.md b/docs/guides/tools/shellcheck.md index 03adb92e..cf476736 100644 --- a/docs/guides/tools/shellcheck.md +++ b/docs/guides/tools/shellcheck.md @@ -16,7 +16,7 @@ ShellCheck will run on files with the following extensions: - `.ksh` - `.dash` -## Settings +## Configuration CodeRabbit will use the following settings based on the profile selected: diff --git a/docs/guides/tools/linters.md b/docs/guides/tools/tools.md similarity index 100% rename from docs/guides/tools/linters.md rename to docs/guides/tools/tools.md From 2303cd089b1399d2e9913978c499d8bcdf29b67b Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 08:39:12 -0700 Subject: [PATCH 05/13] Update Biome documentation and configuration --- docs/guides/tools/biome.md | 198 ++++++++++++++++++++++++++++++ docs/guides/tools/languagetool.md | 2 +- 2 files changed, 199 insertions(+), 1 deletion(-) create mode 100644 docs/guides/tools/biome.md diff --git a/docs/guides/tools/biome.md b/docs/guides/tools/biome.md new file mode 100644 index 00000000..302655a0 --- /dev/null +++ b/docs/guides/tools/biome.md @@ -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. + +## 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/) diff --git a/docs/guides/tools/languagetool.md b/docs/guides/tools/languagetool.md index 30461d7e..4203239d 100644 --- a/docs/guides/tools/languagetool.md +++ b/docs/guides/tools/languagetool.md @@ -2,7 +2,7 @@ title: LanguageTool sidebar_label: LanguageTool description: CodeRabbit's guide to LanguageTool. -sidebar_position: 3 +sidebar_position: 4 --- [LanguageTool](https://github.com/languagetool-org/languagetool) is a style and grammar checker. From 78159d2b713511fa71fee141531cfaa7a2349029 Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 09:02:48 -0700 Subject: [PATCH 06/13] docs: Update linter documentation and configuration --- docs/guides/tools/biome.md | 2 +- docs/guides/tools/hadolint.md | 42 +++++++++++++++++++++++++++++++ docs/guides/tools/markdownlint.md | 2 +- docs/guides/tools/ruff.md | 2 +- 4 files changed, 45 insertions(+), 3 deletions(-) create mode 100644 docs/guides/tools/hadolint.md diff --git a/docs/guides/tools/biome.md b/docs/guides/tools/biome.md index 302655a0..96fd83d9 100644 --- a/docs/guides/tools/biome.md +++ b/docs/guides/tools/biome.md @@ -5,7 +5,7 @@ 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](https://biomejs.dev/) is linter for JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS. ## Files diff --git a/docs/guides/tools/hadolint.md b/docs/guides/tools/hadolint.md new file mode 100644 index 00000000..e1859098 --- /dev/null +++ b/docs/guides/tools/hadolint.md @@ -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) diff --git a/docs/guides/tools/markdownlint.md b/docs/guides/tools/markdownlint.md index 26a65509..ef6573d0 100644 --- a/docs/guides/tools/markdownlint.md +++ b/docs/guides/tools/markdownlint.md @@ -5,7 +5,7 @@ description: CodeRabbit's guide to Markdownlint. sidebar_position: 3 --- -[Markdownlint](https://github.com/DavidAnson/markdownlint) is a linter for Markdown files. +[Markdownlint](https://github.com/DavidAnson/markdownlint) is a linter for Markdown. ## Files diff --git a/docs/guides/tools/ruff.md b/docs/guides/tools/ruff.md index ac5476ec..5b400dda 100644 --- a/docs/guides/tools/ruff.md +++ b/docs/guides/tools/ruff.md @@ -5,7 +5,7 @@ description: CodeRabbit's guide to Ruff. sidebar_position: 2 --- -[Ruff](https://docs.astral.sh/ruff/) is a linter and code formatter for Python. +[Ruff](https://docs.astral.sh/ruff/) is a linter for Python. ## Files From 0b59424a4c28e1ef0277e567b38c9ba4a6b7d08b Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 09:04:25 -0700 Subject: [PATCH 07/13] chore: Update tools category label in _category_.yml --- docs/guides/tools/_category_.yml | 2 +- docs/guides/tools/tools.md | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/docs/guides/tools/_category_.yml b/docs/guides/tools/_category_.yml index b35588dd..50634ea9 100644 --- a/docs/guides/tools/_category_.yml +++ b/docs/guides/tools/_category_.yml @@ -1,4 +1,4 @@ -label: Linters +label: Tools position: 2 collapsible: true collapsed: true diff --git a/docs/guides/tools/tools.md b/docs/guides/tools/tools.md index 31bc9af8..f1dff2ad 100644 --- a/docs/guides/tools/tools.md +++ b/docs/guides/tools/tools.md @@ -37,3 +37,7 @@ Remove extraneous f prefix ## Supported Tools - [Ruff](./ruff.md) +- [ShellCheck](./shellcheck.md) +- [Biome](./biome.md) +- [Hadolint](./hadolint.md) +- [LanguageTool](./languagetool.md) From 0fda09becea0eac0d075400a6896afad6e25f3ec Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 09:05:21 -0700 Subject: [PATCH 08/13] chore: Update tools category label and add new tools --- docs/guides/tools/tools.md | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/docs/guides/tools/tools.md b/docs/guides/tools/tools.md index f1dff2ad..d3aa334f 100644 --- a/docs/guides/tools/tools.md +++ b/docs/guides/tools/tools.md @@ -36,8 +36,9 @@ Remove extraneous f prefix ## Supported Tools -- [Ruff](./ruff.md) - [ShellCheck](./shellcheck.md) +- [Ruff](./ruff.md) +- [Markdownlint](./markdownlint.md) +- [LanguageTool](./languagetool.md) - [Biome](./biome.md) - [Hadolint](./hadolint.md) -- [LanguageTool](./languagetool.md) From 27c6bb13a47e40cdc98e2b26d4e96e6147d36eb6 Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 09:09:56 -0700 Subject: [PATCH 09/13] docs: Fix typo in Biome linter documentation --- docs/guides/tools/biome.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/guides/tools/biome.md b/docs/guides/tools/biome.md index 96fd83d9..ff9fdc13 100644 --- a/docs/guides/tools/biome.md +++ b/docs/guides/tools/biome.md @@ -5,7 +5,7 @@ description: CodeRabbit's guide to Biome. sidebar_position: 5 --- -[Biome](https://biomejs.dev/) is linter for JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS. +[Biome](https://biomejs.dev/) is a linter for JavaScript, TypeScript, JSX, TSX, JSON, JSONC, CSS. ## Files @@ -156,7 +156,7 @@ CodeRabbit will use the following settings based on the profile selected if no c "complexity": { "noForEach": "off", "noExcessiveCognitiveComplexity": { - "level": , + "level": "warn", "options": { "maxAllowedComplexity": 25 } From 23acf22fbdde4696dcbf2725803afb09eb0ac5be Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 09:18:20 -0700 Subject: [PATCH 10/13] chore: Add SwiftLint documentation and configuration --- docs/guides/tools/swiftlint.md | 117 +++++++++++++++++++++++++++++++++ 1 file changed, 117 insertions(+) create mode 100644 docs/guides/tools/swiftlint.md diff --git a/docs/guides/tools/swiftlint.md b/docs/guides/tools/swiftlint.md new file mode 100644 index 00000000..e0fd433e --- /dev/null +++ b/docs/guides/tools/swiftlint.md @@ -0,0 +1,117 @@ +--- +title: SwiftLint +sidebar_label: SwiftLint +description: CodeRabbit's guide to SwiftLint. +sidebar_position: 7 +--- + +[SwiftLint](https://realm.github.io/SwiftLint/) is a linter for Swift. + +## Files + +SwiftLint will run on files with the following extensions: + +- `.swift` + +## Configuration + +Ruff supports the following config files: + +- `.swiftlint.yaml` +- `.swiftlint.yml` +- User-defined config file set at `reviews.tools.swiftlint.config_file` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → SwiftLint → Config File" field in CodeRabbit's settings page. + +CodeRabbit will use the following settings if no config file is found: + +```yaml +disabled_rules: + - closure_body_length + - cyclomatic_complexity + - enum_case_associated_values_count + - file_length + - function_body_length + - function_parameter_count + - large_tuple + - line_length + - nesting + - type_body_length + - attributes + - closing_brace + - closure_end_indentation + - closure_parameter_position + - closure_spacing + - collection_alignment + - colon + - comma + - comma_inheritance + - computed_accessors_order + - conditional_returns_on_newline + - control_statement + - custom_rules + - direct_return + - empty_enum_arguments + - empty_parameters + - empty_parentheses_with_trailing_closure + - explicit_self + - file_header + - file_types_order + - identifier_name + - implicit_getter + - implicit_return + - inclusive_language + - indentation_width + - leading_whitespace + - let_var_whitespace + - literal_expression_end_indentation + - modifier_order + - multiline_arguments + - multiline_arguments_brackets + - multiline_function_chains + - multiline_literal_brackets + - multiline_parameters + - multiline_parameters_brackets + - multiple_closures_with_trailing_closure + - no_space_in_method_call + - non_overridable_class_declaration + - number_separator + - opening_brace + - operator_usage_whitespace + - operator_whitespace + - optional_enum_case_matching + - period_spacing + - prefer_self_in_static_references + - prefer_self_type_over_type_of_self + - prefixed_toplevel_constant + - protocol_property_accessors_order + - redundant_discardable_let + - redundant_self_in_closure + - return_arrow_whitespace + - self_binding + - shorthand_argument + - shorthand_operator + - single_test_class + - sorted_enum_cases + - sorted_imports + - statement_position + - superfluous_else + - switch_case_alignment + - switch_case_on_newline + - trailing_closure + - trailing_comma + - trailing_newline + - trailing_whitespace + - type_contents_order + - unneeded_parentheses_in_closure_argument + - unused_optional_binding + - vertical_parameter_alignment + - vertical_parameter_alignment_on_call + - vertical_whitespace + - vertical_whitespace_between_cases + - vertical_whitespace_closing_braces + - vertical_whitespace_opening_braces + - void_return +``` + +## Links + +- [SwiftLint Configuration](https://github.com/realm/SwiftLint?tab=readme-ov-file#configuration) From ba5b5052ed9536925cc21608d918b6981eca936f Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 09:48:10 -0700 Subject: [PATCH 11/13] Add golangci-lint, PHPStan, and SwiftLint documentation and configuration --- docs/guides/tools/golangci-lint.md | 29 +++++++++++++++++++++++++++++ docs/guides/tools/phpstan.md | 28 ++++++++++++++++++++++++++++ docs/guides/tools/swiftlint.md | 2 +- docs/guides/tools/tools.md | 2 ++ 4 files changed, 60 insertions(+), 1 deletion(-) create mode 100644 docs/guides/tools/golangci-lint.md create mode 100644 docs/guides/tools/phpstan.md diff --git a/docs/guides/tools/golangci-lint.md b/docs/guides/tools/golangci-lint.md new file mode 100644 index 00000000..ae7eb924 --- /dev/null +++ b/docs/guides/tools/golangci-lint.md @@ -0,0 +1,29 @@ +--- +title: golangci-lint +sidebar_label: golangci-lint +description: CodeRabbit's guide to golangci-lint. +sidebar_position: 8 +--- + +[golangci-lint](https://golangci-lint.run/) is a fast Go linters runner. + +## Files + +golangci-lint will run on files with the following extensions: + +- `.go` +- `go.mod` + +## Configuration + +golangci-lint supports the following config files: + +- User-defined config file set at `reviews.tools.golangci-lint.config_file` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → golangci-lint → Config File" field in CodeRabbit's settings page. +- `.golangci.yml` +- `.golangci.yaml` +- `.golangci.toml` +- `.golangci.json` + +## Links + +- [golangci-lint Configuration](https://golangci-lint.run/usage/configuration/) diff --git a/docs/guides/tools/phpstan.md b/docs/guides/tools/phpstan.md new file mode 100644 index 00000000..08567df9 --- /dev/null +++ b/docs/guides/tools/phpstan.md @@ -0,0 +1,28 @@ +--- +title: PHPStan +sidebar_label: PHPStan +description: CodeRabbit's guide to PHPStan. +sidebar_position: 8 +--- + +[PHPStan](https://phpstan.org/) is a static analysis tool for PHP. + +## Files + +PHPStan will run on files with the following extensions: + +- `.php` + +## Configuration + +PHPStan supports the following config files: + +- `phpstan.neon` +- `phpstan.neon.dist` +- `phpstan.dist.neon` + +CodeRabbit will not run PHPStan if no config file is found. + +## Links + +- [PHPStan Configuration](https://phpstan.org/config-reference) diff --git a/docs/guides/tools/swiftlint.md b/docs/guides/tools/swiftlint.md index e0fd433e..ee32bbcd 100644 --- a/docs/guides/tools/swiftlint.md +++ b/docs/guides/tools/swiftlint.md @@ -17,9 +17,9 @@ SwiftLint will run on files with the following extensions: Ruff supports the following config files: +- User-defined config file set at `reviews.tools.swiftlint.config_file` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → SwiftLint → Config File" field in CodeRabbit's settings page. - `.swiftlint.yaml` - `.swiftlint.yml` -- User-defined config file set at `reviews.tools.swiftlint.config_file` in your project's `.coderabbit.yaml` file or setting the "Review → Tools → SwiftLint → Config File" field in CodeRabbit's settings page. CodeRabbit will use the following settings if no config file is found: diff --git a/docs/guides/tools/tools.md b/docs/guides/tools/tools.md index d3aa334f..a68ec551 100644 --- a/docs/guides/tools/tools.md +++ b/docs/guides/tools/tools.md @@ -42,3 +42,5 @@ Remove extraneous f prefix - [LanguageTool](./languagetool.md) - [Biome](./biome.md) - [Hadolint](./hadolint.md) +- [SwiftLint](./swiftlint.md) +- [PHPStan](./phpstan.md) From 9d01dfe8bdad47aced345db188c46d31fe993b7f Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 10:01:43 -0700 Subject: [PATCH 12/13] Add Yamllint documentation and configuration --- docs/guides/tools/tools.md | 2 ++ docs/guides/tools/yamllint.md | 46 +++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 docs/guides/tools/yamllint.md diff --git a/docs/guides/tools/tools.md b/docs/guides/tools/tools.md index a68ec551..9899dadb 100644 --- a/docs/guides/tools/tools.md +++ b/docs/guides/tools/tools.md @@ -44,3 +44,5 @@ Remove extraneous f prefix - [Hadolint](./hadolint.md) - [SwiftLint](./swiftlint.md) - [PHPStan](./phpstan.md) +- [golangci-lint](./golangci-lint.md) +- [YamlLint](./yamllint.md) diff --git a/docs/guides/tools/yamllint.md b/docs/guides/tools/yamllint.md new file mode 100644 index 00000000..44e395de --- /dev/null +++ b/docs/guides/tools/yamllint.md @@ -0,0 +1,46 @@ +--- +title: Yamllint +sidebar_label: Yamllint +description: CodeRabbit's guide to Yamllint. +sidebar_position: 8 +--- + +[Yamllint](https://yamllint.readthedocs.io/en/stable/) is a linter for YAML. + +## Files + +Yamllint will run on files with the following extensions: + +- `.yaml` +- `.yml` + +## Configuration + +Yamllint supports the following config files: + +- `.yamllint` +- `.yamllint.yaml` +- `.yamllint.yml` + +CodeRabbit will use the following settings based on the profile selected if no config file is found: + +### Chill + +```yaml +extends: relaxed +rules: + line-length: disable +``` + +### Assertive + +```yaml +extends: default +rules: + line-length: disable + document-start: disable +``` + +## Links + +- [Yamllint Configuration](https://yamllint.readthedocs.io/en/stable/configuration.html) From 9276d9954a2dc6d57a6faf7a4e78349eae2efc01 Mon Sep 17 00:00:00 2001 From: Hasit Mistry Date: Mon, 15 Jul 2024 10:49:39 -0700 Subject: [PATCH 13/13] Add Checkov and Gitleaks documentation and configuration --- docs/guides/tools/checkov.md | 63 ++++++++++++++++++++++++++++++ docs/guides/tools/gitleaks.md | 22 +++++++++++ docs/guides/tools/golangci-lint.md | 2 +- docs/guides/tools/tools.md | 2 + docs/guides/tools/yamllint.md | 2 +- 5 files changed, 89 insertions(+), 2 deletions(-) create mode 100644 docs/guides/tools/checkov.md create mode 100644 docs/guides/tools/gitleaks.md diff --git a/docs/guides/tools/checkov.md b/docs/guides/tools/checkov.md new file mode 100644 index 00000000..9600cb97 --- /dev/null +++ b/docs/guides/tools/checkov.md @@ -0,0 +1,63 @@ +--- +title: Checkov +sidebar_label: Checkov +description: CodeRabbit's guide to Checkov. +sidebar_position: 2 +--- + +[Checkov](https://www.checkov.io/) is a static code analysis tool for scanning Infrastructure as Code (IaC) files for misconfigurations. + +## Files + +Checkov will run on files with the following files and extensions: + +- `.tf` +- `.yml` +- `.yaml` +- `.json` +- `.template` +- `.bicep` +- `.hcl` +- `bower.json` +- `build.gradle` +- `build.gradle.kts` +- `go.sum` +- `gradle.properties` +- `METADATA` +- `npm-shrinkwrap.json` +- `package.json` +- `package-lock.json` +- `pom.xml` +- `requirements.txt` +- `Dockerfile` +- `.dockerfile` +- `Dockerfile.*` +- `.csproj` +- `yarn.lock` +- `Gemfile` +- `Gemfile.lock` +- `go.mod` +- `paket.dependencies` +- `paket.lock` +- `packages.config` +- `composer.json` +- `composer.lock` + +## Configuration + +CodeRabbit will include on the following severity levels based on the profile selected: + +### Chill + +- `HIGH` +- `CRITICAL` + +### Assertive + +- `MEDIUM` +- `HIGH` +- `CRITICAL` + +## Links + +- [Checkov All Resource Scans](https://www.checkov.io/5.Policy%20Index/all.html) diff --git a/docs/guides/tools/gitleaks.md b/docs/guides/tools/gitleaks.md new file mode 100644 index 00000000..5103f8c3 --- /dev/null +++ b/docs/guides/tools/gitleaks.md @@ -0,0 +1,22 @@ +--- +title: Gitleaks +sidebar_label: Gitleaks +description: CodeRabbit's guide to Gitleaks. +sidebar_position: 11 +--- + +[Gitleaks](https://gitleaks.io/) is a secret-scanner. + +## Files + +Gitleaks will run on all files with the following extensions. + +## Configuration + +Gitleaks supports the following config files: + +- `gitleaks.toml` + +## Links + +- [Gitleaks Configuration](https://github.com/gitleaks/gitleaks#configuration) diff --git a/docs/guides/tools/golangci-lint.md b/docs/guides/tools/golangci-lint.md index ae7eb924..3f79ff25 100644 --- a/docs/guides/tools/golangci-lint.md +++ b/docs/guides/tools/golangci-lint.md @@ -2,7 +2,7 @@ title: golangci-lint sidebar_label: golangci-lint description: CodeRabbit's guide to golangci-lint. -sidebar_position: 8 +sidebar_position: 9 --- [golangci-lint](https://golangci-lint.run/) is a fast Go linters runner. diff --git a/docs/guides/tools/tools.md b/docs/guides/tools/tools.md index 9899dadb..e98eab1c 100644 --- a/docs/guides/tools/tools.md +++ b/docs/guides/tools/tools.md @@ -46,3 +46,5 @@ Remove extraneous f prefix - [PHPStan](./phpstan.md) - [golangci-lint](./golangci-lint.md) - [YamlLint](./yamllint.md) +- [Gitleaks](./gitleaks.md) +- [Checkov](./checkov.md) diff --git a/docs/guides/tools/yamllint.md b/docs/guides/tools/yamllint.md index 44e395de..e71542f3 100644 --- a/docs/guides/tools/yamllint.md +++ b/docs/guides/tools/yamllint.md @@ -2,7 +2,7 @@ title: Yamllint sidebar_label: Yamllint description: CodeRabbit's guide to Yamllint. -sidebar_position: 8 +sidebar_position: 10 --- [Yamllint](https://yamllint.readthedocs.io/en/stable/) is a linter for YAML.