noliteral: add noliteral configuration #6

Merged
dstepanov-yadro merged 2 commits from achuprov/linters:noliteral-configuration into master 2024-09-04 19:51:22 +00:00
3 changed files with 3 additions and 14 deletions
Showing only changes of commit a1a45f5368 - Show all commits

View file

@ -12,6 +12,8 @@ import (
)
func TestAnalyzer_negative(t *testing.T) {
const countNegativeCases = 4
_, filename, _, _ := runtime.Caller(0)
dir := filepath.Dir(filename)
@ -32,7 +34,7 @@ func TestAnalyzer_negative(t *testing.T) {
_, err = run(pass)

From 1 magic number to another, can we replace with a constant/some function? Is this len(Config.TargetMethods?

From 1 magic number to another, can we replace with a constant/some function? Is this `len(Config.TargetMethods`?
if Count != 6 {
if Count != countNegativeCases {
t.Fail()
}
if err != nil {

View file

@ -17,15 +17,6 @@ func (c *cfg) error_n() {
c.log.Error("logs.MSG") //unacceptable
}
func (c *cfg) reportFlushError_n() {
c.log.reportFlushError("logs.MSG") //unacceptable
}
func (c *cfg) reportError_n() {
c.log.reportError("logs.MSG") //unacceptable
}
type Logger interface {
Debug(msg string)

View file

@ -24,10 +24,6 @@ func (c *cfg) custom_ok_lit() {
c.log.Abyr("logs.MSG") //acceptable
}
func (c *cfg) custom_ok_lit() {
log.Abyr("logs.MSG") //acceptable
}
type Logger interface {
Debug(msg string)
Info(msg string)