Skip to content

Implement a lint for replacable Command::new#13597

Closed
GnomedDev wants to merge 1 commit into
rust-lang:masterfrom
GnomedDev:unnecessary-shell-command
Closed

Implement a lint for replacable Command::new#13597
GnomedDev wants to merge 1 commit into
rust-lang:masterfrom
GnomedDev:unnecessary-shell-command

Conversation

@GnomedDev

Copy link
Copy Markdown
Contributor

Closes #3436

changelog: [unnecessary_shell_command] Add pedantic lint for shelling out when a Rust solution can be used instead.

@rustbot

rustbot commented Oct 23, 2024

Copy link
Copy Markdown
Collaborator

r? @dswij

rustbot has assigned @dswij.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added the S-waiting-on-review Status: Awaiting review from the assignee but also interested parties label Oct 23, 2024
@GnomedDev
GnomedDev force-pushed the unnecessary-shell-command branch from d98e9be to b5b0d15 Compare October 23, 2024 23:39
@matthiaskrgr

Copy link
Copy Markdown
Member

How does the lint reliably determine that an operation is "trivial" ?

When I write a Command that executes sed 's/ *(.*)//; s/>.*//; s/.*[:<] *//' will that also be flagged for being trivial?
or ls -a --inode
or wget -r --level=4 -P somedir someurl1 someurl2 ?

@GnomedDev

GnomedDev commented Oct 28, 2024

Copy link
Copy Markdown
Contributor Author

It does not determine of an operation is trivial, that's why it's in pedantic. It simply checks if the string passed to Command::new is one of the strings in a configurable list.

@bors

bors commented Nov 2, 2024

Copy link
Copy Markdown
Contributor

☔ The latest upstream changes (presumably #13376) made this pull request unmergeable. Please resolve the merge conflicts.

@dswij

dswij commented Dec 1, 2024

Copy link
Copy Markdown
Member

Closing as dicussed in Zulip.

@dswij dswij closed this Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Rule Request: UnnecessaryShellCommand

5 participants