{"id":15011659,"url":"https://github.com/netfabric/netfabric.hyperlinq.analyzer","last_synced_at":"2025-04-12T03:30:54.413Z","repository":{"id":48812321,"uuid":"171886753","full_name":"NetFabric/NetFabric.Hyperlinq.Analyzer","owner":"NetFabric","description":"A Roslyn analyzer with rules related to generation and consumption of enumerables and async enumerables in C#.","archived":false,"fork":false,"pushed_at":"2024-05-27T01:37:14.000Z","size":305,"stargazers_count":44,"open_issues_count":3,"forks_count":6,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-03-25T23:23:41.318Z","etag":null,"topics":["analyzer","csharp","dotnet","enumeration","linq","nuget","nuget-package","performance","roslyn-analyzer"],"latest_commit_sha":null,"homepage":"","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/NetFabric.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-21T14:29:08.000Z","updated_at":"2024-11-27T17:51:45.000Z","dependencies_parsed_at":"2024-01-18T18:08:41.058Z","dependency_job_id":"537e255b-b03b-4d21-8c13-ee615e9df606","html_url":"https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetFabric%2FNetFabric.Hyperlinq.Analyzer","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetFabric%2FNetFabric.Hyperlinq.Analyzer/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetFabric%2FNetFabric.Hyperlinq.Analyzer/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/NetFabric%2FNetFabric.Hyperlinq.Analyzer/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/NetFabric","download_url":"https://codeload.github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248512484,"owners_count":21116612,"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":["analyzer","csharp","dotnet","enumeration","linq","nuget","nuget-package","performance","roslyn-analyzer"],"created_at":"2024-09-24T19:41:24.434Z","updated_at":"2025-04-12T03:30:53.940Z","avatar_url":"https://github.com/NetFabric.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![GitHub last commit (master)](https://img.shields.io/github/last-commit/NetFabric/NetFabric.Hyperlinq.Analyzer/master.svg?style=flat-square\u0026logo=github)](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/commits/master)\n[![Build (master)](https://img.shields.io/github/workflow/status/NetFabric/NetFabric.Hyperlinq.Analyzer/.NET%20Core/master.svg?style=flat-square\u0026logo=github)](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/actions)\n[![Coverage](https://img.shields.io/coveralls/github/NetFabric/NetFabric.Hyperlinq.Analyzer/master?style=flat-square\u0026logo=coveralls)](https://coveralls.io/github/NetFabric/NetFabric.Hyperlinq.Analyzer)\n[![NuGet Version](https://img.shields.io/nuget/v/NetFabric.Hyperlinq.Analyzer.svg?style=flat-square\u0026logo=nuget)](https://www.nuget.org/packages/NetFabric.Hyperlinq.Analyzer/)\n[![NuGet Downloads](https://img.shields.io/nuget/dt/NetFabric.Hyperlinq.Analyzer.svg?style=flat-square\u0026logo=nuget)](https://www.nuget.org/packages/NetFabric.Hyperlinq.Analyzer/) \n[![Gitter](https://img.shields.io/gitter/room/netfabric/netfabric.hyperlinq.analyzer?style=flat-square\u0026logo=gitter)](https://gitter.im/NetFabric/NetFabric.Hyperlinq.Analyzer)\n\n# NetFabric.Hyperlinq.Analyzer\n\nA [Roslyn Analyzer](https://docs.microsoft.com/en-us/visualstudio/code-quality/roslyn-analyzers-overview) that contains several rules to help improve enumeration performance when using C#.\n\n**Note:** This analyzer is independent of [`NetFabric.Hyperlinq`](https://github.com/NetFabric/NetFabric.Hyperlinq). The rules may be useful when you only use `foreach`, `IEnumerable\u003cT\u003e`, `IAsyncEnumerable\u003cT\u003e`, `System.Linq` or `System.Linq.Async`.\n\nRule ID | Category | Severity | Notes\n--------|----------|----------|-------\n[HLQ001](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ001_AssignmentBoxing.md)  | Performance | Warning  | Assigment to interface causes boxing of enumerator \n[HLQ002](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ002_NullEnumerable.md)  | Compiler | Error | Enumerable cannot be `null`. \n[HLQ003](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ003_HighestLevelInterface.md)  | Performance | Warning  | Public methods should return highest admissible level interface. \n[HLQ004](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ004_RefEnumerationVariable.md)  | Performance | Warning  | The enumerator returns a reference to the item. \n[HLQ005](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ005_AvoidSingle.md)  | Performance | Warning  | Avoid use of `Single()` and `SingleOrDefault()`\n[HLQ006](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ006_GetEnumeratorReturnType.md)  | Performance | Warning  | `GetEnumerator()` or `GetAsyncEnumerator()` should return a value type. \n[HLQ007](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ007_NonDisposableEnumerator.md)  | Performance |  Warning | Consider returning a non-disposable enumerator.\n[HLQ008](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ008_ReadOnlyRefEnumerable.md)  | Performance |  Info | The enumerable is a value type. Consider making it `readonly`.\n[HLQ009](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ009_RemoveOptionalMethods.md)  | Performance |  Info | Consider removing an empty optional enumerator method.\n[HLQ011](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ011_ReadOnlyEnumeratorField.md)  | Compiler |  Error | Mutable value-type enumerators cannot be stored in a `readonly` field.\n[HLQ012](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ012_UseCollectionsMarshalAsSpan.md)  | Performance |  Warning | Consider using `CollectionsMarshal.AsSpan()` when iterating a `List\u003cT\u003e`.\n[HLQ013](https://github.com/NetFabric/NetFabric.Hyperlinq.Analyzer/blob/master/docs/reference/HLQ013_UseForEachLoop.md)  | Performance |  Warning | Consider using `foreach` when iterating an array or a `Span\u003cT\u003e`.\n\n# Usage\n\n## Visual Studio Marketplace\n\nInstall the [NetFabric.Hyperlinq.Analyzer](https://marketplace.visualstudio.com/items?itemName=NetFabric.NetFabricHyperlinqAnalyzer) extension from the Visual Studio Marketplace.\n\n## Nuget package\n\nAdd the [NetFabric.Hyperlinq.Analyzer](https://www.nuget.org/packages/NetFabric.Hyperlinq.Analyzer/) package to your project using your favorite NuGet client.\n\nIf added manually to the `.csproj`, make sure to set `PrivateAssets` to `all` so that it's not added as a dependency. A [floating version](https://docs.microsoft.com/en-us/nuget/concepts/dependency-resolution#floating-versions) can be used to get the latest version. \n\n``` xml\n\u003cPackageReference Include=\"NetFabric.Hyperlinq.Analyzer\" Version=\"2.*\"\u003e\n  \u003cPrivateAssets\u003eall\u003c/PrivateAssets\u003e\n  \u003cIncludeAssets\u003eruntime; build; native; contentfiles; analyzers\u003c/IncludeAssets\u003e\n\u003c/PackageReference\u003e\n```\n\n# References\n\n- [Enumeration in .NET](https://blog.usejournal.com/enumeration-in-net-d5674921512e) by Antão Almada\n- [NetFabric.Hyperlinq — Optimizing LINQ](https://medium.com/@antao.almada/netfabric-hyperlinq-optimizing-linq-348e02566cef) by Antão Almada\n- [Unit testing a Roslyn Analyzer](https://medium.com/@antao.almada/unit-testing-a-roslyn-analyzer-b3da666f0252) by Antão Almada\n\n## Credits\n\nThe following open-source projects are used to build and test this project:\n\n- [.NET](https://github.com/dotnet)\n- [coveralls](https://coveralls.io)\n- [coverlet](https://github.com/tonerdo/coverlet)\n- [ILRepack](https://github.com/gluck/il-repack)\n- [ILRepack.MSBuild.Task](https://github.com/peters/ILRepack.MSBuild.Task)\n- [NetFabric.CodeAnalysis](https://github.com/NetFabric/NetFabric.CodeAnalysis)\n- [xUnit.net](https://xunit.net/)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetfabric%2Fnetfabric.hyperlinq.analyzer","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnetfabric%2Fnetfabric.hyperlinq.analyzer","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnetfabric%2Fnetfabric.hyperlinq.analyzer/lists"}