go-ruleguard: Flaky results: Same rule produces different results (Root cause: regexp not getting parsed)
My rules:
func _(m fluent.Matcher) {
m.Match(`$s != $t`).Where(m["s"].Const && !m["t"].Const).Suggest(`$t != $s`)
m.Match(`$s == $t`).Where(m["s"].Const && !m["t"].Const).Suggest(`$t == $s`)
m.Match(`$s >= $t`).Where(m["s"].Const && !m["t"].Const).Suggest(`$t <= $s`)
m.Match(`$s <= $t`).Where(m["s"].Const && !m["t"].Const).Suggest(`$t >= $s`)
m.Match(`$s > $t`).Where(m["s"].Const && !m["t"].Const).Suggest(`$t < $s`)
m.Match(`$s < $t`).Where(m["s"].Const && !m["t"].Const).Suggest(`$t > $s`)
m.Match(`nil == $s`).Where(!m["s"].Const).Suggest(`$s == nil`)
m.Match(`nil != $s`).Where(!m["s"].Const).Suggest(`$s != nil`)
m.Match(`log.Infof($s)`).Where(m["s"].Const && m["s"].Type.Is(`string`)).Suggest(`log.Info($s)`)
m.Match(`log.Warnf($s)`).Where(m["s"].Const && m["s"].Type.Is(`string`)).Suggest(`log.Warn($s)`)
m.Match(`log.Errorf($s)`).Where(m["s"].Const && m["s"].Type.Is(`string`)).Suggest(`log.Error($s)`)
}
Results:
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 18 (7 by maintainers)
Commits related to this issue
- ruleguard: ignore match expr width limit for suggestions It does make sense to truncate output when printing the suggestions to the stdout. It's bad if we try to apply the truncated suggestions to a ... — committed to quasilyte/go-ruleguard by quasilyte 4 years ago
- ruleguard: ignore match expr width limit for suggestions (#63) It does make sense to truncate output when printing the suggestions to the stdout. It's bad if we try to apply the truncated suggestio... — committed to quasilyte/go-ruleguard by quasilyte 4 years ago
Thank you! This is helpful indeed. It will ease the issue pinpointing significantly.
Nothing special about my go projects, it is a go module which works perfectly fine with go vet/fmt/build/install.
Tried this rules.go:
Results still same:
In order to understand why it happens, I need to reproduce it. I’ll try finding the minimal repro.