Skip to content

Commit 9a0c43e

Browse files
committed
doc: update readme with recent features
1 parent 1d869e4 commit 9a0c43e

File tree

5 files changed

+209
-148
lines changed

5 files changed

+209
-148
lines changed

README.md

Lines changed: 94 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -6,32 +6,31 @@
66

77
[中文](./README_zh.md)
88

9-
Reviewbot assists you in rapidly establishing a self-hosted code analysis and review service, supporting multiple languages and coding standards. It is particularly suitable for organizations with numerous private repositories.
9+
Reviewbot assists you in rapidly establishing a self-hosted code analysis and review service, supporting multiple languages and coding standards. Its main features include:
1010

11-
All issues are reported during the Pull Request stage, either as `Review Comments` or `Github Annotations`, precisely pinpointing the relevant code lines.
11+
- **Universal Compatibility** - Provides a universal way to integrate and execute Linters without coding
12+
- **Multi-Platform Support** - Currently supports both GitHub and GitLab
13+
- **AI-Powered** - Detected issues are analyzed by AI to provide detailed explanations and improvement suggestions
14+
- **Precise Feedback** - All issues are reported during the Pull/Merge Request stage as comments, precisely pinpointing the relevant code lines
15+
- **Self-Hosted Deployment** - Recommended self-hosting for better data security and control
1216

13-
- Github Check Run (Annotations)
17+
See practical examples:
1418

