Skip to content

Commit 15e6d46

Browse files
committed
docs: add Flake8, PHPMD, PHPCS to template & reference (fix #428)
1 parent b296a2f commit 15e6d46

File tree

3 files changed

+166
-0
lines changed

3 files changed

+166
-0
lines changed

‎docs/reference/configuration.md

Lines changed: 123 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2850,6 +2850,47 @@ ESLint is a static code analysis tool for JavaScript files.
28502850

28512851
ESLint is a static code analysis tool for JavaScript files.
28522852

2853+
### Flake8
2854+
2855+
Flake8 is a static code analysis tool for Python files.
2856+
2857+
#### Enable Flake8
2858+
2859+
<Tabs groupId="config-setting">
2860+
<TabItem value="web-ui" label="Web UI">
2861+
<table>
2862+
<tbody>
2863+
<tr>
2864+
<td><strong>Location</strong></td>
2865+
<td>Review &gt; Tools &gt; Enable Flake8</td>
2866+
</tr>
2867+
<tr>
2868+
<td><strong>Default</strong></td>
2869+
<td>true</td>
2870+
</tr>
2871+
</tbody></table>
2872+
</TabItem>
2873+
<TabItem value="yaml" label=".coderabbit.yaml" default>
2874+
<table>
2875+
<tbody>
2876+
<tr>
2877+
<td><strong>Field</strong></td>
2878+
<td>`reviews.tools.flake8.enabled`</td>
2879+
</tr>
2880+
<tr>
2881+
<td><strong>Datatype</strong></td>
2882+
<td>boolean</td>
2883+
</tr>
2884+
<tr>
2885+
<td><strong>Default</strong></td>
2886+
<td>true</td>
2887+
</tr>
2888+
</tbody></table>
2889+
</TabItem>
2890+
</Tabs>
2891+
2892+
Flake8 is a static code analysis tool for Python files.
2893+
28532894
### GitHub Checks
28542895

28552896
GitHub Checks integration configuration.
@@ -3671,6 +3712,88 @@ PMD is an extensible multilanguage static code analyzer. It’s mainly concerned
36713712

36723713
Enable PMD.
36733714

3715+
### PHPMD
3716+
3717+
PHPMD is a static code analysis tool for PHP files.
3718+
3719+
#### Enable PHPMD
3720+
3721+
<Tabs groupId="config-setting">
3722+
<TabItem value="web-ui" label="Web UI">
3723+
<table>
3724+
<tbody>
3725+
<tr>
3726+
<td><strong>Location</strong></td>
3727+
<td>Review &gt; Tools &gt; Enable PHPMD</td>
3728+
</tr>
3729+
<tr>
3730+
<td><strong>Default</strong></td>
3731+
<td>true</td>
3732+
</tr>
3733+
</tbody></table>
3734+
</TabItem>
3735+
<TabItem value="yaml" label=".coderabbit.yaml" default>
3736+
<table>
3737+
<tbody>
3738+
<tr>
3739+
<td><strong>Field</strong></td>
3740+
<td>`reviews.tools.phpmd.enabled`</td>
3741+
</tr>
3742+
<tr>
3743+
<td><strong>Datatype</strong></td>
3744+
<td>boolean</td>
3745+
</tr>
3746+
<tr>
3747+
<td><strong>Default</strong></td>
3748+
<td>true</td>
3749+
</tr>
3750+
</tbody></table>
3751+
</TabItem>
3752+
</Tabs>
3753+
3754+
PHPMD is a static code analysis tool for PHP files.
3755+
3756+
### PHPCS
3757+
3758+
PHPCS is a static code analysis and coding-standard checker for PHP (plus JS/CSS) files.
3759+
3760+
#### Enable PHPCS
3761+
3762+
<Tabs groupId="config-setting">
3763+
<TabItem value="web-ui" label="Web UI">
3764+
<table>
3765+
<tbody>
3766+
<tr>
3767+
<td><strong>Location</strong></td>
3768+
<td>Review &gt; Tools &gt; Enable PHPCS</td>
3769+
</tr>
3770+
<tr>
3771+
<td><strong>Default</strong></td>
3772+
<td>true</td>
3773+
</tr>
3774+
</tbody></table>
3775+
</TabItem>
3776+
<TabItem value="yaml" label=".coderabbit.yaml" default>
3777+
<table>
3778+
<tbody>
3779+
<tr>
3780+
<td><strong>Field</strong></td>
3781+
<td>`reviews.tools.phpcs.enabled`</td>
3782+
</tr>
3783+
<tr>
3784+
<td><strong>Datatype</strong></td>
3785+
<td>boolean</td>
3786+
</tr>
3787+
<tr>
3788+
<td><strong>Default</strong></td>
3789+
<td>true</td>
3790+
</tr>
3791+
</tbody></table>
3792+
</TabItem>
3793+
</Tabs>
3794+
3795+
PHPCS is a static code analysis tool for PHP, JavaScript and CSS files.
3796+
36743797
#### Config File
36753798

36763799
<Tabs groupId="config-setting">

‎docs/reference/yaml-template.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,8 @@ reviews:
107107
config_file: ""
108108
eslint:
109109
enabled: true
110+
flake8:
111+
enabled: true
110112
rubocop:
111113
enabled: true
112114
buf:
@@ -118,6 +120,10 @@ reviews:
118120
pmd:
119121
enabled: true
120122
config_file: ""
123+
phpmd:
124+
enabled: true
125+
phpcs:
126+
enabled: true
121127
cppcheck:
122128
enabled: true
123129
semgrep:

‎docs/tools/flake8.md

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
---
2+
title: Flake8
3+
sidebar_label: Flake8
4+
description: CodeRabbit's guide to Flake8.
5+
---
6+
7+
```mdx-code-block
8+
import ProPlanNotice from '@site/src/components/ProPlanNotice.mdx';
9+
10+
<ProPlanNotice />
11+
```
12+
13+
[Flake8](https://flake8.pycqa.org/en/latest/) is a static code analysis tool for Python that wraps PyFlakes (error detection), pycodestyle (PEP 8 style rules) and McCabe (cyclomatic-complexity measurement) to catch a wide range of issues in a single pass.
14+
15+
## Supported Files
16+
17+
Flake8 runs on files with the following extension:
18+
19+
- `*.py`
20+
21+
## Features
22+
Flake8 can detect many issues, including:
23+
24+
- PEP 8 style-guide violations
25+
- Unused or re-defined variables and imports
26+
- Undefined names / variables
27+
- Cyclomatic-complexity over threshold (default 10)
28+
- Error-prone constructs (e.g., comparison to literal True / False)
29+
- Select / ignore rule filtering (--select, --extend-ignore)
30+
- Extensible plugin ecosystem and custom rule support
31+
32+
## Links
33+
34+
- [Flake8 Official Website](https://flake8.pycqa.org/en/latest/)
35+
- [Flake8 PyPI Page](https://pypi.org/project/flake8/)
36+
- [Flake8 GitHub Repository](https://github.com/PyCQA/flake8)
37+
- [User Guide](https://flake8.pycqa.org/en/latest/)

0 commit comments

Comments
 (0)