Skip to content

Commit

Permalink
Move to Creedengo
Browse files Browse the repository at this point in the history
  • Loading branch information
utarwyn committed Jan 5, 2025
1 parent 8809ea6 commit e09917e
Show file tree
Hide file tree
Showing 90 changed files with 407 additions and 353 deletions.
8 changes: 4 additions & 4 deletions .github/ISSUE_TEMPLATE/bug-report.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: 🐞 Bug Report
description: This form is to report unexpected behavior in ecoCode-javascript.
labels: [ "💉 bug: unconfirmed" ]
description: This form is to report unexpected behavior in creedengo-javascript.
labels: ["💉 bug: unconfirmed"]
body:
- type: markdown
attributes:
Expand Down Expand Up @@ -40,8 +40,8 @@ body:
- type: input
id: plugin-version
attributes:
label: ecoCode-javascript Version
description: Please provide the version of ecoCode-javascript that you are using.
label: creedengo-javascript Version
description: Please provide the version of creedengo-javascript that you are using.
validations:
required: true
- type: input
Expand Down
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
blank_issues_enabled: false
contact_links:
- name: Start a Discussion
about: "Start a discussion to share your experience with ecoCode-javascript"
url: https://github.com/green-code-initiative/ecoCode-javascript/discussions/new/choose
about: "Start a discussion to share your experience with creedengo-javascript"
url: https://github.com/green-code-initiative/creedengo-javascript/discussions/new/choose
4 changes: 2 additions & 2 deletions .github/ISSUE_TEMPLATE/feature-request.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: ✨ Feature Request
description: This form is to request a new feature in ecoCode-javascript.
labels: [ "🚀 enhancement" ]
description: This form is to request a new feature in creedengo-javascript.
labels: ["🚀 enhancement"]
body:
- type: textarea
id: solution
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish
on:
push:
tags:
- '[0-9]+.[0-9]+.[0-9]+'
- "[0-9]+.[0-9]+.[0-9]+"

permissions:
packages: write
Expand All @@ -26,7 +26,7 @@ jobs:
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
registry-url: 'https://registry.npmjs.org'
registry-url: "https://registry.npmjs.org"

- name: Install dependencies
run: yarn install --immutable
Expand Down Expand Up @@ -62,7 +62,7 @@ jobs:
run: cp LICENSE.md eslint-plugin/

- name: Add scope to package name
run: npx --yes change-package-name @${{ github.repository_owner }}/ecocode-eslint-plugin
run: npx --yes change-package-name @${{ github.repository_owner }}/creedengo-eslint-plugin
working-directory: eslint-plugin

- name: Configure GitHub Packages registry
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ on:
workflow_dispatch:
inputs:
strategy:
description: 'Strategy of semantic version to apply'
description: "Strategy of semantic version to apply"
required: true
type: choice
options:
Expand Down Expand Up @@ -37,7 +37,7 @@ jobs:
node-version: ${{ env.NODE_VERSION }}

- name: Use JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JDK_VERSION }}
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:
tag_name: ${{ steps.package-version.outputs.version }}
body: ${{ steps.extract-release-notes.outputs.release_notes }}
token: ${{ secrets.RELEASE_TOKEN }}
files: sonar-plugin/target/ecocode-javascript-plugin-${{ steps.package-version.outputs.version }}.jar
files: sonar-plugin/target/creedengo-javascript-plugin-${{ steps.package-version.outputs.version }}.jar

prepare-next-release:
name: Prepare next release
Expand All @@ -108,7 +108,7 @@ jobs:
token: ${{ secrets.RELEASE_TOKEN }}

- name: Use JDK ${{ env.JDK_VERSION }}
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: ${{ env.JDK_VERSION }}
Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

