Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement a lint for replacable Command::new #13597

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

GnomedDev
Copy link
Contributor

Closes #3436

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

@rustbot
Copy link
Collaborator

rustbot commented Oct 23, 2024

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
@matthiaskrgr
Copy link
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
Copy link
Contributor Author

GnomedDev commented Oct 28, 2024

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
Copy link
Contributor

bors commented Nov 2, 2024

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

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