15-
<div style="display: flex; justify-content: flex-start; gap: 10px;">
16-
<img src="./docs/static/github-check-run.png" alt="Github Check Run" width="467"/>
17-
<img src="./docs/static/github-check-run-annotations.png" alt="Github Check Run Annotations" width="467"/>
18-
</div>
19-
20-
- Github Pull Request Review Comments
21-
<div style="display: flex; justify-content: flex-start;">
22-
<img src="./docs/static/github-pr-review-comments.png" alt="Github Pull Request Review Comments" width="467"/>
23-
</div>
24-
25-
This approach helps PR authors avoid searching for issues in lengthy console logs, significantly facilitating problem resolution.
26-
27-
[see introduction blog](https://medium.com/@dacarl.ji/reviewbot-boost-your-code-quality-with-self-hosted-automated-analysis-and-review-83d8a459eb70)
19+
<div style="display: flex; justify-content: flex-start; gap: 10px;">
20+
<img src="./docs/static/issue-comment.png" alt="Issue Comment" width="467"/>
21+
<img src="./docs/static/ci-status.png" alt="CI Status" width="467"/>
22+
</div>
2823

2924
## Table of Contents
3025

3126
- [Why Reviewbot](#why-reviewbot)
3227
- [Installation](#installation)
28+
- [Linter Integration Guide](#linter-integration-guide)
29+
- [Universal Integration (No Coding Required)](#universal-linter-integration-no-coding-required)
30+
- [Custom Integration](#custom-integration)
3331
- [Supported Linters](#supported-linters)
3432
- [Go](#go)
33+
- [Python](#python)
3534
- [C/C++](#cc)
3635
- [Lua](#lua)
3736
- [Java](#java)
@@ -44,23 +43,23 @@ This approach helps PR authors avoid searching for issues in lengthy console log
4443
- [Cloning multiple repositories](#cloning-multiple-repositories)
4544
- [Executing Linters via Docker](#executing-linters-via-docker)
4645
- [Executing Linters via Kubernetes](#executing-linters-via-kubernetes)
46+
- [AI Enhancement](#ai-enhancement)
4747
- [Reviewbot Operational Flow](#reviewbot-operational-flow)
48-
- [How to add a new Linter](#how-to-add-a-new-linter)
4948
- [Monitoring Detection Results](#monitoring-detection-results)
5049
- [Contributing](#contributing)
5150
- [License](#license)
5251

5352
## Why Reviewbot
5453

55-
Reviewbot is a self-hosted code analysis and review service supporting multiple languages and coding standards. It is particularly beneficial for organizations with numerous private repositories:
54+
Reviewbot is a self-hosted code analysis and review service with the following features:
5655

56+
- **Universal Compatibility** - Provides a universal way to integrate new code checking tools without modifying source code
57+
- **Multi-Platform Support** - Currently supports both GitHub and GitLab platforms
58+
- **AI-Powered** - Issues detected are analyzed by AI to provide detailed context and fix suggestions
5759
- **Security** - Recommended self-hosting for data security and control
58-
- **Improvement-Oriented** - Detected issues are primarily reported in the form of Review Comments or Github Annotations, facilitating efficient problem resolution and code improvement
59-
- **Flexibility** - Supports multiple languages and coding standards, with easy integration of new code inspection tools
60+
- **Improvement-Oriented** - Detected issues are primarily reported as comments precise to code lines, facilitating efficient problem resolution
61+
- **Flexibility** - Supports multiple languages and coding standards with flexible configuration
6062
- **Observability** - Supports alert notifications for timely awareness of detected issues
61-
- **Configurable** - Supports configuration of linter execution commands, parameters, and environments, providing flexibility for complex scenarios
62-
63-
Reviewbot is developed using Golang, featuring simple logic and clear code, making it easy to understand and maintain.
6463

6564
## Installation
6665

@@ -71,14 +70,65 @@ The following are internal usage practices at Qiniu, which may provide you with
7170
- Deployed in a [Kubernetes cluster](https://github.com/qiniu/reviewbot/tree/master/deploy/reviewbot.yaml)
7271
- Using this [Dockerfile](https://github.com/qiniu/reviewbot/tree/master/Dockerfile) to build the Reviewbot image
7372

73+
## Linter Integration Guide
74+
75+
### Universal Linter Integration (No Coding Required)
76+
77+
Reviewbot provides a universal way to integrate new code checking tools without modifying the source code.
78+
79+
For example:
80+
81+
```yaml
82+
customLinters:
83+
pylint:
84+
languages: [".py"] # Specify supported languages
85+
command: ["/bin/sh", "-c", "--"] # Specify execution command
86+
args: # Specify execution arguments
87+
- |
88+
pylint --disable=line-too-long --output-format=text --msg-template='{path}:{line}:{column}: {msg} ({symbol})' --reports=n --score=n --recursive=y ./
89+
```
90+
91+
Complete configuration reference:
92+
93+
```yaml
94+
customLinters:
95+
<linter-name>:
96+
languages: <language-list> # optional, specify supported languages
97+
enable: <true|false> # optional, enable/disable this linter
98+
workDir: <work-dir> # optional, specify working directory
99+
command: <command-list> # optional, specify execution command
100+
args: <args-list> # optional, specify execution arguments
101+
env: <env-list> # optional, specify environment variables
102+
dockerAsRunner: # optional, use Docker image to execute linter
103+
image: <docker-image>
104+
kubernetesAsRunner: # optional, use Kubernetes to execute linter
105+
namespace: <kubernetes-namespace>
106+
image: <kubernetes-image>
107+
reportType: <report-type> # optional, specify report type
108+
configPath: <config-path> # optional, specify linter config file path
109+
```
110+
111+
### Custom Integration
112+
113+
For more complex scenarios, you can also consider code integration:
114+
115+
- For self-implemented linters or standards, refer to [commit msg check](/internal/linters/git-flow/commit/), [go mod check](/internal/linters/go/gomodcheck/), etc.
116+
- For customizing linter execution logic in complex scenarios, refer to [golangci-lint](/internal/linters/go/golangci_lint/), [gofmt](/internal/linters/go/gofmt/), etc.
117+
74118
## Supported Linters
75119
120+
The following are the linters currently supported by Reviewbot:
121+
76122
### Go
77123
78124
- [golangci-lint](/internal/linters/go/golangci_lint/)
79125
- [gofmt](/internal/linters/go/gofmt/)
80126
- [gomodcheck](/internal/linters/go/gomodcheck/)
81127
128+
### Python
129+
130+
- pylint
131+
82132
### C/C++
83133
84134
- [cppcheck](/internal/linters/c/cppcheck/)
@@ -106,9 +156,7 @@ The following are internal usage practices at Qiniu, which may provide you with
106156
107157
## Configuration
108158
109-
Reviewbot adheres to a **zero-configuration principle** whenever possible, with fixed code logic for general repository inspections. However, some special requirements can be met through configuration.
110-
111-
Note: All configurable items are defined in the `config/config.go` file. Please refer to this file for detailed configuration options.
159+
Reviewbot adheres to a **zero-configuration principle** whenever possible, but also provides flexible configuration capabilities for special requirements. All configurable items are defined in the `config/config.go` file.
112160

113161
The following are some common configuration scenarios:
114162

@@ -164,6 +212,14 @@ qbox/net-gslb:
164212

165213
This configuration means that the `golangci-lint` check is disabled for the `qbox/net-gslb` repository.
166214

215+
We can also globally disable a linter, like this:
216+
217+
```yaml
218+
customLinters:
219+
golangci-lint:
220+
enable: false
221+
```
222+
167223
### Cloning multiple repositories
168224

169225
By default, Reviewbot clones the repository where the event occurs. However, in some scenarios, we might want to clone multiple repositories, and customizing the cloning path.
@@ -216,52 +272,20 @@ qiniu/reviewbot:
216272
namespace: "reviewbot"
217273
```
218274

275+
## AI Enhancement
276+
277+
Reviewbot integrates AI analysis capabilities to provide more detailed explanations and improvement suggestions for detected issues:
278+
279+
![AI Enhancement](./docs/static/ai-details.png)
280+
219281
## Reviewbot Operational Flow
220282

221-
Reviewbot primarily operates as a GitHub Webhook service, accepting GitHub Events, executing various checks, and providing precise feedback on the corresponding code if issues are detected.
283+
Reviewbot primarily operates as a Webhook service, accepting GitHub or GitLab Events, executing various checks, and providing precise feedback on the corresponding code if issues are detected.
222284

223285
```
224-
Github Event -> Reviewbot -> Execute Linter -> Provide Feedback
286+
Webhook Event -> Reviewbot -> Execute Linter -> Provide Feedback
225287
```
226288
227-
### Basic Flow:
228-
229-
- Event received, determine if it's a Pull Request
230-
- Retrieve code:
231-
- Get the code affected by the PR
232-
- Clone the main repository
233-
- The main repository serves as a cache
234-
- Checkout the PR and place it in a temporary directory
235-
- Pull submodules
236-
- If the repository uses submodule management, code is automatically pulled
237-
- Enter Linter execution logic
238-
- Filter linters
239-
- By default, all supported linters apply to all repositories unless individually configured
240-
- Individual configurations need to be explicitly specified in the configuration file
241-
- Explicitly specified configurations override default configurations
242-
- Execute linter
243-
- General logic
244-
- Execute the corresponding command and obtain the output results
245-
- Filter the output results, only obtaining the parts relevant to this PR
246-
- Some linters focus on code
247-
- Some linters focus on other aspects
248-
- Provide feedback
249-
- Some linters provide Code Comments, precise to the code line
250-
- Some linters provide issue comments
251-
252-
## How to Add a New Linter?
253-
254-
- Please select an Issue you want to address from the [issues](https://github.com/qiniu/reviewbot/issues) list.
255-
- Of course, if there isn't one, you can first create an Issue describing the Linter you want to add
256-
- Coding
257-
- Based on the language or domain the linter focuses on, [choose the appropriate code location](https://github.com/qiniu/reviewbot/tree/master/internal/linters)
258-
- The implementation logic for most linters is divided into three main parts:
259-
- Execute the linter, generally by calling the relevant executable program
260-
- Process the linter's output, focusing only on the output related to the current PR
261-
- Provide feedback on the output related to the current PR, precise to the code line
262-
- Deployment: If your linter is an external executable program, you'll need to add instructions on how to install this linter in the [Dockerfile](https://github.com/qiniu/reviewbot/blob/master/Dockerfile)
263-
- Documentation: To facilitate subsequent use and maintenance, we should [add appropriate documentation here](https://github.com/qiniu/reviewbot/tree/master/docs/website/docs/components)
264-
265289
## Monitoring Detection Results
266290
267291
Reviewbot supports notification of detection results through WeWork (企业微信) alerts. For specific implementation details, refer to [here](https://github.com/qiniu/reviewbot/blob/8bfb122a2e4292f1cc74aedab8f51d1a0c149d55/internal/metric/metrics.go#L17).
@@ -280,6 +304,10 @@ If unexpected output is encountered, notifications will also be sent, like this:
280304
281305
For unexpected outputs, **it usually means that the default execution configuration of the relevant linter does not support the current repository**. In such cases, you need to explicitly specify the configuration through a configuration file based on the actual situation.
282306
307+
## Give it a Star! ⭐
308+
309+
If you like this project or are using it to learn or start your own solution, please give it a star to receive updates about new versions. Your support matters!
310+
283311
## Contributing
284312
285313
Your contributions to Reviewbot are essential for its long-term maintenance and improvement. Thanks for supporting Reviewbot!

0 commit comments

Comments
 (0)