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:
Mathias Fredriksson
2025-10-22 12:10:06 +03:00
committed by GitHub
parent 69c2c40512
commit f64ac8f5f7
+4 -1
View File
@@ -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