No description
Find a file
Alexander Chuprov 420dd98c24 [#4] linters: Add check for source of constants
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2023-08-04 14:26:40 +03:00
.forgejo/workflows [#3] .forgejo: add tests.yml 2023-07-18 17:36:04 +03:00
internal/analyzers/noliteral [#4] linters: Add check for source of constants 2023-08-04 14:26:40 +03:00
.gitattributes Initial commit 2023-07-17 10:51:48 +00:00
.gitignore Initial commit 2023-07-17 10:51:48 +00:00
.gitlint Initial commit 2023-07-17 10:51:48 +00:00
.golangci.yml [#4] linters: Add check for source of constants 2023-08-04 14:26:40 +03:00
.pre-commit-config.yaml Initial commit 2023-07-17 10:51:48 +00:00
go.mod [#6] noliteral: add noliteral configuration 2023-08-01 14:39:49 +03:00
go.sum [#6] noliteral: add noliteral configuration 2023-08-01 14:39:49 +03:00
main.go [#4] linters: Add check for source of constants 2023-08-04 14:26:40 +03:00
Makefile [#5] linters: refactoring 2023-07-31 12:59:51 +03:00
README.md [#4] linters: Add check for source of constants 2023-08-04 14:26:40 +03:00

linters

Overview

linters is a project that enables the integration of custom linting rules into the golangci-lint framework.

Available linters

Name Description
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

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

    git clone git.frostfs.info/TrueCloudLab/linters
    cd linters
    make lib OUT_DIR=<Path to the directory with libraries>

Usage

Add to .golangci.yml


    linters-settings:
    custom:
        custom-linters:
            path: <Path to the directory with libraries>
            original-url: git.frostfs.info/TrueCloudLab/linters


    linters:
        enable:
            custom-linters