coder / coder/envbuilder

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

オープン
#399 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
ci
主要言語
Go
スター
300
フォーク
64
平均マージ
20分
マージ済み PR(30日)
1

説明

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.

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

調査の方向性

Start by reviewing the linting configuration and comparing it with coder/coder's configuration, then run the current linter against envbuilder.go, devcontainer/devcontainer.go, and devcontainer/script.go. Add the agreed rules for exported documentation and parallelizable tests, address the resulting violations, and verify the project lint and test commands pass.

索引モデルが issue の本文から書いたものです。

評価

技術スタック
go
領域
testing, tooling
issue の種類
リファクタリング
難易度
4/5
見積もり時間
3〜5日
活発さ
停滞
明瞭さ
おおむね明確
初心者へのやさしさ
35/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。