Skip to content

make decorder usable #3138

Closed
Closed
@jabielecki

Description

@jabielecki

Your feature request related to a problem? Please describe.

Currently, when a user adds the decorder linter the default configuration makes the linter silently ignore all its findings.

Consider cognitive load. For a vaguely interested user, it's already a hop to find a relevant linter in the list. Enabling that linter is another hop. Frustratingly, nothing happens. Learning about per-linter configs would be the 3rd hop and configuring this specific linter is the 4th hop.

Let's skip hops 3 and 4.

Describe the solution you'd like.

Change the above defaults for decorder in a major release (v2) to:

		DisableDecNumCheck:        true,
		DisableDecOrderCheck:      false,
		DisableInitFuncFirstCheck: false,

(Leaving the first one true as it was, but it's only a subjective suggestion.)

Describe alternatives you've considered.

Change the defaults for decorder in a minor v1.x release. This doesn't impact users who run the default set of linters, because decorder isn't one. There are however users who enable decorder and such a minor version upgrade would very likely get them new findings.

Additional context.

Example of the findings under the new settings:

type A struct{}

var my A
var yours A

type X int  # finding: type must not be placed after var

func NewA() A {
     return A{}
}

func (a A) Println() {
    fmt.Println(a)
}

func init() { # finding: init func must be the first function in file
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or improvementwon't fixThis will not be worked on

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions