1
0
mirror of https://github.com/mgechev/revive.git synced 2024-11-24 08:32:22 +02:00
revive/DEVELOPING.md

55 lines
1.1 KiB
Markdown
Raw Normal View History

2018-06-02 19:14:21 +02:00
# Developer's Guide
This document explains how to build, test, and develop features for revive.
## Installation
In order to install all the dependencies run:
```bash
go get -u github.com/mgechev/revive
cd $GOPATH/src/github.com/mgechev/revive
```
2018-09-17 21:23:14 +02:00
After that install the dependencies using go modules:
2018-06-02 19:14:21 +02:00
```bash
make install
```
## Build
In order to build the project run:
```bash
make build
```
The command will produce the `revive` binary in the root of the project.
## Development of rules
If you want to develop a new rule, follow as an example the already existing rules in the [rule package](https://github.com/mgechev/revive/tree/master/rule).
All rules should implement the following interface:
```go
type Rule interface {
Name() string
Apply(*File, Arguments) []Failure
}
```
## Development of formatters
If you want to develop a new formatter, follow as an example the already existing formatters in the [formatter package](https://github.com/mgechev/revive/tree/master/formatter).
All formatters should implement the following interface:
```go
type Formatter interface {
Format(<-chan Failure, RulesConfig) (string, error)
Name() string
}
```