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

feat: toggle log severity using rules config #9460

Merged
merged 5 commits into from
Nov 24, 2023
Merged

feat: toggle log severity using rules config #9460

merged 5 commits into from
Nov 24, 2023

Conversation

yufeih
Copy link
Contributor

@yufeih yufeih commented Nov 23, 2023

Enables toggle log severity based on log code in docfx.json using rules such as:

{
  "rules": {
    "InvalidAssemblyReference": "info"
  }
}

Adds the following error code for metadata command:

  • InvalidAssemblyReference
  • InvalidCref
  • InvalidXmlComment
  • CodeNotFound

This does not fix #9459 but provides a way to suppress warnings no per error code.

@yufeih yufeih added the new-feature Makes the pull request to appear in "New Features" section of the next release note label Nov 23, 2023
Copy link

codecov bot commented Nov 23, 2023

Codecov Report

Attention: 5 lines in your changes are missing coverage. Please review.

Comparison is base (2ba0c48) 71.34% compared to head (16359dd) 71.34%.

Files Patch % Lines
src/Docfx.Common/Loggers/Logger.cs 0.00% 1 Missing and 1 partial ⚠️
src/Docfx.Dotnet/DotnetApiCatalog.cs 0.00% 1 Missing ⚠️
.../ManagedReference/Visitors/SymbolVisitorAdapter.cs 0.00% 1 Missing ⚠️
src/Docfx.Dotnet/Parsers/XmlComment.cs 50.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main    #9460   +/-   ##
=======================================
  Coverage   71.34%   71.34%           
=======================================
  Files         561      561           
  Lines       23980    23987    +7     
  Branches     4170     4173    +3     
=======================================
+ Hits        17108    17113    +5     
- Misses       5778     5779    +1     
- Partials     1094     1095    +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@yufeih yufeih closed this Nov 23, 2023
@yufeih yufeih reopened this Nov 23, 2023
@bitbonk
Copy link
Contributor

bitbonk commented Nov 23, 2023

@yufeih Did you ever consider a way to identify and then ignore docfx warnings individually?
Like I can with the CS0000 compiler warnings or with the Diagnostics ID in some Attributes and Roslyn analyzers?

@yufeih
Copy link
Contributor Author

yufeih commented Nov 23, 2023

Let's see if I understand your question: this change would allow individual warnings to be ignored at the error code level, similar to CS0000/Diagnostics ID (although not all warnings/errors have a code today). Are you looking for suppressing levels at an even more granular level such as #pragma warning disable?

@yufeih yufeih merged commit d68b9d2 into main Nov 24, 2023
8 checks passed
@yufeih yufeih deleted the rules branch November 24, 2023 04:17
@bitbonk
Copy link
Contributor

bitbonk commented Nov 24, 2023

I think as a first step it would be cool if all warnings/errors that docfx can produce would have an ID and the severity of that warning can be configure globally for a build (e.g. in docfx.json).

Being able to do control the warnings occurrences individually similar to #pragma warning disable might be nice to have, but I suppose that poses the question where one would write down that #pragma warning disable, not all warnings can be associated with a location in a markdown file.

@yufeih
Copy link
Contributor Author

yufeih commented Nov 24, 2023

That make sense and is exactly what this PR is aiming for.

p-kostov pushed a commit to ErpNetDocs/docfx that referenced this pull request Jun 28, 2024
* feat: toggle log severity using rules config

* Update docfx-json-reference.md

* add more warning codes in metadata command

---------

Co-authored-by: Yufei Huang <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-feature Makes the pull request to appear in "New Features" section of the next release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Bug] System.Data warnings for .NET 8 WPF assemblies
2 participants