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 parentfdd6a59 commit6ac2fb0Copy full SHA for 6ac2fb0
scripts/rules.go
@@ -498,6 +498,20 @@ func noExecInAgent(m dsl.Matcher) {
498
`exec.Command($*_)`,
499
`exec.CommandContext($*_)`,
500
).
501
-Where(m.File().PkgPath.Matches("^github.com/coder/coder/agent")).
+Where(m.File().PkgPath.Matches("/agent/")).
502
Report("The agent and its subpackages should not use exec.Command or exec.CommandContext directly. Consider using agentexec.CommandContext instead.")
503
}
504
+
505
+// noPTYInAgent ensures that packages under agent/ don't use pty.Command or
506
+// pty.CommandContext directly.
507
+//
508
+//nolint:unused,deadcode,varnamelen
509
+funcnoPTYInAgent(m dsl.Matcher) {
510
+m.Import("github.com/coder/coder/v2/pty")
511
+m.Match(
512
+`pty.Command($*_)`,
513
+`pty.CommandContext($*_)`,
514
+).
515
+Where(m.File().PkgPath.Matches(`/agent/`)).
516
+Report("The agent and its subpackages should not use pty.Command or pty.CommandContext directly. Consider using agentexec.PTYCommandContext instead.")
517
+}