coder / coder/envbuilder

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

Ouverte
#399 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
ci
Langage dominant
Go
Étoiles
300
Forks
64
Merge moyen
20 min
PR mergées (30 j)
1

Description

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 https://github.com/coder/envbuilder/pull/391#discussion_r1818991909_

---

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.

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Piste de recherche

Commencez par examiner la configuration du linting et la comparer à celle de coder/coder, puis exécutez le linter actuel sur envbuilder.go, devcontainer/devcontainer.go et devcontainer/script.go. Ajoutez les règles convenues pour la documentation des éléments exportés et les tests parallélisables, corrigez les violations qui en résultent et vérifiez que les commandes de lint et de test du projet réussissent.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
go
Domaine
testing, tooling
Type d'issue
Refactorisation
Difficulté
4/5
Temps estimé
3-5 jours
Activité
À l'abandon
Clarté
Plutôt claire
Accessibilité débutants
35/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.