We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see ourdocumentation.
There was an error while loading.Please reload this page.
1 parent5076cf0 commitfc953f2Copy full SHA for fc953f2
scripts/rules.go
@@ -487,3 +487,17 @@ func workspaceActivity(m dsl.Matcher) {
487
!m.File().Name.Matches(`_test\.go$`),
488
).Report("Updating workspace activity should always be done in the workspacestats package.")
489
}
490
+
491
+// noExecInAgent ensures that packages under agent/ don't use exec.Command or
492
+// exec.CommandContext directly.
493
+//
494
+//nolint:unused,deadcode,varnamelen
495
+funcnoExecInAgent(m dsl.Matcher) {
496
+m.Import("os/exec")
497
+m.Match(
498
+`exec.Command($*_)`,
499
+`exec.CommandContext($*_)`,
500
+).
501
+Where(m.File().PkgPath.Matches("^github.com/coder/coder/agent")).
502
+Report("The agent and its subpackages should not use exec.Command or exec.CommandContext directly. Consider using agentexec.CommandContext instead.")
503
+}