Skip to content

Conversation

Copy link
Contributor

Copilot AI commented Nov 21, 2025

Users cannot override analyzer rules in their .editorconfig when MeziantouAnalysisMode is set to None or Default because the package's configuration files take precedence.

Changes

  • MSBuild props: Changed EditorConfigFiles to GlobalAnalyzerConfigFiles in build/Meziantou.Analyzer.props
  • Configuration precedence: Set global_level = -1 (was 0) in generated .editorconfig files to ensure user configs override package defaults
  • Generator: Updated DocumentationGenerator/Program.cs to emit the new global level

This follows Microsoft's guidance for Global Analyzer Config files and ensures users can selectively enable/disable rules after setting a baseline via MeziantouAnalysisMode.

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • www.nuget.org
    • Triggering command: /usr/share/dotnet/dotnet /usr/share/dotnet/dotnet exec --runtimeconfig /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/tests/Meziantou.Analyzer.Test/bin/Debug/net10.0/Meziantou.Analyzer.Test.runtimeconfig.json --depsfile /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/tests/Meziantou.Analyzer.Test/bin/Debug/net10.0/Meziantou.Analyzer.Test.deps.json /home/REDACTED/work/Meziantou.Analyzer/Meziantou.Analyzer/tests/Meziantou.Analyzer.Test/bin/Debug/net10.0/testhost.dll --port 32843 --endpoint 127.0.0.1:032843 --role client --parentprocessid 4447 --datacollectionport 35531 --telemetryoptedin false (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

This section details on the original issue you should resolve

<issue_title>Add rule config files as Global AnalyzerConfig instead of EditorConfig</issue_title>
<issue_description>Is your feature request related to a problem? Please describe.
I am not able to disable all rules using the MeziantouAnalysisMode set to None and then define what rules I want to apply solution-wide in my .editorconfig file in the root folder of the solution.

Describe the solution you'd like
Based on the documentation here: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/configuration-files#naming

Use GlobalAnalyzerConfigFiles item to include the rule files instead of EditorConfigFiles item: https://github.com/meziantou/Meziantou.Analyzer/blob/36df944d2c8e00e9786ce888c645583ca0192f0f/src/Meziantou.Analyzer.Pack/build/Meziantou.Analyzer.props</issue_description>

<agent_instructions>Can you update the MSBuild property name? Also, can you set the global editor config level to -1 in the generator?</agent_instructions>

Comments on the Issue (you are @copilot in this section)


✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Copilot AI changed the title [WIP] Update rule config files to use GlobalAnalyzerConfig Use GlobalAnalyzerConfigFiles with global_level=-1 for analyzer configuration Nov 21, 2025
Copilot AI requested a review from meziantou November 21, 2025 18:56
Copilot finished work on behalf of meziantou November 21, 2025 18:56
@meziantou meziantou marked this pull request as ready for review November 21, 2025 18:58
@meziantou meziantou enabled auto-merge (squash) November 21, 2025 18:58
@meziantou meziantou merged commit 14396b9 into main Nov 21, 2025
25 checks passed
@meziantou meziantou deleted the copilot/update-analyzer-config-files branch November 21, 2025 19:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add rule config files as Global AnalyzerConfig instead of EditorConfig

2 participants