mgechev/revive

Allow to ignoring "unhandled errors" by their type and method

Aberta

#671 aberto em 7 de abr. de 2022

 (6 comentários) (1 reação) (0 responsável)Go (316 forks)github user discovery
enhancementgood first issue

Métricas do repositório

Stars
 (5.517 estrelas)
Métricas de merge de PR
 (Mesclagem média 10h 48m) (3 fundiu PRs em 30d)

Description

Is your feature request related to a problem? Please describe.

When one is using the method "WriteString" of the type "strings::Builder" and does not handle the error it is flagged because all errors must be handled. However, This method never returns an error. Hence, it makes sense to ignore it (even by default).

The problem with revive is, that it does not allow to ignore methods with their type, since one can only ignore them with their variable name. So instead of "strings.Builder.WriteString" (or another annoation) to ignore it, i need to write "b.WriteString" (in our code this is one instance) which however, would include implementations that do return an error.

Describe the solution you'd like

Allow to define "strings.Builder.WriteString" (or "strings::Builder.WriteString") to allow to ignore the method "WriteString" of the type "Builder" in the package "strings".

Guia do colaborador