Skip to content

How to disable rule.exported for consts? #1045

Closed
@Potherca

Description

@Potherca

TL;DR:

I am aware that the goal of this project is no longer to be a 100% drop-in replacement for golint (which I think is fair) but is there a way for me to disable the exported rule but only for consts?

Full Details

At pipeline-components we have a component for go-lint. Although it is not one of our larger components[1], I'm thinking of prolonging support by replacing golint with revive.

However, the current claim that the default behaviour is the same as golint does not appear to be 100% accurate.

To be specific, I am seeing the following warnings from revive that are not there with golint:

  1. "should have a package comment"
  2. "this block is empty, you can remove it"
  3. "comment on exported const [..] should be of the form [..]"

The first two I can resolve by tweaking the default config,[2], which is fine for our purposes (as golint does not have a config, so we can just add one for revive).

But I have not yet been able to resolve the comment on exported const [..] should be of the form [..]. Please note, this is explicitly about exported "const", not other exported types.

How could this be achieved?


[1] Currently it only has +/- 40K pulls on DockerHub

[2] Click to see config
ignoreGeneratedHeader = false
severity = "warning"
confidence = 0.8
errorCode = 0
warningCode = 0

[rule.blank-imports]
[rule.context-as-argument]
[rule.context-keys-type]
[rule.dot-imports]
[rule.empty-block]
    Disabled = true
[rule.errorf]
[rule.error-naming]
[rule.error-return]
[rule.error-strings]
[rule.exported]
[rule.increment-decrement]
[rule.indent-error-flow]
[rule.package-comments]
     Disabled = true
[rule.range]
[rule.receiver-naming]
[rule.redefines-builtin-id]
[rule.superfluous-else]
[rule.time-naming]
[rule.unexported-return]
[rule.unreachable-code]
[rule.unused-parameter]
[rule.var-declaration]
[rule.var-naming]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions