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

Commitfc953f2

Browse files
committed
add ruleguard for exec.Command
1 parent5076cf0 commitfc953f2

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

‎scripts/rules.go‎

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -487,3 +487,17 @@ func workspaceActivity(m dsl.Matcher) {
487487
!m.File().Name.Matches(`_test\.go$`),
488488
).Report("Updating workspace activity should always be done in the workspacestats package.")
489489
}
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+
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp