{"id":22414861,"url":"https://github.com/softlr/suppress","last_synced_at":"2025-03-27T03:45:18.252Z","repository":{"id":42464587,"uuid":"139355567","full_name":"Softlr/Suppress","owner":"Softlr","description":"C# analyzer suppression helpers","archived":false,"fork":false,"pushed_at":"2022-04-04T19:23:29.000Z","size":355,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-02-01T09:21:33.453Z","etag":null,"topics":["code-analysis","helpers","suppression"],"latest_commit_sha":null,"homepage":null,"language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Softlr.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2018-07-01T19:20:52.000Z","updated_at":"2022-09-13T21:23:38.000Z","dependencies_parsed_at":"2022-09-14T00:31:26.673Z","dependency_job_id":null,"html_url":"https://github.com/Softlr/Suppress","commit_stats":null,"previous_names":[],"tags_count":19,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softlr%2FSuppress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softlr%2FSuppress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softlr%2FSuppress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Softlr%2FSuppress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Softlr","download_url":"https://codeload.github.com/Softlr/Suppress/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245779446,"owners_count":20670685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["code-analysis","helpers","suppression"],"created_at":"2024-12-05T15:09:49.792Z","updated_at":"2025-03-27T03:45:18.236Z","avatar_url":"https://github.com/Softlr.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"![.NET](https://github.com/Softlr/Suppress/actions/workflows/dotnet.yml/badge.svg)\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=softlr.suppress\u0026metric=alert_status)](https://sonarcloud.io/summary/new_code?id=softlr.suppress)\n\n# Description\nThis library allows easy suppression of C# code analyzers warnings by defining a bunch of contants for all of the rules. The following analyzers are supported:\n\n* [SonarQube](https://www.sonarqube.org/)\n* [Roslyn Analyzers](https://github.com/dotnet/roslyn-analyzers)\n* [FxCop](https://msdn.microsoft.com/en-us/library/bb429476.aspx)\n* [StyleCop.Analyzers](https://github.com/DotNetAnalyzers/StyleCopAnalyzers)\n* [CodeCracker](https://github.com/code-cracker/code-cracker)\n\n# Known limitations\n[ReSharper](https://www.jetbrains.com/resharper/) rules cannot be suppressed with constants defined this way, this is [by design](https://stackoverflow.com/questions/44652818/why-cant-i-use-constants-in-suppressmessage-together-with-resharper).\n\n# Installation\nRun the following command in Visual Studio Package Manager Console.\n```posh\nInstall-Package Softlr.Suppress\n```\n\n# Usage\nSimply reference specific constant from the `Softlr.Suppress` class in `SuppressMessageAttribute` like so\n\n```csharp\nusing System.Diagnostics.CodeAnalysis;\n\n[SuppressMessage(Softl.Suppress.CODE_CRACKER, Softlr.Suppress.CC0001)]\n[SuppressMessage(Softl.Suppress.FXCOP, Softlr.Suppress.CA1000)]\n[SuppressMessage(Softl.Suppress.SONARQUBE, Softlr.Suppress.S100)]\n[SuppressMessage(Softl.Suppress.STYLECOP, Softlr.Suppress.SA1001)]\npublic class MyClass\n{\n    // ...\n}\n```\n\nor use the `using static` to import all constants\n\n```csharp\nusing System.Diagnostics.CodeAnalysis;\nusing static Softlr.Suppress;\n\n[SuppressMessage(CODE_CRACKER, CC0001)]\n[SuppressMessage(FXCOP, CA1000)]\n[SuppressMessage(SONARQUBE, S100)]\n[SuppressMessage(STYLECOP, SA1001)]\npublic class MyClass\n{\n    // ...\n}\n```\n\nor, if you are using C# 10 or newer (net6.0+) you can declare the suppression constants as global and not have to reference it again in every file where you need to use any of the constants.\n\n```csharp\nglobal using System.Diagnostics.CodeAnalysis;\nglobal using static Softlr.Suppress;\n\n[SuppressMessage(CODE_CRACKER, CC0001)]\n[SuppressMessage(FXCOP, CA1000)]\n[SuppressMessage(SONARQUBE, S100)]\n[SuppressMessage(STYLECOP, SA1001)]\npublic class MyClass\n{\n    // ...\n}\n```\n\nWhen referencing `Softlr.Suppress` library in a project that creates a NuGet package the reference for this library doesn't need to be defined as a NuGet dependency.\nIf you are generating NuGet packages with project files, this can be achieved with `PrivateAssets` metadata.\n\n```\n\u003cPackageReference Include=\"Softlr.Suppress\" Version=\"1.0.0\"\u003e\n    \u003cPrivateAssets\u003eall\u003c/PrivateAssets\u003e\n\u003c/PackageReference\u003e\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftlr%2Fsuppress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsoftlr%2Fsuppress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsoftlr%2Fsuppress/lists"}