Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit6ac2fb0

Browse files
committed
add ruleguard for pty.Command
1 parentfdd6a59 commit6ac2fb0

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

‎scripts/rules.go‎

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -498,6 +498,20 @@ func noExecInAgent(m dsl.Matcher) {
498498
`exec.Command($*_)`,
499499
`exec.CommandContext($*_)`,
500500
).
501-
Where(m.File().PkgPath.Matches("^github.com/coder/coder/agent")).
501+
Where(m.File().PkgPath.Matches("/agent/")).
502502
Report("The agent and its subpackages should not use exec.Command or exec.CommandContext directly. Consider using agentexec.CommandContext instead.")
503503
}
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+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp