xk6-disruptor
xk6-disruptor copied to clipboard
Improve linting and static analysis tooling
During the last months of development we've introduced some bugs or defects that we believe could have been caught by linters or static analysis tools. This issue aims to collect those cases, so we can check if those use cases are solvable with existing tools that we have either misconfigured, or not enabled.
Ineffective assignments
A variable is created, either typically by calling a function, and some of its fields are set. However, the variable is not further used in the code:
func example(oldFoo Foo) {
newFoo := oldFoo.Clone()
newFoo.MyProp = 3
anotherFunc(oldFoo) // Likely wrong!
}
- [ ] Linter should error if we are not doing anything effective with
newFoo
, as writing a field very rarely has side effects.
Wrong godoc comments
Sometimes we leave wrong godoc comments on exported or unexported functions, most likely as a result of copy-pasting another similar function as a starting point for the new one.
- [ ] Linter should not error when a godoc comment is absent
- [ ] Linter should error if a godoc comment is there but does not have the expected format.