mirror of
https://github.com/coder/coder.git
synced 2026-09-22 05:05:20 +08:00
chore(scripts/rules.go): ignore db imports in _test.go files (#20406)
This change allows us to stop adding the following for every invokation: ``` //nolint:gocritic // This is in a test package and does not end up in the build ```
This commit is contained in:
+4
-1
@@ -133,7 +133,10 @@ func databaseImport(m dsl.Matcher) {
|
||||
m.Import("github.com/coder/coder/v2/coderd/database")
|
||||
m.Match("database.$_").
|
||||
Report("Do not import any database types into codersdk").
|
||||
Where(m.File().PkgPath.Matches("github.com/coder/coder/v2/codersdk"))
|
||||
Where(
|
||||
m.File().PkgPath.Matches("github.com/coder/coder/v2/codersdk") &&
|
||||
!m.File().Name.Matches(`_test\.go$`),
|
||||
)
|
||||
}
|
||||
|
||||
// publishInTransaction detects calls to Publish inside database transactions
|
||||
|
||||
Reference in New Issue
Block a user