EcoCode 1.2.0

Suggested Alternatives

Creedengo

Additional Details

EcoCode has been renamed to Creedengo

There is a newer version of this package available.
See the version list below for details.
dotnet add package EcoCode --version 1.2.0                
NuGet\Install-Package EcoCode -Version 1.2.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="EcoCode" Version="1.2.0">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add EcoCode --version 1.2.0                
#r "nuget: EcoCode, 1.2.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install EcoCode as a Cake Addin
#addin nuget:?package=EcoCode&version=1.2.0

// Install EcoCode as a Cake Tool
#tool nuget:?package=EcoCode&version=1.2.0                

EcoCode on NuGet EcoCode on NuGet

EcoCode-C#

ecoCode is a collective project aiming to reduce environmental footprint of software at the code level. The goal of the project is to provide a list of static code analyzers to highlight code structures that may have a negative ecological impact: energy and resources over-consumption, "fatware", shortening terminals' lifespan, etc.

ecoCode is based on evolving catalogs of good practices, for various technologies.

This set of Roslyn analyzers implements these catalogs as rules for scanning your C# projects.

⚠️ This is still a very early stage project. Any feedback or contribution will be highly appreciated. Please refer to the contribution section.

License: GPL v3 Contributor Covenant

🚀 Getting Started

There are several ways you can use the ecoCode analyzers in your .Net projects:

  1. As a NuGet package : https://www.nuget.org/packages/EcoCode/.
  2. As a Visual Studio extension : https://marketplace.visualstudio.com/items?itemName=greencodeinitiative.ecoCode
  3. Coming soon : as a VS Code extension.
  4. Coming soon : as a .Net CLI Tool to scan existing code bases.
  5. Coming soon : a documentation on how to set up SonarScanner for .Net and display the EcoCode warnings in SonarQube.

🧩 Compatibility

Both the EcoCode NuGet package and Visual Studio extension target .Net Standard 2.0 and can be used in a wide range of projects. See Microsoft documentation for details about the supported .Net Frameworks in .Net Standard 2.0.

🌿 EcoCode Rules

Id Description Severity Code fix
EC69 Don’t call loop invariant functions in loop conditions ⚠️
EC72 Don’t execute SQL queries in loops ⚠️
EC75 Don’t concatenate strings in loops ⚠️
EC81 Specify struct layouts ⚠️ ✔️
EC82 Variable can be made constant ℹ️ ✔️
EC83 Replace Enum ToString() with nameof ⚠️ ✔️
EC84 Avoid async void methods ⚠️ ✔️
EC85 Make type sealed ℹ️ ✔️
EC86 GC.Collect should not be called ⚠️
EC87 Use collection indexer ⚠️ ✔️
EC88 Dispose resource asynchronously ⚠️ ✔️
EC91 Use Where before OrderBy ⚠️ ✔️
EC92 Use Length to test empty strings ⚠️ ✔️

🌿 Roslyn Rules

This plugin customizes the severity of certain Roslyn rules.

Id Description Old Severity New Severity Code fix
CA1825 Avoid zero-length array allocations ℹ️ ⚠️ ✔️
CA1827 Do not use Count()/LongCount() when Any() can be used ℹ️ ⚠️ ✔️

🤝 Contribution

See contribution on the central ecoCode repository.

🤓 Main contributors

See main contributors on the central ecoCode repository.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.5.3 297 1/1/2025 1.5.3 is deprecated because it is no longer maintained.
1.5.3-beta1 93 1/1/2025 1.5.3-beta1 is deprecated because it is no longer maintained.
1.5.2 457 11/9/2024 1.5.2 is deprecated because it is no longer maintained.
1.5.1 285 8/1/2024 1.5.1 is deprecated because it is no longer maintained.
1.5.0 139 7/13/2024 1.5.0 is deprecated because it is no longer maintained.
1.5.0-beta1 101 7/13/2024 1.5.0-beta1 is deprecated because it is no longer maintained.
1.4.0 159 6/24/2024 1.4.0 is deprecated because it is no longer maintained.
1.3.0 125 6/24/2024 1.3.0 is deprecated because it is no longer maintained.
1.3.0-beta4 112 6/23/2024 1.3.0-beta4 is deprecated because it is no longer maintained.
1.3.0-beta3 112 6/8/2024 1.3.0-beta3 is deprecated because it is no longer maintained.
1.3.0-beta2 97 6/8/2024 1.3.0-beta2 is deprecated because it is no longer maintained.
1.3.0-beta1 121 6/8/2024 1.3.0-beta1 is deprecated because it is no longer maintained.
1.2.0 141 6/4/2024 1.2.0 is deprecated because it is no longer maintained.
1.2.0-beta6 110 6/3/2024 1.2.0-beta6 is deprecated because it is no longer maintained.
1.2.0-beta5 118 6/2/2024 1.2.0-beta5 is deprecated because it is no longer maintained.
1.2.0-beta4 117 6/1/2024 1.2.0-beta4 is deprecated because it is no longer maintained.
1.2.0-beta3 115 5/30/2024 1.2.0-beta3 is deprecated because it is no longer maintained.
1.2.0-beta2 118 5/30/2024 1.2.0-beta2 is deprecated because it is no longer maintained.
1.2.0-beta1 124 5/19/2024 1.2.0-beta1 is deprecated because it is no longer maintained.
1.1.0 233 5/19/2024 1.1.0 is deprecated because it is no longer maintained.
1.1.0-beta3 111 5/19/2024 1.1.0-beta3 is deprecated because it is no longer maintained.
1.1.0-beta2 110 5/18/2024 1.1.0-beta2 is deprecated because it is no longer maintained.
1.1.0-beta1 108 5/18/2024 1.1.0-beta1 is deprecated because it is no longer maintained.
1.0.8 132 5/13/2024 1.0.8 is deprecated because it is no longer maintained.
1.0.7 113 5/13/2024 1.0.7 is deprecated because it is no longer maintained.
1.0.6 175 5/4/2024 1.0.6 is deprecated because it is no longer maintained.
1.0.6-beta3 126 4/29/2024 1.0.6-beta3 is deprecated because it is no longer maintained.
1.0.6-beta2 102 4/28/2024 1.0.6-beta2 is deprecated because it is no longer maintained.
1.0.6-beta1 134 4/27/2024 1.0.6-beta1 is deprecated because it is no longer maintained.
1.0.5 140 4/26/2024 1.0.5 is deprecated because it is no longer maintained.
1.0.4 217 4/16/2024 1.0.4 is deprecated because it is no longer maintained.
1.0.3 172 4/11/2024 1.0.3 is deprecated because it is no longer maintained.
1.0.2 175 4/3/2024 1.0.2 is deprecated because it is no longer maintained.
1.0.1 180 3/23/2024 1.0.1 is deprecated because it is no longer maintained.
1.0.1-beta8 170 3/23/2024 1.0.1-beta8 is deprecated because it is no longer maintained.
1.0.1-beta7 173 3/17/2024 1.0.1-beta7 is deprecated because it is no longer maintained.
1.0.1-beta5 173 3/14/2024 1.0.1-beta5 is deprecated because it is no longer maintained.
1.0.1-beta4 152 3/14/2024 1.0.1-beta4 is deprecated because it is no longer maintained.
1.0.1-beta3 135 3/14/2024 1.0.1-beta3 is deprecated because it is no longer maintained.
1.0.1-beta2 129 3/14/2024 1.0.1-beta2 is deprecated because it is no longer maintained.