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

Linters for Envbuilder aren't catching some common concerns that we have #399

Open
SasSwart opened this issue Oct 29, 2024 · 0 comments
Open
Labels

Comments

@SasSwart
Copy link
Contributor

SasSwart commented Oct 29, 2024

          Suggestion: It's best practice for exported functions to have documentation (`// EnvWithBuildSecretPrefix ...`). It's part of the original Go linter (https://pkg.go.dev/github.com/golang/lint) and [CodeReviewComments](https://go.dev/wiki/CodeReviewComments#doc-comments)/[Effective Go](https://go.dev/doc/effective_go#commentary), so a bit surprising that it's not caught.
❯ golint ./...
envbuilder.go:43:2: a blank import should be only in a main or test package, or have a comment justifying it
devcontainer/devcontainer.go:34:6: exported type Spec should have comment or be unexported
devcontainer/devcontainer.go:50:6: exported type LifecycleScripts should have comment or be unexported
devcontainer/devcontainer.go:57:6: exported type BuildSpec should have comment or be unexported
devcontainer/devcontainer.go:78:1: exported function SubstituteVars should have comment or be unexported
devcontainer/script.go:16:6: exported type LifecycleScript should have comment or be unexported
devcontainer/script.go:21:1: exported method LifecycleScript.IsEmpty should have comment or be unexported

It seems golint is marked deprecated in golangci-lint though, so I guess the alternative linters aren't enforcing this rule. 😔 I always found it slightly annoying but ultimately worth the annoyance 😄.

Originally posted by @mafredri in #391 (comment)


There seem to be some linting rules that we'd value here. Two of them are:

  • Tests should run in parallel when they can
  • Exported functions should be documented

There may be others. It would be worth checking coder/coder's linting config to see what else we're missing. We should add the linters we deem important and ensure the project conforms to them.

@coder-labeler coder-labeler bot added the help wanted Extra attention is needed label Oct 29, 2024
@SasSwart SasSwart added ci and removed help wanted Extra attention is needed labels Oct 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant