Skip to content

Latest commit

 

History

History
143 lines (89 loc) · 2.82 KB

File metadata and controls

143 lines (89 loc) · 2.82 KB

Prerequisites

  • Docker
  • Docker-compose 3.9

Project structure

Here is a preview of project tree :

Ecocode              # Root directory of "native" linter
|
+--android-plugin    # Android
|
+--java-plugin       # JAVA
|
+--php-plugin        # PHP
|
+--python-plugin     # Python
|
\--docker-compose.yml   # Docker compose file installing available analyzer // TODO

You will find more information about the plugins’ architecture in their folders

Howto build the SonarQube ecoCode plugins

Prerequisites

  • Java >= 8
  • Mvn 3

Preliminary steps

The Android plugin uses CodeNarc to scan the gradle files of Android projects. To have more information about CodeNarc: CodeNarc.

CodeNarc must be built separately. Please see the following steps:

Build CodeNarc (Gradle 6.9.2, Java 11), then add this custom-built CodeNarc to Maven dependencies:

mvn initialize

Build the code

You can build the project code by running the following command in the src directory. Maven will download the required dependencies.

mvn clean install

Each plugin is generated in its own src/<plugin>/target directory, but they are also copied to the src/lib directory.

Howto install SonarQube dev environment

Prerequisites

You must have built the plugins (see the steps above).

Start SonarQube

Run the SonarQube + PostgreSQL stack:

docker-compose up --build -d

Check if the containers are up:

docker ps

You should see two lines (one for sonarqube and one for postgres). If there is only postgres, check the logs:

docker ps -a
docker logs src_sonar_1

If you have this error on run: web_1 | [1]: max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144] you can allocate more virtual memory:

sudo sysctl -w vm.max_map_count=262144

For Windows:

wsl -d docker-desktop
sysctl -w vm.max_map_count=262144

Go to http://localhost:9000 and use these credentials:

login: admin
password: admin

When you are connected, generate a new token:

My Account -> Security -> Generate Tokens

img.png img_1.png

Start again your services using the token:

TOKEN=MY_TOKEN docker-compose up --build -d

Howto install Plugin Ecocode

Install dependencies from the root directory:

mvn clean install

.jar files (one per plugin) will be moved in src/lib repository after build.

Links