- [#39](https://github.com/green-code-initiative/ecoCode-javascript/issues/39) Add rule `@ecocode/avoid-brightness-override` (EC522)
- [#41](https://github.com/green-code-initiative/ecoCode-javascript/pull/41) Add rule `@ecocode/no-torch` (EC530)
- Rename plugin to creedengo-javascript
- Add support for SonarQube up to 10.7

### Changed
Expand Down
16 changes: 8 additions & 8 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
## Hello! We are pleased to see you here 👋

Please read
common [CONTRIBUTING.md](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/CONTRIBUTING.md)
in `ecoCode-common` repository first.\
Also check the [starter pack](https://github.com/green-code-initiative/ecoCode-common/blob/main/doc/starter-pack.md) to
common [CONTRIBUTING.md](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/CONTRIBUTING.md)
in `creedengo-common` repository first.\
Also check the [starter pack](https://github.com/green-code-initiative/creedengo-common/blob/main/doc/starter-pack.md) to
have the basic information before starting.

## Structure
Expand Down Expand Up @@ -49,9 +49,9 @@ But it can be useful to prepare a test project to check the correct execution of

### Before starting

Before even starting to implement the rule, it must have been discussed, mesured and documented in the ecoCode
Before even starting to implement the rule, it must have been discussed, mesured and documented in the Creedengo
referential. Please follow
the [dedicated documentation](https://github.com/green-code-initiative/ecoCode/blob/main/ecocode-rules-specifications/README.md)
the [dedicated documentation](https://github.com/green-code-initiative/creedengo-rules-specifications/blob/main/README.md#creedengo-rules-specification-repository)
to find out how to proceed.

### In the ESLint plugin
Expand All @@ -74,11 +74,11 @@ The project itself uses ESLint to helps linting rule algorithms.

### In the SonarQube plugin

Now that the rule has been implemented in the ecoCode referential and its implementation written in the ESLint plugin,
Now that the rule has been implemented in the Creedengo referential and its implementation written in the ESLint plugin,
all that remains is to reference it in the SonarQube plugin. Here are the simple steps:

1. Create a Java class in `src/main/java/io/ecocode/javascript/checks/` with the declaration of the SonarQube key and
the ESLint key (check other classes to have an example)
1. Create a Java class in `src/main/java/fr/greencodeinitiative/creedengo/javascript/checks/` with
the declaration of the SonarQube key and the ESLint key (check other classes to have an example)
2. Reference created in method `getAllChecks()` of Java class `CheckList` (please use alphabetical order)
3. Add the SonarQube key of the rule in the appropriate profile Json file.

Expand Down
44 changes: 17 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,17 @@
![Logo](https://github.com/green-code-initiative/ecoCode/blob/main/docs/resources/logo-large.png?raw=true)
# Creedengo-JS

Websites are becoming increasingly heavy and complex over the years. They represent an important part
of the digital environmental footprint. The objective of this project is to detect smells in a website source code
that can have a negative ecological impact: overconsumption of energy, "fatware", shortening of the life span of
devices, etc. This project is part of [ecoCode](https://github.com/green-code-initiative/ecoCode).
_creedengo_ 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.

Rules in this repository are mainly based from book
[115 Web Ecodesign Best Practices](https://github.com/cnumr/best-practices).
This reference is maintained by [CNumR](https://collectif.greenit.fr/), a french collective that works
for a responsible design of digital services. You can find all applicable rules in the [RULES.md file](RULES.md).
Websites are becoming increasingly heavy and complex over the years. They represent an important part
of the digital environmental footprint. The JavaScript/TypeScript part of the project focuses on providing rules and guidelines to optimize web applications and server-side code written in JavaScript and TypeScript.

[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)
![Build](https://github.com/green-code-initiative/ecoCode-javascript/actions/workflows/build.yml/badge.svg)
![Build](https://github.com/green-code-initiative/creedengo-javascript/actions/workflows/ci.yml/badge.svg)
[![Sonar Quality gate](https://img.shields.io/sonar/quality_gate/green-code-initiative_ecoCode-linter?server=https%3A%2F%2Fsonarcloud.io)](https://sonarcloud.io/project/overview?id=green-code-initiative_ecoCode-linter)

🌿 SonarQube plugin
---------------------------------
## 🌿 SonarQube plugin

_ecoCode_ JavaScript is an "eco-responsibility" static code analyzer for projects based on the JavaScript ecosystem. It
_Creedengo_ JavaScript is an "eco-responsibility" static code analyzer for projects based on the JavaScript ecosystem. It
can handle JavaScript, TypeScript and all frameworks that use them. Its main purpose is to work with website source
code, but it can also analyze back-end code.

Expand All @@ -29,46 +23,42 @@ This project proposes rules for the following technologies:
- React (JSX)
- React Native / Expo

🔧 ESLint plugin
----------------
## 🔧 ESLint plugin

This project uses an internal ESLint plugin to analyze your source code.

If you are not using SonarQube, we have a solution for you: the linter is working nicely on its own! \
Follow instructions in the [dedicated README file](eslint-plugin/README.md) to use it as a standalone plugin.

🛒 Distribution
---------------
## 🛒 Distribution

[![sonar-plugin version](https://img.shields.io/github/v/release/green-code-initiative/ecoCode-javascript?label=SonarQube%20plugin)](https://github.com/green-code-initiative/ecoCode-javascript/releases/latest)
[![eslint-plugin version](https://img.shields.io/npm/v/@ecocode/eslint-plugin?label=ESLint%20plugin)](https://npmjs.com/package/@ecocode/eslint-plugin)
[![sonar-plugin version](https://img.shields.io/github/v/release/green-code-initiative/creedengo-javascript?label=SonarQube%20plugin)](https://github.com/green-code-initiative/creedengo-javascript/releases/latest)
[![eslint-plugin version](https://img.shields.io/npm/v/@creedengo/eslint-plugin?label=ESLint%20plugin)](https://npmjs.com/package/@creedengo/eslint-plugin)

**The plugin is available from the official SonarQube marketplace! Check the
[version matrix here](https://docs.sonarsource.com/sonarqube/latest/instance-administration/plugin-version-matrix/).**

Ready to use binaries for SonarQube are also
available [from GitHub](https://github.com/green-code-initiative/ecoCode-javascript/releases). \
available [from GitHub](https://github.com/green-code-initiative/creedengo-javascript/releases). \
Make sure to place the binary inside `extensions/plugins/` folder of your SonarQube instance.

The standalone version of the ESLint plugin is available from [npmjs](https://npmjs.com/package/@ecocode/eslint-plugin).
The standalone version of the ESLint plugin is available from [npmjs](https://npmjs.com/package/@creedengo/eslint-plugin).

🧩 Compatibility
----------------
## 🧩 Compatibility

| Plugins Version | SonarQube version | ESLint version |
|-----------------|-------------------|----------------|
| --------------- | ----------------- | -------------- |
| 1.4.+, 1.5.+ | 9.9.+ LTA to 10.7 | 7+ |

🤝 Contribution
---------------
## 🤝 Contribution

You have an idea or you want to help us improving this project? \
We are open to your suggestions and contributions! Open an issue or PR 🚀

Check out the [CONTRIBUTING.md](CONTRIBUTING.md) file
and follow the various guides to start contributing.

Thank you to all the people who already contributed to ecoCode-javascript!
Thank you to all the people who already contributed to creedengo-javascript!

- Elise Dubillot
- Laetitia Bézie
2 changes: 1 addition & 1 deletion RULES.md
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Please read [RULES.md](https://github.com/green-code-initiative/ecoCode/blob/main/RULES.md) in `ecoCode` repository.
Please read [RULES.md](https://github.com/green-code-initiative/creedengo-rules-specifications/blob/main/RULES.md) in `creedengo-rules-specifications` repository.
10 changes: 5 additions & 5 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
name: sonarqube_ecocode_javascript
name: sonarqube_creedengo_javascript

services:
sonar:
image: sonarqube:10.7-community
container_name: sonar_ecocode_javascript
container_name: sonar_creedengo_javascript
ports:
- "9000:9000"
networks:
Expand All @@ -19,8 +19,8 @@ services:
SONAR_ES_BOOTSTRAP_CHECKS_DISABLE: "true"
volumes:
- type: bind
source: ./sonar-plugin/target/ecocode-javascript-plugin-1.5.1-SNAPSHOT.jar
target: /opt/sonarqube/extensions/plugins/ecocode-javascript-plugin-1.5.1-SNAPSHOT.jar
source: ./sonar-plugin/target/creedengo-javascript-plugin-1.5.1-SNAPSHOT.jar
target: /opt/sonarqube/extensions/plugins/creedengo-javascript-plugin-1.5.1-SNAPSHOT.jar
- "extensions:/opt/sonarqube/extensions"
- "logs:/opt/sonarqube/logs"
- "data:/opt/sonarqube/data"
Expand All @@ -32,7 +32,7 @@ services:

db:
image: postgres:16-alpine
container_name: postgresql_ecocode_javascript
container_name: postgresql_creedengo_javascript
networks:
- sonarnet
volumes:
Expand Down
4 changes: 2 additions & 2 deletions eslint-plugin/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
* Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
* creedengo JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
* Copyright © 2023 Green Code Initiative (https://green-code-initiative.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
39 changes: 17 additions & 22 deletions eslint-plugin/README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,22 @@
![Logo](https://github.com/green-code-initiative/ecoCode/blob/main/docs/resources/logo-large.png?raw=true)
======================================
# Creedengo-JS

An ESLint plugin which provides JavaScript and TypeScript rules of the ecoCode project.
An ESLint plugin which provides JavaScript and TypeScript rules of the Creedengo project.

👉 See [ecoCode-javascript README](../README.md) to have more information.
👉 See [creedengo-javascript README](../README.md) to have more information.

> ⚠️ This plugin is in a very early stage and need improvements. Any contribution will be appreciated.
🚀 Getting started
------------------
## 🚀 Getting started

### Installation

You'll need to install [ESLint](https://eslint.org/) (v7 or newer) and this plugin:

```sh
# yarn
yarn add -D eslint @ecocode/eslint-plugin
yarn add -D eslint @creedengo/eslint-plugin
# npm
npm install -D eslint @ecocode/eslint-plugin
npm install -D eslint @creedengo/eslint-plugin
```

> You are using TypeScript? You will also need to install [typescript-eslint](https://typescript-eslint.io/) to enable
Expand All @@ -31,36 +29,35 @@ The plugin is also available from GitHub npm registry under "green-code-initiati

```sh
# yarn
yarn add -D eslint @green-code-initiative/ecocode-eslint-plugin
yarn add -D eslint @green-code-initiative/creedengo-eslint-plugin
# npm
npm install -D eslint @green-code-initiative/ecocode-eslint-plugin
npm install -D eslint @green-code-initiative/creedengo-eslint-plugin
```

### Enable whole plugin

Add `@ecocode` recommended configuration to `extends` section of your `.eslintrc`:
Add `@creedengo` recommended configuration to `extends` section of your `.eslintrc`:

```jsonc
{
"extends": ["plugin:@ecocode/recommended"]
"extends": ["plugin:@creedengo/recommended"],
}
```

### Enable only some rules

Add `@ecocode` to the `plugins` section of your `.eslintrc`, followed by rules configuration:
Add `@creedengo` to the `plugins` section of your `.eslintrc`, followed by rules configuration:

```jsonc
{
"plugins": ["@ecocode"],
"plugins": ["@creedengo"],
"rules": {
"@ecocode/no-multiple-access-dom-element": "error"
}
"@creedengo/no-multiple-access-dom-element": "error",
},
}
```

🔨 Rules
--------
## 🔨 Rules

<!-- begin auto-generated rules list -->

Expand All @@ -84,8 +81,6 @@ Add `@ecocode` to the `plugins` section of your `.eslintrc`, followed by rules c

<!-- end auto-generated rules list -->

## 🛒 Distribution

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

You can follow changelog on [GitHub Releases page](https://github.com/green-code-initiative/ecoCode-linter/releases).
You can follow changelog on [GitHub Releases page](https://github.com/green-code-initiative/creedengo-javascript/releases).
4 changes: 2 additions & 2 deletions eslint-plugin/docs/license-header.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* ecoCode JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
* Copyright © 2023 Green Code Initiative (https://www.ecocode.io)
* creedengo JavaScript plugin - Provides rules to reduce the environmental footprint of your JavaScript programs
* Copyright © 2023 Green Code Initiative (https://green-code-initiative.org)
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/docs/rules/avoid-brightness-override.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Should avoid to override brightness (`@ecocode/avoid-brightness-override`)
# Should avoid to override brightness (`@creedengo/avoid-brightness-override`)

⚠️ This rule _warns_ in the ✅ `recommended` config.

Expand Down
2 changes: 1 addition & 1 deletion eslint-plugin/docs/rules/avoid-css-animations.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Avoid usage of CSS animations (`@ecocode/avoid-css-animations`)
# Avoid usage of CSS animations (`@creedengo/avoid-css-animations`)

⚠️ This rule _warns_ in the ✅ `recommended` config.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Avoid using high accuracy geolocation in web applications (`@ecocode/avoid-high-accuracy-geolocation`)
# Avoid using high accuracy geolocation in web applications (`@creedengo/avoid-high-accuracy-geolocation`)

⚠️ This rule _warns_ in the ✅ `recommended` config.

Expand Down
Loading

0 comments on commit e09917e

Please sign in to comment.