Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/lombiq/.net-analyzers
.NET code analyzers and code convention settings for Lombiq projects.
https://github.com/lombiq/.net-analyzers
analyzer code-analysis dotnet dotnet-analyzers editorconfig fxcop sonarlint stylecop
Last synced: 3 days ago
JSON representation
.NET code analyzers and code convention settings for Lombiq projects.
- Host: GitHub
- URL: https://github.com/lombiq/.net-analyzers
- Owner: Lombiq
- License: bsd-3-clause
- Created: 2020-07-20T17:51:51.000Z (over 4 years ago)
- Default Branch: dev
- Last Pushed: 2024-12-31T17:08:49.000Z (20 days ago)
- Last Synced: 2025-01-10T11:19:09.590Z (10 days ago)
- Topics: analyzer, code-analysis, dotnet, dotnet-analyzers, editorconfig, fxcop, sonarlint, stylecop
- Language: PowerShell
- Homepage:
- Size: 434 KB
- Stars: 16
- Watchers: 8
- Forks: 7
- Open Issues: 8
-
Metadata Files:
- Readme: Readme.md
- License: License.md
Awesome Lists containing this project
README
# Lombiq .NET Analyzers
[![Lombiq.Analyzers NuGet](https://img.shields.io/nuget/v/Lombiq.Analyzers?label=Lombiq.Analyzers)](https://www.nuget.org/packages/Lombiq.Analyzers/) [![Lombiq.Analyzers.NetFx NuGet](https://img.shields.io/nuget/v/Lombiq.Analyzers.NetFx?label=Lombiq.Analyzers.NetFx)](https://www.nuget.org/packages/Lombiq.Analyzers.NetFx/) [![Lombiq.Analyzers.OrchardCore NuGet](https://img.shields.io/nuget/v/Lombiq.Analyzers.OrchardCore?label=Lombiq.Analyzers.OrchardCore)](https://www.nuget.org/packages/Lombiq.Analyzers.OrchardCore/) [![Lombiq.Analyzers.Orchard1 NuGet](https://img.shields.io/nuget/v/Lombiq.Analyzers.Orchard1?label=Lombiq.Analyzers.Orchard1)](https://www.nuget.org/packages/Lombiq.Analyzers.Orchard1/) [![Lombiq.Analyzers.VisualStudioExtension NuGet](https://img.shields.io/nuget/v/Lombiq.Analyzers.VisualStudioExtension?label=Lombiq.Analyzers.VisualStudioExtension)](https://www.nuget.org/packages/Lombiq.Analyzers.VisualStudioExtension/)
## About
.NET code analyzers and code convention settings for [Lombiq](https://lombiq.com) projects, for [Orchard Core](https://orchardcore.net/) and any other .NET and .NET Framework apps. We use these to enforce common standards across all our .NET projects, including e.g. all of our [open-source Orchard Core extensions](https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions). If you contribute to our open-source projects while using that solution you'll be guided by these rules, too. You can check out a demo video of the project [here](https://www.youtube.com/watch?v=dtbGRi3Cezs), and the Orchard Harvest 2023 conference talk about automated QA in Orchard Core [here](https://youtu.be/CHdhwD2NHBU).
There is also support for non-SDK-style .NET Framework projects, as long as they use `PackageReference` for their dependencies (in contrast to _packages.config_).
Some other projects you may be interested in:
- Looking for something similar for JavaScript and SCSS? Check out the ESLint and Stylelint integrations of our [Node.js Extensions project](https://github.com/Lombiq/NodeJs-Extensions).
- Looking not just for static code analysis but also dynamic testing? Check out our [UI Testing Toolbox](https://github.com/Lombiq/UI-Testing-Toolbox) and [Testing Toolbox](https://github.com/Lombiq/Testing-Toolbox) projects.
- Looking for a library that'll help you comply with analyzer rules? Check out our [Helpful Libraries project](https://github.com/Lombiq/Helpful-Libraries).We at [Lombiq](https://lombiq.com/) also used this module for the following projects:
- The new [City of Santa Monica website](https://santamonica.gov/) when migrating it from Orchard 1 to Orchard Core ([see case study](https://lombiq.com/blog/helping-the-city-of-santa-monica-with-orchard-core-consulting)).
- The new [Smithsonian Folkways Recordings website](https://folkways.si.edu/) when migrating it from Orchard 1 to Orchard Core ([see case study](https://lombiq.com/blog/smithsonian-folkways-recordings-now-upgraded-to-orchard-core)).
- The new [Lombiq website](https://lombiq.com/) when migrating it from Orchard 1 to Orchard Core ([see case study](https://lombiq.com/blog/how-we-renewed-and-migrated-lombiq-com-from-orchard-1-to-orchard-core)).
- The new client portal for [WTW](https://www.wtwco.com/) ([see case study](https://lombiq.com/blog/lombiq-s-journey-with-wtw-s-client-portal)).
- It also makes [DotNest, the Orchard SaaS](https://dotnest.com/) better.Do you want to quickly try out this project and see it in action? Check it out in our [Open-Source Orchard Core Extensions](https://github.com/Lombiq/Open-Source-Orchard-Core-Extensions) full Orchard Core solution and also see our other useful Orchard Core-related open-source projects!
## Analyzer packages used
We added and configured analyzers which are widely used and complement each other.
- [.NET code style analysis](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#code-style-analysis)
- [.NET code quality analysis](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/overview#code-quality-analysis)
- [AsyncFixer](https://www.nuget.org/packages/AsyncFixer)
- [DotNetAnalyzers.DocumentationAnalyzers](https://www.nuget.org/packages/DotNetAnalyzers.DocumentationAnalyzers/)
- [Meziantou.Analyzer](https://www.nuget.org/packages/Meziantou.Analyzer/)
- [Microsoft.CodeAnalysis.NetAnalyzers](https://www.nuget.org/packages/Microsoft.CodeAnalysis.NetAnalyzers)
- [Microsoft.VisualStudio.Threading.Analyzers](https://www.nuget.org/packages/microsoft.visualstudio.threading.analyzers)
- [SecurityCodeScan.VS2019](https://www.nuget.org/packages/SecurityCodeScan.VS2019/)
- [StyleCop.Analyzers](https://www.nuget.org/packages/StyleCop.Analyzers/)
- [SonarAnalyzer.CSharp](https://www.nuget.org/packages/SonarAnalyzer.CSharp/)Furthermore, the project also includes an _.editorconfig_ file with additional configuration for compatible editors.
## Guides
- [Adding analyzers to your project](Lombiq.Analyzers/Docs/AddingAnalyzers.md)
- [Using the analyzers during development](Lombiq.Analyzers/Docs/UsingAnalyzersDuringDevelopment.md)
- [Using the analyzers during command line builds](Lombiq.Analyzers/Docs/UsingAnalyzersDuringCommandLineBuilds.md)
- [Configuring analyzers](Lombiq.Analyzers/Docs/ConfiguringAnalyzers.md)## Contributing and support
Bug reports, feature requests, comments, questions, code contributions and love letters are warmly welcome. You can send them to us via GitHub issues and pull requests. Please adhere to our [open-source guidelines](https://lombiq.com/open-source-guidelines) while doing so.
This project is developed by [Lombiq Technologies](https://lombiq.com/). Commercial-grade support is available through Lombiq.
### Publishing a new NuGet package
When publishing a new version of the NuGet package, even if it's just a pre-release, also update the package references under _TestSolutions\Lombiq.Analyzers.PackageReferences_ to the new version. This is necessary to run the tests there.
### Upgrading to a new version of the .NET SDK
When a new version of the .NET SDK comes out then to the following:
- Change the `LangVersion` and `AnalysisLevel` elements in the _Build.props_ file to opt in to new language features and analyzers. This does not concern non-SDK-style .NET Framework projects.
- Wait for all analyzers to support the new SDK (primarily the new language features). Then update all packages to latest.
- Check if there are new [code analysis categories](https://docs.microsoft.com/en-us/dotnet/fundamentals/code-analysis/categories) that we need to surface warnings for by default in the _Lombiq.Analyzers.globalconfig_ file.### Adding a new analyzer
When adding a new analyzer package, do the following:
- Check if the project is actively developed with issues addressed quickly.
- Check if it has any significant impact on build or editing performance.
- Go through all rules in the package and decide one by one whether we need them.
- Check for rules that are already covered by some other analyzer and disable duplicates.
- All rules that we need should be surfaced as Warnings. This allows to only break the build on analyzer violations when we need it, i.e. during CI builds but not during development.
- Add rule configuration to the _.globalconfig_ file of the relevant project, depending on which kind of applications they're applicable to. Editor-only configuration should be in _.editorconfig_ files.
- Test it on multiple significant solutions. Using the [Hastlayer SDK](https://github.com/Lombiq/Hastlayer-SDK) is a good example as it's a large C# solution.