woodpecker/vendor/gitlab.com/bosi/decorder
6543 56a854fe14
Update deps (#789)
* update github.com/docker/cli

* update github.com/docker/distribution

* update github.com/docker/docker

* update github.com/gin-gonic/gin

* update github.com/golang-jwt/jwt/v4

* update github.com/golangci/golangci-lint

* update github.com/gorilla/securecookie

* update github.com/mattn/go-sqlite3

* update github.com/moby/moby

* update github.com/prometheus/client_golang

* update github.com/xanzy/go-gitlab
2022-02-24 17:33:24 +01:00
..
.gitignore Update deps (#789) 2022-02-24 17:33:24 +01:00
.gitlab-ci.params.yml Update deps (#789) 2022-02-24 17:33:24 +01:00
.gitlab-ci.yml Update deps (#789) 2022-02-24 17:33:24 +01:00
analyzer.go Update deps (#789) 2022-02-24 17:33:24 +01:00
go.mod Update deps (#789) 2022-02-24 17:33:24 +01:00
go.sum Update deps (#789) 2022-02-24 17:33:24 +01:00
LICENSE.md Update deps (#789) 2022-02-24 17:33:24 +01:00
Makefile Update deps (#789) 2022-02-24 17:33:24 +01:00
README.md Update deps (#789) 2022-02-24 17:33:24 +01:00
renovate.json Update deps (#789) 2022-02-24 17:33:24 +01:00

Decorder

A declaration order linter for golang. In case of this tool declarations are type, const, var and func.

Rules

This linter applies multiple rules where each can be disabled via cli parameter.

rule description cli-options
declaration order Enforces the order of global declarations (e.g. all global constants are always defined before variables). You can also define a subset of declarations if you don't want to enforce the order of all of them. * disable check: -disable-dec-order-check
* custom order: -dec-order var,const,func,type
declaration number Enforces that the statements const, var and type are only used once per file. You have to use parenthesis to declare e.g multiple global types inside a file. disable check: -disable-dec-num-check
init func first Enforces the init func to be the first function in file. disable check: -disable-init-func-first-check

You may find the implementation of the rules inside analyzer.go.

Installation

go install gitlab.com/bosi/decorder/cmd/decorder

Usage

# with default options
decorder ./...

# custom declaration order
decorder -dec-order var,const,func,type ./...

# disable declaration order check
decorder -disable-dec-order-check ./...

# disable check for multiple declarations statements
decorder -disable-dec-num-check ./...

# disable check that init func is always first function
decorder -disable-init-func-first-check ./...