No description
ci
Find a file
Alexander Chuprov f104963409
All checks were successful
Tests and linters / Tests (pull_request) Successful in 4m37s
Tests and linters / Build lib (pull_request) Successful in 4m48s
Tests and linters / Staticcheck (pull_request) Successful in 6m15s
Tests and linters / Lint (pull_request) Successful in 12m50s
[#9] makefile: add env CGO_ENABLED
Signed-off-by: Alexander Chuprov <a.chuprov@yadro.com>
2023-08-11 12:25:02 +03:00
.forgejo/workflows [#4] linters: add disable-packages option 2023-08-07 19:12:20 +03:00
internal/analyzers/noliteral [#4] linters: add disable-packages option 2023-08-07 19:12:20 +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 Initial commit 2023-07-17 10:51:48 +00:00
.pre-commit-config.yaml Initial commit 2023-07-17 10:51:48 +00:00
go.mod [#7] Bump required go version to go1.20 2023-08-09 16:20:26 +03:00
go.sum [#8] Bump required go version to go1.20 2023-08-09 17:22:41 +03:00
main.go [#4] linters: add disable-packages option 2023-08-07 19:12:20 +03:00
Makefile [#9] makefile: add env CGO_ENABLED 2023-08-11 12:25:02 +03:00
README.md [#4] linters: add disable-packages option 2023-08-07 19:12:20 +03:00

linters

Overview

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

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

Installation

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

Available linters

Name Description
noliteral The tool prohibits the use of literal string arguments in logging functions

Linters Configuration

Settings via a configuration file are available if golangci-lint >= 1.5.4 is used

noliteral

File Configuration
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"
                disable-packages: ["pkg1", "pkg2"] # List of packages for which the check should be disabled.
                constants-package: "git.frostfs.info/rep/logs" # if not set, then the check is disabled

ENV Configuration
Variable Description
NOLITERAL_TARGET_METHODS List of methods to analyze
NOLITERAL_DISABLE_PACKAGES List of packages for which the check should be disabled
NOLITERAL_CONSTANTS_PACKAGE Path to the package with constants

Note: You may need to clear the golangci-lint cache when configuring through ENV. More details can be found here.