You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to be able to use mnd for most things but skip it in situations like the following where "function chaining" is used to "compose" things:
huh.NewText().
Title("Special Instructions").
CharLimit(400). // <--- I think that this "magic number" is fine, given the context of how it's supposed to be usedValue(&instructions),
Right now, it's not really clear how I should do this, given the available options.
Steps to reproduce the behavior
Follow the tutorial for the huh package and then run go-mnd on the code. You'll get an output like the following (I'm using golangci-lint to run this tool, if that matters):
cmd/test.go:60:12: Magic number: 4, in <argument> detected (mnd)
Limit(4). // there’s a 4 topping limit!
^
cmd/test.go:71:30: Magic number: 2, in <argument> detected (mnd)
huh.NewOption("A lot", 2),
^
cmd/test.go:92:16: Magic number: 400, in <argument> detected (mnd)
CharLimit(400).
The second one I can understand as "magic" numbers, but the first and third I think are "fine". I want to get this tool to ignore those, but it's not really clear without just adding Limit or whatever as a regex, which I think is probably not specific enough. I just want to make sure that huh's Limit and CharLimit are ignored, and if I use some other package with Limit those are still checked.
It seems like most of my confusion stems from the fact that it's not clear how I'm supposed to deal with "chained" functions like what are used in the huh library.
go-mnd version or commit ref
Whatever is current when running golangci-lint latest.
Go version (output of 'go version')
$ go version
go version go1.22.4 darwin/arm64
Operating system / Environment
macOS 14.5
Expected behavior
I expected to be able to pass '^huh\.' as an option for functions to ignore everything chained by huh.<whatever> methods.
Actual behavior
It doesn't work. It seems to only support ignoring a function call that initially starts with huh, but it doesn't continue checking chained methods. I would like a way to do that.
The text was updated successfully, but these errors were encountered:
Short summary
I would like to be able to use
mnd
for most things but skip it in situations like the following where "function chaining" is used to "compose" things:Right now, it's not really clear how I should do this, given the available options.
Steps to reproduce the behavior
Follow the tutorial for the
huh
package and then rungo-mnd
on the code. You'll get an output like the following (I'm usinggolangci-lint
to run this tool, if that matters):The second one I can understand as "magic" numbers, but the first and third I think are "fine". I want to get this tool to ignore those, but it's not really clear without just adding
Limit
or whatever as a regex, which I think is probably not specific enough. I just want to make sure thathuh
'sLimit
andCharLimit
are ignored, and if I use some other package withLimit
those are still checked.It seems like most of my confusion stems from the fact that it's not clear how I'm supposed to deal with "chained" functions like what are used in the
huh
library.go-mnd version or commit ref
Whatever is current when running
golangci-lint
latest.Go version (output of 'go version')
Operating system / Environment
macOS 14.5
Expected behavior
I expected to be able to pass
'^huh\.'
as an option for functions to ignore everything chained byhuh.<whatever>
methods.Actual behavior
It doesn't work. It seems to only support ignoring a function call that initially starts with
huh
, but it doesn't continue checking chained methods. I would like a way to do that.The text was updated successfully, but these errors were encountered: