No description
Find a file
Evgenii Stratonikov 007db8eff4 [#25] .golangci.yml: Replace exportloopref with copyloopvar
Fix the warning:
```
WARN The linter 'exportloopref' is deprecated (since v1.60.2) due to: Since Go1.22 (loopvar) this linter is no longer relevant. Replaced by copyloopvar.
```

Signed-off-by: Evgenii Stratonikov <e.stratonikov@yadro.com>
2024-08-28 14:23:46 +03:00
.forgejo/workflows [#1316] go.mod: Upgrade go version to 1.22 2024-08-21 14:22:21 +03:00
internal/analyzers [#16] noliteral: Fix nested functions 2024-02-13 19:45:34 +03:00
pkg/ast-utils [#10] linters: Add support for the nolint comment 2023-08-17 16:24:25 +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 [#25] .golangci.yml: Replace exportloopref with copyloopvar 2024-08-28 14:23:46 +03:00
.pre-commit-config.yaml Initial commit 2023-07-17 10:51:48 +00:00
go.mod [#1316] go.mod: Upgrade go version to 1.22 2024-08-21 14:22:21 +03:00
go.sum [#1316] go.mod: Upgrade go version to 1.22 2024-08-21 14:22:21 +03:00
LICENSE [#19] docs: Add license 2024-02-12 17:51:17 +03:00
main.go [#10] linters: Add useStrconv linter 2023-08-17 16:24:21 +03:00
Makefile [#25] Makefile: Use -trimpath while building 2024-08-28 14:23:46 +03:00
README.md [#10] linters: Add useStrconv linter 2023-08-17 16:24:21 +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:
        truecloudlab-linters:
            path: <Path to the directory with libraries>
            original-url: git.frostfs.info/TrueCloudLab/linters


    linters:
        enable:
            truecloudlab-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.
useStrconv The useStrconv linter recommends the utilization of strconv over fmt when performing string conversions of primitive data types. Detailed guidelines can be found in the official Uber Go Style Guide.

Linters Configuration

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

noliteral

File Configuration
linters-settings:
    custom:
        truecloudlab-linters:
            path: .bin/external_linters.so
            original-url: git.frostfs.info/TrueCloudLab/linters.git
            settings:
                noliteral:
                    enable: true # optional
                    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

useStrconv

File Configuration
linters-settings:
    custom:
        truecloudlab-linters:
            path: .bin/external_linters.so
            original-url: git.frostfs.info/TrueCloudLab/linters.git
            settings:
                useStrconv: # optional
                    enable: true