linters/README.md
Alexander Chuprov 1646e26225 [#4] linters: Add check for source of constants
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2023-08-07 19:12:14 +03:00

54 lines
No EOL
1.5 KiB
Markdown

# linters
## Overview
`linters` is a project that enables the integration of custom linting rules into the [golangci-lint](https://github.com/golangci/golangci-lint) framework.
## Available linters
| Name | Description |
| ----------------------- | --------------------------------------------------------------------------- |
| [noliteral](#noliteral) | The tool prohibits the use of literal string arguments in logging functions |
## Linters Configuration
The settings for linters are available if golangci-lint >= 1.5.4 is used.
### noliteral
```yml
linters-settings:
custom:
noliteral:
path: .bin/external_linters.so
original-url: git.frostfs.info/TrueCloudLab/linters.git
settings:
target-methods : ["reportFlushError", "reportError"] #optional. Enabled by default "Debug", "Info", "Warn", "Error"
constants-package: "git.frostfs.info/rep/logs" #if not set, then the check is disabled
```
## Installation
```bash
git clone git.frostfs.info/TrueCloudLab/linters
cd linters
make lib OUT_DIR=<Path to the directory with libraries>
```
## Usage
Add to .golangci.yml
```yml
linters-settings:
custom:
custom-linters:
path: <Path to the directory with libraries>
original-url: git.frostfs.info/TrueCloudLab/linters
linters:
enable:
custom-linters
```