Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve linting and static analysis tooling #302

Open
3 tasks
roobre opened this issue Aug 18, 2023 · 0 comments
Open
3 tasks

Improve linting and static analysis tooling #302

roobre opened this issue Aug 18, 2023 · 0 comments

Comments

@roobre
Copy link
Collaborator

roobre commented Aug 18, 2023

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.
@roobre roobre mentioned this issue Aug 18, 2023
8 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant