Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 2343dbd

Browse files
committed
chore: linter to stop codersdk import in db package
1 parent 4843062 commit 2343dbd

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

scripts/rules.go

+10
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,16 @@ func databaseImport(m dsl.Matcher) {
134134
Where(m.File().PkgPath.Matches("github.com/coder/coder/v2/codersdk"))
135135
}
136136

137+
// sdkImportFromDB enforces not importing any /codersdk from /database.
138+
//
139+
//nolint:unused,deadcode,varnamelen
140+
func sdkImportFromDB(m dsl.Matcher) {
141+
m.Import("github.com/coder/coder/v2/codersdk")
142+
m.Match("codersdk.$_").
143+
Report("Do not import any codersdk types into database").
144+
Where(m.File().PkgPath.Matches("github.com/coder/coder/v2/coderd/database"))
145+
}
146+
137147
// doNotCallTFailNowInsideGoroutine enforces not calling t.FailNow or
138148
// functions that may themselves call t.FailNow in goroutines outside
139149
// the main test goroutine. See testing.go:834 for why.

0 commit comments

Comments
 (0)