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

UseShellExecute analyzer #707

Merged
merged 3 commits into from
Sep 30, 2024

Conversation

jairbubbles
Copy link
Contributor

It's probably the number 1 issue I've seen between .NET Framework and .NET Core so I thought that an analyzer might be helpful. Let me know what you think and I'll dig more.

Copy link
Owner

@meziantou meziantou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Before completing the PR, you'll need to run the DocumentationGenerator project to generate the md files.

src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
@jairbubbles jairbubbles force-pushed the useshellexecute-analyzer branch 2 times, most recently from bf255a2 to 6d3a1a9 Compare March 30, 2024 16:59
Copy link

This pull request is stale because it has been open for 60 days with no activity.

Copy link

This pull request is stale because it has been open for 60 days with no activity.

@jairbubbles
Copy link
Contributor Author

(false manipulation)

@jairbubbles jairbubbles reopened this Sep 29, 2024
@jairbubbles jairbubbles marked this pull request as ready for review September 29, 2024 11:33
@jairbubbles
Copy link
Contributor Author

I revived the PR @meziantou, let me know what you think.

Copy link
Owner

@meziantou meziantou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few changes, then I'll merge it

docs/Rules/MA0155.md Outdated Show resolved Hide resolved
description: "",
helpLinkUri: RuleIdentifiers.GetHelpUri(RuleIdentifiers.UseShellExecuteMustBeSet));

private static readonly DiagnosticDescriptor UseProcessStartOverload = new(
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should have a different id per DiagnosticDescriptor. It gives more flexibility for the consumer of the package.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You mean add another rule "MA0162"?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yep, in fact you should have 3 rule ids.

src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
src/Meziantou.Analyzer/Rules/UseShellExecuteAnalyzer.cs Outdated Show resolved Hide resolved
@jairbubbles
Copy link
Contributor Author

@meziantou I renamed the analyzer and created 3 different IDs and disabled 2 out of the 3.

NB: The .cmd is failing on my computer (double docs folder):

Could not find a part of the path 'D:\Git\meziantou\Meziantou.Analyzer\docs\docs\README.md'

@jairbubbles
Copy link
Contributor Author

I still think we should enforce users to explicitly set UseShellExecute but as there's no 100% accurate way of detecting it, I guess we can't enable the rule by default.

@meziantou meziantou enabled auto-merge (squash) September 30, 2024 00:32
@meziantou meziantou merged commit 9c95e25 into meziantou:main Sep 30, 2024
16 of 17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants