Skip to content

Commit a155b80

Browse files
authored
i-Code is directly embedded into the plugin (#46)
- i-Code analyzer is included directly in the plugin - enhancement of the CI for the plugin
1 parent 2e9c49a commit a155b80

File tree

12 files changed

+469
-115
lines changed

12 files changed

+469
-115
lines changed

.travis.yml

Lines changed: 22 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,34 @@
11
language: java
2-
32
sudo: false
43
install: true
54

5+
addons:
6+
sonarcloud:
7+
organization: "lequal"
8+
69
jdk:
7-
- oraclejdk8
10+
- openjdk8
11+
- openjdk11
12+
13+
script:
14+
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent package sonar:sonar
815

916
cache:
1017
directories:
11-
- '$HOME/.m2/repository'
12-
- '$HOME/.sonar/cache'
13-
- '$HOME/.sonar/installs'
14-
15-
addons:
16-
sonarqube: true
18+
- '$HOME/.m2/repository'
19+
- '$HOME/.sonar/cache'
1720

1821
notifications:
1922
email: false
2023

21-
addons:
22-
sonarcloud:
23-
organization: "lequal"
24-
token:
25-
secure: projettest # encrypted value of your token
26-
# Script to execute.
27-
28-
script:
29-
- mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install sonar:sonar -Dsonar.host.url=https://sonarcloud.io -Dsonar.organization=lequal -Dsonar.login=181e22946e5e05302ceb4513dae3dcc9f7161f2f
24+
deploy:
25+
provider: releases
26+
api_key: "$GITHUB_TOKEN"
27+
file_glob: true
28+
file: "target/sonar-icode-cnes-plugin-*.jar"
29+
skip_cleanup: true
30+
name: "Sonar i-Code CNES plugin"
31+
draft: true
32+
on:
33+
branch: master
34+
jdk: 'openjdk11'

README.md

Lines changed: 33 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -7,19 +7,49 @@
77

88
SonarQube plugin for the code analysis tool: i-Code CNES.
99

10-
SonarQube is an open platform to manage code quality. This plugin adds the ability to import i-Code results for Fortran (77 & 90) & Shell.
10+
SonarQube is an open platform to manage code quality. This plugin adds the ability to check Fortran (77 & 90) & Shell with i-Code or import pre-existing results of i-Code.
1111

1212
This plugin is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version.
1313

1414
You can get i-Code CNES on GitHub: [lequal/i-CodeCNES](https://github.com/lequal/i-CodeCNES).
1515

1616
### Quickstart
1717
- Setup a SonarQube instance.
18-
- Install i-Code command line application as described in [official documentation](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20Installation%20Manual%20-%20EN.pdf).
18+
- **[Optional]** Install i-Code command line application as described in [official documentation](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20Installation%20Manual%20-%20EN.pdf).
1919
- Install `sonaricode-*.jar` in `<SONARQUBE_HOME>/extensions/plugins/`.
20-
- Run i-Code manually or configure auto-launch in plugin configuration.
20+
- **[Optional]** Run i-Code manually or configure auto-launch in plugin configuration.
2121
- Run an analysis with *sonar-scanner*, *maven*, *gradle*, *msbuild*, etc.
2222

23+
#### Run i-Code automatically
24+
This SonarQube plugin is now able to run automaticcaly an embedded version of i-Code. If you do not specify properties to run i-Code [manually](#run-i-Code-manually) or [from a specific version](#Run-a-specific-i-Code-version-through-sonaricode-plugin), embedded version of i-Code will be executed.
25+
26+
Here is the compatibility matrix of the plugin:
27+
28+
| sonaricode version | embedded i-Code version |
29+
|:------------------:|:-----------------------:|
30+
| < 2.0.0 | none |
31+
| 2.0.0 | 3.2.0 |
32+
33+
#### Run i-Code manually
34+
If you need help to run i-Code please refer to the [official user manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) or [i-Code issue tracker](https://github.com/lequal/i-CodeCNES/issues).
35+
36+
#### Run a specific i-Code version through sonaricode plugin
37+
If embedded version of i-Code does not match your need, you can set the execution of another installed version of i-Code through the following properties:
38+
- `sonar.icode.launch`: Activate autolaunch for i-Code if `true`. Default: `false`.
39+
- `sonar.icode.path`: Define i-Code CNES executable path to auto-launch it on analysis. Default: `${HOME}/icode-cnes/icode.exe`.
40+
41+
#### Other plugin's properties
42+
- `sonar.icode.shell.file.suffixes`: List of suffixes for Shell files to analyze. Default: `.sh,.ksh,.bash`.
43+
- `sonar.icode.f77.file.suffixes`: List of suffixes for F77 files to analyze. Default: `.f,.f77,.for,.fpp,.ftn,.F,.F77,.FOR,.FPP,.FTN`.
44+
- `sonar.icode.f90.file.suffixes`: List of suffixes for F90 files to analyze. Default: `.f90,.F90`.
45+
- `sonar.icode.reports.path`: Path to the i-Code reports. Multiple path can be provided. Default: `result.res`.
46+
47+
### Features
48+
- Fortran 77 analysis
49+
- Fortran 90 analysis
50+
- Shell analysis
51+
- Import i-Code results
52+
2353
#### Get i-Code help
2454
Use `icode -h` to get the following help about i-Code:
2555
````
@@ -41,25 +71,6 @@ Analyze Shell, F77 & F90 code to find defects & bugs.
4171
Please report issues at https://github.com/lequal/i-CodeCNES/issues
4272
````
4373

44-
#### Run i-Code manually
45-
If you need help to run i-Code please refer to the [official user manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) or [i-Code issue tracker](https://github.com/lequal/i-CodeCNES/issues).
46-
47-
#### Run i-Code through sonaricode plugin
48-
In order to run i-Code automatically when running *sonar-scanner*, following SoanrQube properties have to be given:
49-
- `sonar.icode.launch`: Activate autolaunch for i-Code if `true`. Default: `false`.
50-
- `sonar.icode.path`: Define i-Code CNES executable path to auto-launch it on analysis. Default: `${HOME}/icode-cnes/icode.exe`.
51-
52-
#### Other plugin's properties
53-
- `sonar.icode.shell.file.suffixes`: List of suffixes for Shell files to analyze. Default: `.sh,.ksh,.bash`.
54-
- `sonar.icode.f77.file.suffixes`: List of suffixes for F77 files to analyze. Default: `.f,.f77,.for,.fpp,.ftn,.F,.F77,.FOR,.FPP,.FTN`.
55-
- `sonar.icode.f90.file.suffixes`: List of suffixes for F90 files to analyze. Default: `.f90,.F90`.
56-
- `sonar.icode.reports.path`: Path to the i-Code reports. Multiple path can be provided. Default: `result.res`.
57-
58-
### Features
59-
- Fortran 77 analysis
60-
- Fortran 90 analysis
61-
- Shell analysis
62-
6374
### How to contribute
6475
If you experienced a problem with the plugin please open an issue. Inside this issue please explain us how to reproduce this issue and paste the log.
6576

pom.xml

Lines changed: 83 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
33
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
44
<modelVersion>4.0.0</modelVersion>
5-
<groupId>fr.cnes.sonarqube.plugins</groupId>
6-
<artifactId>sonaricode</artifactId>
5+
6+
<groupId>fr.cnes.sonar.plugins</groupId>
7+
<artifactId>sonar-icode-cnes-plugin</artifactId>
78
<packaging>sonar-plugin</packaging>
8-
<version>1.1.0</version>
9+
<version>1.2.0-dev</version>
10+
911
<name>Sonar i-Code CNES plugin</name>
1012

1113
<description>i-Code CNES plugin for SonarQube</description>
@@ -27,16 +29,6 @@
2729
</organization>
2830

2931
<developers>
30-
<developer>
31-
<name>Cyrille Francois</name>
32-
<url>https://github.com/CfrancCyrille</url>
33-
<id>CfrancCyrille</id>
34-
</developer>
35-
<developer>
36-
<name>Nicolas Métivier</name>
37-
<url>https://github.com/AT-NicolasMetivier</url>
38-
<id>AT-NicolasMetivier</id>
39-
</developer>
4032
<developer>
4133
<name>Benoît Garçon</name>
4234
<organization>CNES</organization>
@@ -52,16 +44,35 @@
5244
</developers>
5345

5446
<properties>
55-
<jdk.version>1.8</jdk.version>
5647
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
48+
<jdk.version>1.8</jdk.version>
49+
<jdk.min.version>1.8</jdk.min.version>
50+
<jdk.max.version>1.8</jdk.max.version>
51+
<maven.compiler.source>1.8</maven.compiler.source>
52+
<maven.compiler.target>1.8</maven.compiler.target>
5753
<sonar.apiVersion>6.7.1</sonar.apiVersion>
54+
<sonar.sslr-squid-bridge.version>2.6.1</sonar.sslr-squid-bridge.version>
55+
<sonar-packaging-maven-plugin.version>1.17</sonar-packaging-maven-plugin.version>
56+
<commons-lang.version>3.7</commons-lang.version>
57+
<gson.version>2.8.2</gson.version>
5858
<slf4j.version>1.7.25</slf4j.version>
5959
<junit.version>4.12</junit.version>
60-
<project.key>icode</project.key>
60+
<jacoco.version>0.8.0</jacoco.version>
61+
<sonar.pluginKey>sonaricode</sonar.pluginKey>
62+
<sonar.pluginClass>fr.cnes.sonar.plugins.icode.ICodePlugin</sonar.pluginClass>
63+
<sonar.pluginUrl>https://github.com/lequal/sonar-icode-cnes-plugin</sonar.pluginUrl>
64+
<sonar.pluginOrganizationName>CNES</sonar.pluginOrganizationName>
6165
<sonar.sources>src/main/java</sonar.sources>
6266
<sonar.test>src/test/java</sonar.test>
6367
</properties>
6468

69+
<repositories>
70+
<repository>
71+
<id>jitpack.io</id>
72+
<url>https://jitpack.io</url>
73+
</repository>
74+
</repositories>
75+
6576
<dependencies>
6677
<dependency>
6778
<groupId>org.sonarsource.sonarqube</groupId>
@@ -70,7 +81,11 @@
7081
<scope>provided</scope>
7182
</dependency>
7283
<dependency>
73-
<!-- packaged with the plugin -->
84+
<groupId>com.github.Facthunder.i-CodeCNES</groupId>
85+
<artifactId>icode-library</artifactId>
86+
<version>3.2.0-dev-RC2</version>
87+
</dependency>
88+
<dependency>
7489
<groupId>commons-lang</groupId>
7590
<artifactId>commons-lang</artifactId>
7691
<version>2.6</version>
@@ -98,44 +113,26 @@
98113

99114
<build>
100115
<plugins>
101-
<plugin>
102-
<groupId>org.jacoco</groupId>
103-
<artifactId>jacoco-maven-plugin</artifactId>
104-
<version>0.7.6.201602180812</version>
105-
<executions>
106-
<execution>
107-
<id>prepare-agent</id>
108-
<goals>
109-
<goal>prepare-agent</goal>
110-
</goals>
111-
</execution>
112-
</executions>
113-
</plugin>
116+
114117
<plugin>
115118
<groupId>org.sonarsource.sonar-packaging-maven-plugin</groupId>
116119
<artifactId>sonar-packaging-maven-plugin</artifactId>
117-
<version>1.17</version>
120+
<version>${sonar-packaging-maven-plugin.version}</version>
118121
<extensions>true</extensions>
119-
<configuration>
120-
<pluginClass>fr.cnes.sonar.plugins.icode.ICodePlugin</pluginClass>
121-
<pluginKey>${project.key}</pluginKey>
122-
<pluginName>${project.name}</pluginName>
123-
<pluginDescription>${project.description}</pluginDescription>
124-
</configuration>
125122
</plugin>
123+
126124
<plugin>
127125
<groupId>org.apache.maven.plugins</groupId>
128126
<artifactId>maven-compiler-plugin</artifactId>
129-
<version>3.6.2</version>
127+
<version>3.5.1</version>
130128
<configuration>
131-
<source>${jdk.version}</source>
132-
<target>${jdk.version}</target>
133-
<encoding>${project.build.sourceEncoding}</encoding>
129+
<source>${jdk.min.version}</source>
130+
<target>${jdk.min.version}</target>
134131
</configuration>
135132
</plugin>
133+
136134
<plugin>
137-
<!-- UTF-8 bundles are not supported by Java, so they must be converted
138-
during build -->
135+
<!-- UTF-8 bundles are not supported by Java, so they must be converted during build -->
139136
<groupId>org.codehaus.mojo</groupId>
140137
<artifactId>native2ascii-maven-plugin</artifactId>
141138
<version>1.0-beta-1</version>
@@ -147,6 +144,50 @@
147144
</execution>
148145
</executions>
149146
</plugin>
147+
148+
<plugin>
149+
<groupId>org.apache.maven.plugins</groupId>
150+
<artifactId>maven-project-info-reports-plugin</artifactId>
151+
<version>2.9</version>
152+
<configuration>
153+
<dependencyLocationsEnabled>false</dependencyLocationsEnabled>
154+
</configuration>
155+
</plugin>
156+
157+
<plugin>
158+
<groupId>org.jacoco</groupId>
159+
<artifactId>jacoco-maven-plugin</artifactId>
160+
<version>${jacoco.version}</version>
161+
<executions>
162+
<execution>
163+
<id>prepare-agent</id>
164+
<goals>
165+
<goal>prepare-agent</goal>
166+
</goals>
167+
</execution>
168+
<execution>
169+
<id>report</id>
170+
<phase>prepare-package</phase>
171+
<goals>
172+
<goal>report</goal>
173+
</goals>
174+
</execution>
175+
<execution>
176+
<id>post-unit-test</id>
177+
<phase>test</phase>
178+
<goals>
179+
<goal>report</goal>
180+
</goals>
181+
<configuration>
182+
<!-- Sets the path to the file which contains the execution data. -->
183+
<dataFile>target/jacoco.exec</dataFile>
184+
<!-- Sets the output directory for the code coverage report. -->
185+
<outputDirectory>target/jacoco-ut</outputDirectory>
186+
</configuration>
187+
</execution>
188+
</executions>
189+
</plugin>
190+
150191
</plugins>
151192
</build>
152193
</project>

0 commit comments

Comments
 (0)