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

Bump up priority for formatting analyzer #67093

Merged
merged 1 commit into from
Feb 28, 2023

Conversation

mavasani
Copy link
Contributor

@mavasani mavasani commented Feb 28, 2023

Follow-up change to #67058. We also trim down the analyzers to run for each code action priority bucket, so the analyzer priority needs to match the fixer priority. I'll add a unit test in a follow-up PR to verify that all our analyzer/fixer pairs have matching priority.

private bool MatchesPriority(DiagnosticAnalyzer analyzer)
{
// If caller isn't asking for prioritized result, then run all analyzers.
if (_priority == CodeActionRequestPriority.None)
return true;
// 'CodeActionRequestPriority.Lowest' is used for suppression/configuration fixes,
// which requires all analyzer diagnostics.
if (_priority == CodeActionRequestPriority.Lowest)
return true;
// The compiler analyzer always counts for any priority. It's diagnostics may be fixed
// by high pri or normal pri fixers.
if (analyzer.IsCompilerAnalyzer())
return true;
var analyzerPriority = analyzer is IBuiltInAnalyzer { RequestPriority: var requestPriority }
? requestPriority
: CodeActionRequestPriority.Normal;
return _priority == analyzerPriority;
}

Follow-up change to dotnet#67058. We also trim down the analyzers to run for each code action priority bucket, so the analyzer priority needs to match the fixer priority. I'll add a unit test in a follow-up PR to verify that all our analyzer/fixer pairs have matching priority.
Copy link
Member

@CyrusNajmabadi CyrusNajmabadi left a comment

Choose a reason for hiding this comment

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

I also had a PR for this. But I guess I didn't push it last night :-).

I'm ok with this. But instead of copying the doc comment, have one of the doc comments 'inheritdoc' the other.

@mavasani
Copy link
Contributor Author

But instead of copying the doc comment, have one of the doc comments 'inheritdoc' the other.

Thanks, I’ll make this change in a follow up PR

@mavasani mavasani merged commit 0b24f6b into dotnet:main Feb 28, 2023
@ghost ghost added this to the Next milestone Feb 28, 2023
@RikkiGibson RikkiGibson modified the milestones: Next, 17.6 P2 Mar 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants