Skip to content

Commit

Permalink
Readme + VSIX (#17)
Browse files Browse the repository at this point in the history
  • Loading branch information
Djoums authored Mar 23, 2024
1 parent 59bda96 commit 37a1f3c
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 34 deletions.
33 changes: 17 additions & 16 deletions .github/workflows/create-tag-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -91,22 +91,23 @@ jobs:
- run: echo "PACKAGE=$(find . -name "EcoCode.${{ needs.versioning.outputs.tag }}.nupkg" | head -n 1)" >> $GITHUB_ENV
- run: dotnet nuget push ${{ env.PACKAGE }} -k "${{ secrets.NUGET_API_KEY }}" -s https://api.nuget.org/v3/index.json

publish-vsix: # Only if both builds succeeded, and the tag is not a pre-release
needs: [versioning, build-nuget, build-vsix]
if: ${{ needs.versioning.outputs.tag == needs.versioning.outputs.version }}
runs-on: windows-latest
steps:
- uses: actions/cache/restore@v4
with:
path: vsix
key: cache-${{ github.sha }}
enableCrossOsArchive: true
fail-on-cache-miss: true
- uses: cezarypiatek/VsixPublisherAction@1.1
with:
extension-file: vsix\EcoCode.vsix
publish-manifest-file: vsix\publishManifest.json
personal-access-code: ${{ secrets.VSMARKETPLACE_API_KEY }}
# Reenable when we have a VS Marketplace account and API key
# publish-vsix: # Only if both builds succeeded, and the tag is not a pre-release
# needs: [versioning, build-nuget, build-vsix]
# if: ${{ needs.versioning.outputs.tag == needs.versioning.outputs.version }}
# runs-on: windows-latest
# steps:
# - uses: actions/cache/restore@v4
# with:
# path: vsix
# key: cache-${{ github.sha }}
# enableCrossOsArchive: true
# fail-on-cache-miss: true
# - uses: cezarypiatek/VsixPublisherAction@1.1
# with:
# extension-file: vsix\EcoCode.vsix
# publish-manifest-file: vsix\publishManifest.json
# personal-access-code: ${{ secrets.VSMARKETPLACE_API_KEY }}

create-release: # Only if both builds succeeded
needs: [versioning, build-nuget, build-vsix]
Expand Down
40 changes: 22 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
EcoCode-C#
[![EcoCode on NuGet](https://img.shields.io/nuget/v/EcoCode.svg)](https://www.nuget.org/packages/EcoCode/) [![EcoCode on NuGet](https://img.shields.io/nuget/dt/EcoCode)](https://www.nuget.org/packages/EcoCode/)

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.
Expand All @@ -9,36 +11,38 @@ This set of Roslyn analyzers implements these catalogs as rules for scanning you

> ⚠️ 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](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
[![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_OF_CONDUCT.md)

🌿 Framework
-------------------

This analyzer is made to be published as NuGet package, and is compiled using the .Net Standard 2.0 Framework.
You can find a list of all our other plugins in the [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-sonarqube-plugins)
[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0) [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg)](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CODE_OF_CONDUCT.md)

🚀 Getting Started
------------------

Install the EcoCode NuGet package in your .Net project, and automatically benefit from the enhanced Roslyn analysis.

🛒 Distribution
------------------

You can find the EcoCode NuGet package at [this URL](https://www.nuget.org/packages/EcoCode/), or through your usual NuGet package manager.
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, you'll find the .vsix file in the [latest release](https://github.com/green-code-initiative/ecoCode-csharp/releases/latest) on GitHub. It will be published on the VS marketplace once everything is ready !
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](https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/scanners/sonarscanner-for-dotnet/) and display the EcoCode warnings in [SonarQube](https://www.sonarsource.com/products/sonarqube/).

🧩 Compatibility
-----------------

See Microsoft documentation for [.Net Standard 2.0](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0#select-net-standard-version).
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](https://learn.microsoft.com/en-us/dotnet/standard/net-standard?tabs=net-standard-2-0#select-net-standard-version) for details about the supported .Net Frameworks in .Net Standard 2.0.

🌿 Rules
-------------------

|Id|Description|Severity|Enabled|Code fix|
|--|-----------|:------:|:--------:|:------:|
|[EC69](https://github.com/green-code-initiative/ecoCode/blob/main/ecocode-rules-specifications/src/main/rules/EC69/csharp/EC69.asciidoc)|Don’t call loop invariant functions in loop conditions|⚠️|✔️||
|[EC72](https://github.com/green-code-initiative/ecoCode/blob/main/ecocode-rules-specifications/src/main/rules/EC72/csharp/EC72.asciidoc)|Don’t execute SQL queries in loops|⚠️|✔️||
|[EC75](https://github.com/green-code-initiative/ecoCode/blob/main/ecocode-rules-specifications/src/main/rules/EC75/csharp/EC75.asciidoc)|Don’t concatenate `strings` in loops|⚠️|✔️||

🤝 Contribution
---------------

Check [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-contribution)
See [contribution](https://github.com/green-code-initiative/ecoCode#-contribution) on the central ecoCode repository.

🤓 Main contributors
--------------------

Check [ecoCode repository](https://github.com/green-code-initiative/ecoCode#-main-contributors)
See [main contributors](https://github.com/green-code-initiative/ecoCode#-main-contributors) on the central ecoCode repository.

0 comments on commit 37a1f3c

Please sign in to comment.