From 99c37678297cd692adc6e9bcb71e055eed94f55d Mon Sep 17 00:00:00 2001 From: Floriana-Cmphn <41742765+Floriana-Cmphn@users.noreply.github.com> Date: Thu, 26 Jul 2018 14:34:09 +0000 Subject: [PATCH 01/34] Initial Home page --- Home.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 Home.md diff --git a/Home.md b/Home.md new file mode 100644 index 00000000..7487d3f9 --- /dev/null +++ b/Home.md @@ -0,0 +1 @@ +# i-Code CNES Wiki \ No newline at end of file From 15ba03231f02653f07344684dabf13a23db191f4 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Wed, 26 Sep 2018 10:14:43 +0200 Subject: [PATCH 02/34] Updated Home (markdown) --- Home.md | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/Home.md b/Home.md index 7487d3f9..a35df868 100644 --- a/Home.md +++ b/Home.md @@ -1 +1,12 @@ -# i-Code CNES Wiki \ No newline at end of file +# i-Code CNES Wiki + +i-Code CNES is a static analysis tools for Fortran and Shell, it's verifying code compliancy with CNES standards (RNC). + +# Documentation +* [[User Manual]] +* [[Installation Manual]] +* [[Developper Guide]] + +# Quick install + +# Quick use \ No newline at end of file From 4d6cb38e1bda0439ee6af1ddc4d5f642cb9aa632 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 15:37:55 +0200 Subject: [PATCH 03/34] Updated Home (markdown) --- Home.md | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 51 insertions(+), 2 deletions(-) diff --git a/Home.md b/Home.md index a35df868..43eb9eb6 100644 --- a/Home.md +++ b/Home.md @@ -7,6 +7,55 @@ i-Code CNES is a static analysis tools for Fortran and Shell, it's verifying cod * [[Installation Manual]] * [[Developper Guide]] -# Quick install +# Quick install +## i-Code CNES Eclipse plugin +Download the eclipse plugin archive of the last release [link](https://github.com/lequal/i-CodeCNES/releases). + +Then, launch Eclipse and select the **Help > Install new Software**. On the wizard, select **Add** and **Archive..** and select i-Code CNES archive. + +Restart Eclipse. + +## i-Code CNES IDE + +Download and unzip the latest IDE version in a folder. + +## i-Code CNES CLI +Download the latest i-Code CNES CLI version [link](https://github.com/lequal/i-CodeCNES/releases). Then put the archive in your choosen location. + +**On linux** +```sh +unzip i-CodeCNES-3.1.0-CLI-linux.gtk.x86.zip +alias icode=$(pwd)/i-CodeCNES-3.1.0-CLI-linux/icode + +``` + +**On Windows (powershell)** +Extract the archive, then : +```ps +Set-Alias icode c:\user\tools\icode.exe +``` + +# Quick analysis +## i-Code CNES IDE and Eclipse plugin +### Preferences +Select `Window > Preferences > i-Code CNES`. + +You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit Metrics threeshold. + +### Launching an analysis +Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. +## i-Code CNES CLI + +In your project folder, use the following command to analyze all files : +```sh +# Analyse whole project +icode '**/*' + +# Analyse whole project and make an xml output of the analysis +icode '**/*' -f xml -o output.xml + +# List all functionality and description +icode --help +``` + -# Quick use \ No newline at end of file From 93d2946b0b5956a48cb55f49dafa31b937fdcc6a Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 15:39:02 +0200 Subject: [PATCH 04/34] Updated Home (markdown) --- Home.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Home.md b/Home.md index 43eb9eb6..d6c1ab40 100644 --- a/Home.md +++ b/Home.md @@ -3,8 +3,8 @@ i-Code CNES is a static analysis tools for Fortran and Shell, it's verifying code compliancy with CNES standards (RNC). # Documentation -* [[User Manual]] -* [[Installation Manual]] +* [User Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) +* [Installation Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20Installation%20Manual%20-%20EN.pdf) * [[Developper Guide]] # Quick install From b34c86854c3db8be11956798952c2a7acbb9b7bd Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 15:57:55 +0200 Subject: [PATCH 05/34] Updated Home (markdown) --- Home.md | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Home.md b/Home.md index d6c1ab40..2112e930 100644 --- a/Home.md +++ b/Home.md @@ -36,6 +36,15 @@ Set-Alias icode c:\user\tools\icode.exe ``` # Quick analysis +## ⚠️ File extensions +Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an anlysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. + +Extension supported by languages : +* Shell : sh, ksh, bash +* Fortran : f, f77, f90, F, F90, F77, fortran + +> A Shell file for instance, like "no_extension" should be renamed "no_extension.sh" before running the analysis. + ## i-Code CNES IDE and Eclipse plugin ### Preferences Select `Window > Preferences > i-Code CNES`. @@ -58,4 +67,3 @@ icode '**/*' -f xml -o output.xml icode --help ``` - From d677021708939b453b0d069e275fec68e2fc32fe Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:13:37 +0200 Subject: [PATCH 06/34] Updated Home (markdown) --- Home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Home.md b/Home.md index 2112e930..4c5709b5 100644 --- a/Home.md +++ b/Home.md @@ -36,7 +36,7 @@ Set-Alias icode c:\user\tools\icode.exe ``` # Quick analysis -## ⚠️ File extensions +## ⚠️ Filename extension Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an anlysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. Extension supported by languages : From 57fc5545f78a00280cf46746bdcd6bb64914ec7e Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:14:19 +0200 Subject: [PATCH 07/34] Updated Home (markdown) --- Home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Home.md b/Home.md index 4c5709b5..cb6a0242 100644 --- a/Home.md +++ b/Home.md @@ -43,7 +43,7 @@ Extension supported by languages : * Shell : sh, ksh, bash * Fortran : f, f77, f90, F, F90, F77, fortran -> A Shell file for instance, like "no_extension" should be renamed "no_extension.sh" before running the analysis. +> A Shell file for instance `no_extension` should be renamed `no_extension.sh` in order to be analyzed. ## i-Code CNES IDE and Eclipse plugin ### Preferences From 516ac2a6eb277a58ec3ee511a2c7325b56b388b7 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:15:13 +0200 Subject: [PATCH 08/34] Updated Home (markdown) --- Home.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Home.md b/Home.md index cb6a0242..f91e3e84 100644 --- a/Home.md +++ b/Home.md @@ -49,7 +49,7 @@ Extension supported by languages : ### Preferences Select `Window > Preferences > i-Code CNES`. -You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit Metrics threeshold. +You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit Metrics threshold. ### Launching an analysis Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. From 4bbbbb4358599a1a4bee52b7651dc13ad26786d3 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:27:52 +0200 Subject: [PATCH 09/34] Created Developper Guide (markdown) --- Developper-Guide.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) create mode 100644 Developper-Guide.md diff --git a/Developper-Guide.md b/Developper-Guide.md new file mode 100644 index 00000000..b779e03f --- /dev/null +++ b/Developper-Guide.md @@ -0,0 +1,15 @@ +This page introduce common informations required for the developpement in i-Code CNES. + + + +# Requirements +## Tools +To be able to make your own i-Code CNES Developpements, we recommend you to install +* Latest release of [Eclipse RCP](http://www.eclipse.org/downloads/packages/release/2018-09/r/eclipse-ide-rcp-and-rap-developers) +* Maven +* Java JDK <8 + +## Knowledge +A few Lexer and Lava knowledges are required to be able to edit or create new checkers, however this part is hugely explained in [[Checkers implementation]]. + + From 1428ad97c1ea3335a5cb2f3b13a0aff9472ea44e Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:44:34 +0200 Subject: [PATCH 10/34] Updated Developper Guide (markdown) --- Developper-Guide.md | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/Developper-Guide.md b/Developper-Guide.md index b779e03f..256de485 100644 --- a/Developper-Guide.md +++ b/Developper-Guide.md @@ -1,6 +1,4 @@ -This page introduce common informations required for the developpement in i-Code CNES. - - +This page contains recommandations for developpers who had like to contribute to i-Code CNES. Feel free to ask further informations [issues](https://github.com/lequal/i-CodeCNES/issues). # Requirements ## Tools From c1bd8cffe1f5cb2c106ad366bea6635a713d95d7 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:47:11 +0200 Subject: [PATCH 11/34] Created _Sidebar (markdown) --- _Sidebar.md | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 _Sidebar.md diff --git a/_Sidebar.md b/_Sidebar.md new file mode 100644 index 00000000..8fdf2874 --- /dev/null +++ b/_Sidebar.md @@ -0,0 +1,7 @@ +# [[Home]] +# [[User Manual]] +# [[Installation Manual]] +# [[Developper guide]] +## [[Architecture]] +## [[Checkers implementation]] +## [[Plugin contribution]] \ No newline at end of file From 2db60eda954333c4deb64dd93380ff74d4d30c47 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:47:37 +0200 Subject: [PATCH 12/34] Updated _Sidebar (markdown) --- _Sidebar.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/_Sidebar.md b/_Sidebar.md index 8fdf2874..375b7a10 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -1,7 +1,7 @@ -# [[Home]] -# [[User Manual]] -# [[Installation Manual]] -# [[Developper guide]] -## [[Architecture]] -## [[Checkers implementation]] -## [[Plugin contribution]] \ No newline at end of file +[[Home]] +[[User Manual]] +[[Installation Manual]] +[[Developper guide]] +[[Architecture]] + [[Checkers implementation]] + [[Plugin contribution]] \ No newline at end of file From c75a332b8ccc370e5de27c4c360acff89f47ede4 Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:48:07 +0200 Subject: [PATCH 13/34] Updated _Sidebar (markdown) --- _Sidebar.md | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/_Sidebar.md b/_Sidebar.md index 375b7a10..de7cfb15 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -1,7 +1,7 @@ -[[Home]] -[[User Manual]] -[[Installation Manual]] -[[Developper guide]] -[[Architecture]] - [[Checkers implementation]] - [[Plugin contribution]] \ No newline at end of file +* [[Home]] +* [[User Manual]] +* [[Installation Manual]] +* [[Developper guide]] +* [[Architecture]] + * [[Checkers implementation]] + * [[Plugin contribution]] \ No newline at end of file From 267407c0501df2288b3bdfcaa66ea8047172807a Mon Sep 17 00:00:00 2001 From: Omar WALDMANN Date: Thu, 27 Sep 2018 16:48:54 +0200 Subject: [PATCH 14/34] Updated _Sidebar (markdown) --- _Sidebar.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_Sidebar.md b/_Sidebar.md index de7cfb15..2d280992 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -1,7 +1,7 @@ * [[Home]] -* [[User Manual]] -* [[Installation Manual]] +* [User Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) +* [Installation Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20Installation%20Manual%20-%20EN.pdf) * [[Developper guide]] -* [[Architecture]] + * [[Architecture]] * [[Checkers implementation]] * [[Plugin contribution]] \ No newline at end of file From 68b14d7cda56f1de97b0aaeebc7efb5758fbc55b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 10 Sep 2019 18:50:38 +0200 Subject: [PATCH 15/34] Updated Home (markdown) --- Home.md | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/Home.md b/Home.md index f91e3e84..6e19571f 100644 --- a/Home.md +++ b/Home.md @@ -1,6 +1,6 @@ # i-Code CNES Wiki -i-Code CNES is a static analysis tools for Fortran and Shell, it's verifying code compliancy with CNES standards (RNC). +i-Code CNES is a static analysis tool for Fortran and Shell, it's verifying code compliancy with CNES standards (RNC). # Documentation * [User Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) @@ -9,7 +9,7 @@ i-Code CNES is a static analysis tools for Fortran and Shell, it's verifying cod # Quick install ## i-Code CNES Eclipse plugin -Download the eclipse plugin archive of the last release [link](https://github.com/lequal/i-CodeCNES/releases). +Download the eclipse plugin archive of the [last release](https://github.com/lequal/i-CodeCNES/releases). Then, launch Eclipse and select the **Help > Install new Software**. On the wizard, select **Add** and **Archive..** and select i-Code CNES archive. @@ -26,7 +26,6 @@ Download the latest i-Code CNES CLI version [link](https://github.com/lequal/i-C ```sh unzip i-CodeCNES-3.1.0-CLI-linux.gtk.x86.zip alias icode=$(pwd)/i-CodeCNES-3.1.0-CLI-linux/icode - ``` **On Windows (powershell)** From bb4e550dd32794b95b22dade533376471b1d2674 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sat, 25 Jan 2020 11:12:39 +0100 Subject: [PATCH 16/34] Updated Home (markdown) --- Home.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Home.md b/Home.md index 6e19571f..d0b060c1 100644 --- a/Home.md +++ b/Home.md @@ -3,15 +3,15 @@ i-Code CNES is a static analysis tool for Fortran and Shell, it's verifying code compliancy with CNES standards (RNC). # Documentation -* [User Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) -* [Installation Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20Installation%20Manual%20-%20EN.pdf) +* [[User Manual]] +* [[Installation Manual]] * [[Developper Guide]] # Quick install ## i-Code CNES Eclipse plugin Download the eclipse plugin archive of the [last release](https://github.com/lequal/i-CodeCNES/releases). -Then, launch Eclipse and select the **Help > Install new Software**. On the wizard, select **Add** and **Archive..** and select i-Code CNES archive. +Then, launch Eclipse and select the **Help > Install new Software**. On the wizard, select **Add** and **Archive...** and select i-Code CNES archive. Restart Eclipse. From d1dd5751c60f4b4bf822892c27d2fe6392fb1854 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sat, 25 Jan 2020 11:13:26 +0100 Subject: [PATCH 17/34] Updated _Sidebar (markdown) --- _Sidebar.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/_Sidebar.md b/_Sidebar.md index 2d280992..6662fbbb 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -1,7 +1,7 @@ * [[Home]] -* [User Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20User%20Manual.pdf) -* [Installation Manual](https://github.com/lequal/i-CodeCNES/blob/master/documentation/i-Code%20CNES%20-%20Installation%20Manual%20-%20EN.pdf) -* [[Developper guide]] +* [[User Manual]] +* [[Installation Manual]] +* [[Developer guide]] * [[Architecture]] * [[Checkers implementation]] * [[Plugin contribution]] \ No newline at end of file From f13ee679b4afc7b50783ee5380c9a06969b779c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sat, 25 Jan 2020 11:14:29 +0100 Subject: [PATCH 18/34] Updated Home (markdown) --- Home.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Home.md b/Home.md index d0b060c1..4b97d20a 100644 --- a/Home.md +++ b/Home.md @@ -5,7 +5,7 @@ i-Code CNES is a static analysis tool for Fortran and Shell, it's verifying code # Documentation * [[User Manual]] * [[Installation Manual]] -* [[Developper Guide]] +* [[Developer Guide]] # Quick install ## i-Code CNES Eclipse plugin @@ -29,7 +29,7 @@ alias icode=$(pwd)/i-CodeCNES-3.1.0-CLI-linux/icode ``` **On Windows (powershell)** -Extract the archive, then : +Extract the archive, then: ```ps Set-Alias icode c:\user\tools\icode.exe ``` @@ -38,9 +38,9 @@ Set-Alias icode c:\user\tools\icode.exe ## ⚠️ Filename extension Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an anlysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. -Extension supported by languages : -* Shell : sh, ksh, bash -* Fortran : f, f77, f90, F, F90, F77, fortran +Extension supported by languages: +* Shell: sh, ksh, bash +* Fortran: f, f77, f90, F, F90, F77, fortran > A Shell file for instance `no_extension` should be renamed `no_extension.sh` in order to be analyzed. @@ -54,7 +54,7 @@ You can set the severity configuration of the analysis using the scrollbar from Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. ## i-Code CNES CLI -In your project folder, use the following command to analyze all files : +In your project folder, use the following command to analyze all files: ```sh # Analyse whole project icode '**/*' From 0fa84b65dda8068a1adba7b5aaac41d2f43494fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sat, 25 Jan 2020 13:15:40 +0100 Subject: [PATCH 19/34] First plan with Introduction and Limitations --- User-Manual.md | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) create mode 100644 User-Manual.md diff --git a/User-Manual.md b/User-Manual.md new file mode 100644 index 00000000..3d6335da --- /dev/null +++ b/User-Manual.md @@ -0,0 +1,58 @@ +## Table of contents ++ [1. Introduction](#1-introduction) ++ [2. i-Code CNES products](#2-i-code-cnes-products) + + [2.1. i-Code App or i-Code CLI](#21-i-code-app-or-i-code-cli) + + [2.2. i-Code IDE](#22-i-code-ide) + + [2.3. i-Code plugin for Eclipse](#23-i-code-plugin-for-eclipse) + + [2.4. i-Code plugin for SonarQube](#24-i-code-plugin-for-sonarqube) + + [2.5. i-Code Core](#25-i-code-core) + + [2.6. i-Code Library](#26-i-code-library) ++ [3. Rules description](#3-rules-description) ++ [4. Metrics description](#4-metrics-description) ++ [5. Limitations](#5-limitations) ++ [6. References](#6-references) + +## 1. Introduction + +This document is the i-Code CNES user manual. It describes how to use i-Code CNES. + +Before using i-Code CNES, you should: ++ Know eclipse. Eclipse documentation is available here [ [R1] ]. ++ Read CNES coding rules [ [R2] ] [ [R3] ] [ [R4] ] [ [R5] ]. ++ Installation instructions are available in the installation manual [ [R6] ]. + +## 2. i-Code CNES products +### 2.1. i-Code App or i-Code CLI +### 2.2. i-Code IDE +### 2.3. i-Code plugin for Eclipse +### 2.4. i-Code plugin for SonarQube +### 2.5. i-Code Core +### 2.6. i-Code Library + +## 3. Rules description + +## 4. Metrics description + +## 5. Limitations + +| LIMITATION | ALTERNATIVE | LINKED ISSUE | +|----------------------------------------------|-------------|---------------------| +| Powershell does not allow to analysis launch | Use cmd.exe | [#73](../issues/73) | +| Shell: strings without quotes are not well supported | Use quotes for strings | [#31](../issues/31) | +| Files without identified extension are not analyzed | Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an analysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension.
Extension supported by languages:
- Shell: sh, ksh, bash
- Fortran: f, f77, f90, F, F90, F77, fortran
**A Shell file for instance `no_extension` should be renamed `no_extension.sh` in order to be analyzed.**| [#00](../issues/00) | +| | | | + +## 6. References +[R1]: #6-references +[R2]: #6-references +[R3]: #6-references +[R4]: #6-references +[R5]: #6-references +[R6]: #6-references + ++ [ [R1] ] [Eclipse Documentation](http://www.eclipse.org/documentation/) ++ [ [R2] ] RNC-CNES-Q-HB-80-505 - Coding rules Fortran 77 Version 7 ++ [ [R3] ] RNC-CNES-Q-HB-80-517 - Coding rules Fortran 90 Version 5 ++ [ [R4] ] RNC-CNES-Q-HB-80-501 - Common coding rules Version 5 ++ [ [R5] ] RNC-CNES-Q-HB-80-516 - Coding rules SHELL Version 6 ++ [ [R6] ] [i-Code Installation Manual](installation-manual) \ No newline at end of file From e9befcd63a80fda14efe7b5d392da8549924a967 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sat, 25 Jan 2020 13:27:49 +0100 Subject: [PATCH 20/34] Add plan and introduction --- Installation-Manual.md | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) create mode 100644 Installation-Manual.md diff --git a/Installation-Manual.md b/Installation-Manual.md new file mode 100644 index 00000000..a6d2b7a3 --- /dev/null +++ b/Installation-Manual.md @@ -0,0 +1,41 @@ +## Table of contents ++ [1. Introduction](#1-introduction) ++ [2. Installation guidelines](#2-installation-guidelines) + + [2.1. Download i-Code](#21-download-i-code) + + [2.2. Install i-Code CLI](#22-install-i-code-cli) + + [2.3. Install i-Code IDE](#23-intall-i-code-ide) + + [2.4. Install i-Code plugin for Eclipse](#24-install-i-code-plugin-for-eclipse) + + [2.5. Install i-Code plugin for SonarQube](#25-install-i-code-plugin-for-sonarqube) ++ [3. References](#3-references) + +## 1. Introduction + +This document explains how to install i-Code CNES. Documentation on how to use i-Code is in the user manual [ [R1] ]. + +This tool provides four products: ++ A standalone version with GUI named **i-Code CNES IDE** ++ A command line version named **i-Code CLI** or **i-Code App** ++ An Eclipse plugin ++ A SonarQube plugin [ [R3] ] + +Other products are available for developers: ++ **i-Code Core**: a library containing core features for developing new i-Code plugins, see [ [R4] ] for more information ++ **i-Code Library**: a library allowing to analyze code in your own application + +## 2. Installation guidelines +### 2.1. Download i-Code +### 2.2. Install i-Code CLI +### 2.3. Install i-Code IDE +### 2.4. Install i-Code plugin for Eclipse +### 2.5. Install i-Code plugin for SonarQube + +## 3. References +[R1]: #3-references +[R2]: #3-references +[R3]: #3-references +[R4]: #3-references + ++ [ [R1] ] [i-Code User Manual](http://www.eclipse.org/documentation/) ++ [ [R2] ] [Eclipse Documentation](http://www.eclipse.org/documentation/) ++ [ [R3] ] [SonarQube plugin for i-Code](https://github.com/lequal/sonar-icode-cnes-plugin) ++ [ [R4] ] [i-Code Developer Guide](https://github.com/lequal/icode-custom-plugin-example/wiki) \ No newline at end of file From 3a64ca7462674d917d614984ac99cbb999e3ca4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sat, 25 Jan 2020 13:51:19 +0100 Subject: [PATCH 21/34] Created _Footer (markdown) --- _Footer.md | 1 + 1 file changed, 1 insertion(+) create mode 100644 _Footer.md diff --git a/_Footer.md b/_Footer.md new file mode 100644 index 00000000..ba26416d --- /dev/null +++ b/_Footer.md @@ -0,0 +1 @@ +i-Code CNES is an open source project under license EPL-1.0 \ No newline at end of file From 9f953e98c85d2827281389cd5a56fcd4de6d757f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sun, 26 Jan 2020 14:56:56 +0100 Subject: [PATCH 22/34] Updated Home (markdown) --- Home.md | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/Home.md b/Home.md index 4b97d20a..d64c7a97 100644 --- a/Home.md +++ b/Home.md @@ -2,24 +2,24 @@ i-Code CNES is a static analysis tool for Fortran and Shell, it's verifying code compliancy with CNES standards (RNC). -# Documentation +## Documentation * [[User Manual]] * [[Installation Manual]] -* [[Developer Guide]] +* [Developer Guide](/lequal/icode-custom-plugin-example/wiki) (redirect to [lequal/icode-custom-plugin-example](/lequal/icode-custom-plugin-example) wiki) -# Quick install -## i-Code CNES Eclipse plugin +## Quick install +### i-Code CNES Eclipse plugin Download the eclipse plugin archive of the [last release](https://github.com/lequal/i-CodeCNES/releases). Then, launch Eclipse and select the **Help > Install new Software**. On the wizard, select **Add** and **Archive...** and select i-Code CNES archive. Restart Eclipse. -## i-Code CNES IDE +### i-Code CNES IDE Download and unzip the latest IDE version in a folder. -## i-Code CNES CLI +### i-Code CNES CLI Download the latest i-Code CNES CLI version [link](https://github.com/lequal/i-CodeCNES/releases). Then put the archive in your choosen location. **On linux** @@ -34,8 +34,8 @@ Extract the archive, then: Set-Alias icode c:\user\tools\icode.exe ``` -# Quick analysis -## ⚠️ Filename extension +## Quick analysis +### ⚠️ Filename extension Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an anlysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. Extension supported by languages: @@ -44,15 +44,15 @@ Extension supported by languages: > A Shell file for instance `no_extension` should be renamed `no_extension.sh` in order to be analyzed. -## i-Code CNES IDE and Eclipse plugin -### Preferences +### i-Code CNES IDE and Eclipse plugin +#### Preferences Select `Window > Preferences > i-Code CNES`. You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit Metrics threshold. -### Launching an analysis +#### Launching an analysis Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. -## i-Code CNES CLI +### i-Code CNES CLI In your project folder, use the following command to analyze all files: ```sh From 688abe083d1c51239dd9ed2624b231b956f27997 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sun, 26 Jan 2020 14:58:32 +0100 Subject: [PATCH 23/34] Updated _Sidebar (markdown) --- _Sidebar.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/_Sidebar.md b/_Sidebar.md index 6662fbbb..5eea4a39 100644 --- a/_Sidebar.md +++ b/_Sidebar.md @@ -1,7 +1,4 @@ * [[Home]] * [[User Manual]] * [[Installation Manual]] -* [[Developer guide]] - * [[Architecture]] - * [[Checkers implementation]] - * [[Plugin contribution]] \ No newline at end of file +* [Developer guide](/lequal/icode-custom-plugin-example) \ No newline at end of file From efc46c0db890d7bdf2ae838ca5a4ce3910a25fb0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sun, 26 Jan 2020 15:46:39 +0100 Subject: [PATCH 24/34] Updated Home (markdown) --- Home.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Home.md b/Home.md index d64c7a97..f00129d5 100644 --- a/Home.md +++ b/Home.md @@ -20,7 +20,7 @@ Restart Eclipse. Download and unzip the latest IDE version in a folder. ### i-Code CNES CLI -Download the latest i-Code CNES CLI version [link](https://github.com/lequal/i-CodeCNES/releases). Then put the archive in your choosen location. +Download the latest i-Code CNES CLI version [link](https://github.com/lequal/i-CodeCNES/releases). Then put the archive in your chosen location. **On linux** ```sh @@ -36,7 +36,7 @@ Set-Alias icode c:\user\tools\icode.exe ## Quick analysis ### ⚠️ Filename extension -Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an anlysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. +Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an analysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. Extension supported by languages: * Shell: sh, ksh, bash From c9b13c42b88526f49b34569278f0b4341f49ebf6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Sun, 26 Jan 2020 15:47:18 +0100 Subject: [PATCH 25/34] Updated Installation Manual (markdown) --- Installation-Manual.md | 52 +++++++++++++++++++++++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/Installation-Manual.md b/Installation-Manual.md index a6d2b7a3..b6fea6fb 100644 --- a/Installation-Manual.md +++ b/Installation-Manual.md @@ -24,18 +24,68 @@ Other products are available for developers: ## 2. Installation guidelines ### 2.1. Download i-Code + +i-Code CNES products are available on the GitHub Release page of [i-CodeCNES](/lequal/i-CodeCNES) repository: [[https://github.com/lequal/i-CodeCNES/releases]]. + +For each release, the following products are available: ++ i-Code plugin for Eclipse + + `fr.cnes.icode.repository-X.Y.Z-SNAPSHOT.zip` ++ i-Code CLI + + `icode-X.Y.Z.zip` ++ i-Code IDE + + `icode-ide.product-linux.gtk.x86.zip` + + `icode-ide.product-linux.gtk.x86_64.zip` + + `icode-ide.product-macosx.cocoa.x86_64.zip` + + `icode-ide.product-win32.win32.x86.zip` + + `icode-ide.product-win32.win32.x86_64.zip` + ### 2.2. Install i-Code CLI + +Download the latest i-Code CNES CLI version on [GitHub Releases page](https://github.com/lequal/i-CodeCNES/releases). Then put the archive in your chosen location. + +#### On linux +```sh +unzip icode-X.Y.Z.zip +alias icode=$(pwd)/icode/icode +``` + +#### On Windows (PowerShell) +Extract the archive, then: +```ps +Set-Alias icode c:\path\to\icode\icode.bat +``` + ### 2.3. Install i-Code IDE ### 2.4. Install i-Code plugin for Eclipse + +1. Download the eclipse plugin archive of the [last release](https://github.com/lequal/i-CodeCNES/releases). + +1. Then, launch Eclipse and select the **Help > Install new Software**. + +1. On the wizard, select **Add** and **Archive...** and select i-Code CNES archive. + +1. Restart Eclipse. + ### 2.5. Install i-Code plugin for SonarQube +All information about i-Code plugin for SonarQube is available on the official [project's repository](/lequal/sonar-icode-cnes-plugin). + +There are two ways for installing the i-Code plugin: + ++ Through the official SonarQube Marketplace ++ Manually by downloading the plugin on [its GitHub Release page](/lequal/sonar-icode-cnes-plugin/releases) and then following the installation guide in [ [R5] ] + +In any case, follow instructions of official SonarQube documentation for properly install this plugin [ [R5] ]. + ## 3. References [R1]: #3-references [R2]: #3-references [R3]: #3-references [R4]: #3-references +[R5]: #3-references + [ [R1] ] [i-Code User Manual](http://www.eclipse.org/documentation/) + [ [R2] ] [Eclipse Documentation](http://www.eclipse.org/documentation/) + [ [R3] ] [SonarQube plugin for i-Code](https://github.com/lequal/sonar-icode-cnes-plugin) -+ [ [R4] ] [i-Code Developer Guide](https://github.com/lequal/icode-custom-plugin-example/wiki) \ No newline at end of file ++ [ [R4] ] [i-Code Developer Guide](https://github.com/lequal/icode-custom-plugin-example/wiki) ++ [ [R5] ] [Install a SonarQube plugin](https://docs.sonarqube.org/latest/setup/install-plugin/) \ No newline at end of file From 59e8a6890ca9f12668bb6721f2080446b1ac81fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Mon, 3 Feb 2020 00:14:15 +0100 Subject: [PATCH 26/34] Updated User Manual (markdown) --- User-Manual.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/User-Manual.md b/User-Manual.md index 3d6335da..9ee8e70b 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -8,6 +8,11 @@ + [2.5. i-Code Core](#25-i-code-core) + [2.6. i-Code Library](#26-i-code-library) + [3. Rules description](#3-rules-description) + + [3.1. Common rules](#31-common-rules) + + [3.2. Specific rules](#32-specific-rules) + + [3.2.1. Shell rules](#321-shell-rules) + + [3.2.2. Fortran 77 rules](#322-fortran-77-rules) + + [3.2.3. Fortran 90 rules](#323-fortran-90-rules) + [4. Metrics description](#4-metrics-description) + [5. Limitations](#5-limitations) + [6. References](#6-references) @@ -31,8 +36,18 @@ Before using i-Code CNES, you should: ## 3. Rules description +### 3.1. Common rules + +### 3.2. Specific rules + +#### 3.2.1. Shell rules +#### 3.2.2. Fortran 77 rules +#### 3.2.3. Fortran 90 rules + ## 4. Metrics description + + ## 5. Limitations | LIMITATION | ALTERNATIVE | LINKED ISSUE | From 8e4dfd6e6a680a0baaa40ab924cb05f2e4e90f7d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 4 Feb 2020 00:10:15 +0100 Subject: [PATCH 27/34] Add messages and shell rules --- User-Manual.md | 201 ++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 191 insertions(+), 10 deletions(-) diff --git a/User-Manual.md b/User-Manual.md index 9ee8e70b..36d9fbbb 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -14,8 +14,13 @@ + [3.2.2. Fortran 77 rules](#322-fortran-77-rules) + [3.2.3. Fortran 90 rules](#323-fortran-90-rules) + [4. Metrics description](#4-metrics-description) -+ [5. Limitations](#5-limitations) -+ [6. References](#6-references) ++ [5. Messages] + + [5.1. Common messages](#51-common-messages) + + [5.2. Shell messages](#52-shell-messages) + + [5.3. Fortran 77 messages](#53-fortran-77-messages) + + [5.4. Fortran 90 messages](#54-fortran-90-messages) ++ [6. Limitations](#6-limitations) ++ [7. References](#7-references) ## 1. Introduction @@ -41,14 +46,190 @@ Before using i-Code CNES, you should: ### 3.2. Specific rules #### 3.2.1. Shell rules + +| Rule | Description | Coverage | +|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------| +| SH.DATA.Constant | Constants should be defined using ‘typeset –r’. | :x: | +| SH.DATA.IFS | It is forbidden to modify IFS variable | :heavy_check_mark: | +| SH.DATA.Integer | Integer declaration should be done with ‘typeset –i’ | :heavy_check_mark: | +| SH.DESIGN.Bash | Script firs line should be # !/bin/bash, # !/bin/ksh or # !/bin/false. | :heavy_check_mark: | +| SH.DESIGN.Exit | It is forbidden for a program to end before the processes it launches. | :x: | +| SH.DESIGN.Options | Getopts should be followed by a case where options are evaluated. | :heavy_check_mark: | +| SH.ERR.Args | It is mandatory to display a message when a script does not recognize an option. This message should include the way to use the script (-help) | :x: | +| SH.ERR.Help | Options should be managed with getopts or getopt followed by a case. One of these cases should be –h or --helpLimitation: if "h)"" appears in a string in a case, whereas no -h option is handled, so there won't be any issue." | :heavy_check_mark: | +| SH.ERR.NoPipe | Use ‘set –o pipefail’ before using pipes.Limitations:- The use of `\|` into a string or command line options will raise an error except in a printf or sed- The use of `\|` followed by `#` are not detected | :heavy_check_mark: | +| SH.ERR.String | The use of « if » or « while » with strings, empty wtrings should be managed.Limitation : Call of ls inside a command $(…) or `…` could be ignored. | :heavy_check_mark: | +| SH.FLOW.CheckArguments | In a function, first instruction should be the parameters check. | :heavy_check_mark: | +| SH.FLOW.CheckCodeReturn | For each function and command call in the script, it’s mandatory to verify the code return of the execution using $# | :heavy_check_mark: | +| SH.FLOW.CheckUser | If root rights are needed, the administration intervention should be asked right after the user check | :heavy_check_mark: | +| SH.INST.Basename | Do not use $0, replace it by ‘basename $0‘ | :heavy_check_mark: | +| SH.INST.Continue | Shell : not available | :x: | +| SH.INST.Copy | ‘cp’ command should be used with arguments of the same type (file or directory) | :x: | +| SH.INST.Find | LS instruction is forbidden | :heavy_check_mark: | +| SH.INST.GetOpts | GETOPS should be used to check parametersLimitation: After calling getopt, issues on $1 are ignored until the declaration of a new function. | :white_check_mark: `partial` | +| SH.INST.Interpreter | First line should be the access to interpretor. | :heavy_check_mark: | +| SH.INST.Keywords | Keyword should not be used as variable name.Limitation: Use of command having keywords as option raise false positives (e.g.: option if of command dd). | :heavy_check_mark: | +| SH.INST.Logical | After `&&` or `\|\|`, only echo and axit are allowed. | :heavy_check_mark: | +| SH.INST.Move | It is forbidden to erase a file using « mv » command. | :x: | +| SH.INST.POSIX | POSIX commands should be used.Limitation: call of echo with redirections could raise errors. | :heavy_check_mark: | +| SH.INST.SetShift | Instructions SET and SHIFT are forbidden. | :heavy_check_mark: | +| SH.INST.Variables | Every variable should be written as : ${variable_name} | :heavy_check_mark: | +| SH.IO.Redirect | not implementedstandard redirections should be commented, the comment should contains the redirection name. | :heavy_check_mark: | +| SH.MET.LimitAWK | AWK instruction should not exceed 5 actions. | :heavy_check_mark: | +| SH.MET.LimitSed | SED instruction should not exceed 5 actions. | :heavy_check_mark: | +| SH.MET.PipeLine | Every command pipeline should be commented. | :heavy_check_mark: | +| SH.REF.Export | It’s forbidden to export function self defined by the script. | :heavy_check_mark: | +| SH.REF.Inheritance | Scripts should not inherit alias or user defined functions. | :x: | +| SH.SYNC.Signals | It’s mandatory to define intercepted signals using trap by their name. It’s forbidden to define it by its numeric value. | :heavy_check_mark: | + #### 3.2.2. Fortran 77 rules #### 3.2.3. Fortran 90 rules ## 4. Metrics description +## 5. Messages +### 5.1. Common messages + +|Rule |Message | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|COM.DATA.DeclarationOrder |The parameters are not defined in the right order. The order shall be: in, in/out, out. | +|COM.DATA.FloatCompare |It’s not allowed to compare float variables( "variable") with equality. | +|COM.DATA.Initialisation |The variable "variable" is used before being initialized. | +|COM.DATA.Invariant |The variable "variable" must be defined as constant. | +|COM.DATA.LoopCondition |The variable "variable" is modified inside the loop. | +|COM.DATA.NotUsed |The variable "variable" is declared and not used | +|COM.DESIGN.ActiveWait |This process contains an active wait. Shell: There is an active wait in this point. | +|COM.DESIGN.Alloc |The resource named "variable" has not been allocated and deallocated in the same algorithmic level. | +|COM.FLOW.Abort |The keyword STOP is not allowed. | +|COM.FLOW.BooleanExpression|Shell: It is not allowed use five or more conditional expressions in the same instruction.Using more than five conditions in an expression is not allowed. | +|COM.FLOW.CaseSwitch |A DEFAULT case is needed in a switch case instruction. Shell: The default case of the case switch condition is missing. | +|COM.FLOW.CheckCodeReturn |The return code of the function “function” is not checked. | +|COM.FLOW.CheckUser |The user identity is not verified in the main program. | +|COM.FLOW.Exit |There is more than one exit in the function. | +|COM.FLOW.ExitLoop |There is more than one exit in the loop. | +|COM.FLOW.FileExistence |The existences of the file “file” must be checked with the instruction INQUIRE before being opened or created. Shell: The existence of the file " + name + " has not been checked. | +|COM.FLOW.FilePath |It is not allowed to use directly the file name. Store the file path in a variable. Use the variable instead. | +|COM.FLOW.Recursion |The use of recursivity is not allowed. | +|COM.INST.BoolNegation |Double negation is not allowed. | +|COM.INST.Brace |Parentheses are needed for readability. | +|COM.INST.CodeComment |Commented code is not allowed. It shall be suppressed. Shell: The keyword " + yytext() + " is used in a comment. A variable is assigned in a comment. | +|COM.INST.GOTO |The keyword GOTO is not allowed. | +|COM.INST.Line |More than one instruction per line is not allowed. | +|COM.INST.LoopCondition | A loop condition shall be written with inequality (.LE.,<=, or .GT.,>=) | +|COM.NAME.Homonymy |Names must be unique. The name "variable" is already defined in this file. | +|COM.PRES.Indent | The code is not indented. | +|COM.PRESLengthLine |There are more than 100 characters in this line. | +|COM.PROJECT.Header |- No file header existing. This module/function should have a header with a brief description. - No file header (file name not found). This module/function should have a header with a brief description. - The module/function should have a header with a brief description. SH : The function should have a header with a brief description.| +|COM.TYPE.Expression |Mixed types “type_variable_1” with “type_variable_2” in the same expression | + +### 5.2. Shell messages + +|Rule |Message | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|SH.DATA.IFS |The environment variable IFS can't be modified. | +|SH.DATA.Integer |The integer variables must be defined using the typeset -i declaration. | +|SH.DESIGN.Bash |The first line must declare the interpreter (/bin/bash, /bin/ksh or /bin/false) | +|SH.DESIGN.Options |It is mandatory to use getopts and getopt and to provide the –h, -help, –v and -version options at least. | +|SH.ERR.Help |The help option (-h or --help) must be implemented. | +|SH.ERR.NoPipe |When the pipe is used in the script the option set -o pipefail is mandatory. | +|SH.ERR.String |The empty strings must be taken into account | +|SH.FLOW.CheckArguments |The number of parameters received has not been checked. | +|SH.FLOW.CheckCodeReturn |The function's return function_name has not been checked. | +|SH.FLOW.CheckUser |The user has not been checked. | +|SH.INST.Basename |The use of the keyword basename before $0 is mandatory. | +|SH.INST.Continue |The keyword CONTINUE is not allowed. | +|SH.INST.Find |The use of LS is not allowed. Use FIND instead. | +|SH.INST.GetOpts |It is mandatory to use getopts & getopt in the script. | +|SH.INST.Interpreter |The first line must declare the interpreter | +|SH.INST.Keywords |The keywords variable cannot be used as a variable. | +|SH.INST.Logical |The abbreviation \|\| and && must be followed only by ECHO or EXIT. | +|SH.INST.POSIX |The keyword POSIX_word is not allowed. | +|SH.INST.SetShift |The keyword SET/SHIFT is not allowed. | +|SH.INST.Variables |The variable variable_name is not correctly declared (must be declared using ${ } or " " notation ) | +|SH.IO.Redirect |Thenon-standard redirection must be preceded by a comment. | +|SH.MET.LimitAWK |The AWK expression has more than 5 actions | +|SH.MET.LimitSed |The SED expression has more than 5 actions/lines | +|SH.MET.PipeLine |Every pipeline must be preceded by a comment. | +|SH.REF.Export |The keyword EXPORT is no allowed. | +|SH.SYNC.Signals |The keyword TRAP must be followed by a variable, not an integer. | + +### 5.3. Fortran 77 messages + +|Rule |Message | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|F77.BLOC.Common |Unnamed COMMON is not allowed. | +|F77.BLOC.Else |The IF instruction shall finish with an ELSE after the last ELSE IF. | +|F77.BLOC.Function |When calling a function, the brackets following the function name are mandatory. | +|F77.BLOC.Loop |Loops shall have distinct ends. | +|F77.DATA.Array |The dimension of the array “variable” is not well declared. The * shall be used for the last dimension. | +|F77.DATA.Common |The INCLUDE instruction shall be used to reference the needed common bloc. | +|F77.DATA.Double |The double precision variable is not correctly initialized. It misses the character D in its declaration. | +|F77.DATA.Initialization |The variable “variable” shall be initialized with DATA or BLOCK DATA before its use. | +|F77.DATA.IO |The use of * with logical units is not allowed. | +|F77.DATA.LoopDo |The control variable in a loop shall be an integer. | +|F77.DATA.Parameter |”variable” belongs to parameter types forbidden when calling a function: a constant, an expression to be evaluated, a call to another function | +|F77.ERR.OpenRead |The status of OPEN/READ shall be tested with the parameter IOSTAT. | +|F77.INST.Assign |The instruction ASSIGN Is not allowed. | +|F77.INST.Dimension |The instruction DIMENSION Is not allowed. | +|F77.INST.Equivalence |The instruction EQUIVALENCE is not allowed. | +|F77.INST.Function |It misses the type declaration in FUNCTION header. | +|F77.INST.If |The arithmetic if is not allowed. | +|F77.INST.Include |The executable instruction “variable” is not allowed in the include file. | +|F77.INST.Pause |The instruction PAUSE is not allowed. | +|F77.INST.Return |The instruction RETURN(i) is not allowed. | +|F77.INST.Save |The instruction SAVE is only permitted for local variables | +|F77.MET.Line |There are more than 72 characters in this line. | +|F77.NAME.GenericIntrinsic |It should be used the generic name of the intrinsic function instead of “variable” | +|F77.NAME.Intrinsic |It is not allowed to use the name of an intrinsic function. | +|F77.NAME.KeyWords |The variable “variable” is a keyword in Fortran77 language. | +|F77.NAME.Label |The use of labels is not allowed except with the instructions FORMAT and CONTINUE. | +|F77.PROTO.Declaration |The function “variable” shall be declared. | +|F77.REF.IO |The logical entities shall be declared using a symbolic name. | +|F77.REF.Open |The instruction OPEN shall be called with the parameters FILE, STATUS and POSITION. | +|F77.REF.Parameter |It is not allowed to provide as a parameter the variables of an accessible bloc COMMON. The variable “variable” is used in a wrong way. | +|F77.TYPE.Basic |”variable” is not a basic type. Basic types are INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL and CHARACTER. | +|F77.TYPE.Hollerith |Type Hollerith is not allowed. “variable” shall be a CHARACTER. | + +### 5.4. Fortran 90 messages +|Rule |Message | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| +|F90.BLOC.File |The file “variable” is not correctly closed. | +|F90.DATA.Array |The dimension’s array must be declared as parameters’ function. | +|F90.DATA.ArrayAccess |Array “ variable1” initialized using other array named “variable2 “ with repeated values. | +|F90.DATA.Constant |The constants shall be declared and initialized in a module. | +|F90.DATA.ConstantFloat |Float constant “variable” shall be declared using the subtype_parameter: _ | +|F90.DATA.Declaration |The variable must be declared. The sequence IMPLICITE NONE must be declared after the method. | +|F90.DATA.Float |It is not allowed to use the format * for reals like “variable”. | +|F90.DATA.Parameter |It misses the use of intrinsic function SELECTED_REAL_KIND or SELECTED_INT_KIND for the subtype specification. | +|F90.DESIGN.Include |Is it possible to use a module instead of this inclusion? | +|F90.DESIGN.Interface |Interface Module shall only contain: INTERFACE, USE, IMPLICIT instructions as well as PRIVATE or PUBLIC declaration. | +|F90.DESIGN.IO |The value of the logic unity should be a integer or a variable initialised directly. | +|F90.DESIGN.Obsolete |The instruction calculed GOTO is not allowed. The instruction PAUSE is not allowed. The alternate return statement is not allowed. There is a branch on an END IF statement. It is not allowed. The use of CHARACTER* is not allowed. The instruction HOLLERITH is not allowed inside FORMAT. Error in "variable" used. The instruction ASSIGN contains the label for the FORMAT instruction. Arithmetical IF is not allowed. A DO loop shall end with END DO. The variable "variable" is a real used in a do loop. Use only INTEGER. Each loop shall have its own END DO. Shared END DO is forbidden.| +|F90.ERR.Allocate |The status of the ALLOCATE or DEALLOCATE instruction is not checked | +|F90.ERR.OpenRead |- There is no parameter IOSTAT in the OPEN/READ instruction. - The return of IOSTAT is no checked in the OPEN/READ instruction. | +|F90.INST.Associated |The pointer « variable » is not set to null before the use of the instruction ASSOCIATED. | +|F90.INST.Entry |The instruction ENTRY is not allowed. | +|F90.INST.Equivalence |The instruction EQUIVALENCE is not allowed. | +|F90.INST.If |Logical IF (without THEN and ENDIF) is only allowed with EXIT, CYCLE, GOTO, RETURN statements. | +|F90.INST.Intent |It misses the attribute INTENT for the parameter “variable” | +|F90.INST.Nullify |It misses the instruction NULLIFY after the DEALLOCATION of “variable”. | +|F90.INST.Only |The instruction ONLY must be preceded by a comment. | +|F90.INST.Operator |The symbolic notation (==, /=, <=, <, >=, >) must be used instead of (.EQ., .NE., .LT., .LE., .GT., .GE.). Error in “variable”. | +|F90.INST.Pointer |This use of POINTER is not allowed. | +|F90.NAME.GenericIntrinsic |Use the generic name of the intrinsic functions instead of “variable”. | +|F90.NAME.KeyWords |The variable “variable” is a keyword in Fortran90 language. | +|F90.PROTO.Overload |Overloading operator is not allowed. Overload of “variable” | +|F90.REF.ARRAY |It should be used the notation(:) to specify the entire use of the arrays: “list_variables”. | +|F90.REF.Interface |The function "function" is not visible in this point. | +|F90.REF.Label |It misses the name of the subprogram. It must finish with END TYPE_PROGRAM NAME. | +|F90.REF.Open |It misses one or more parameters In OPEN instruction. Mandatory parameters are FILE, STATUS, IOSTAT, POSITION. | +|F90.REF.Variable |The variable “variable” is used with different names inside the subprogram. | +|F90.TYPE.Derivate |The variable " must be defined inside the module structure. | +|F90.TYPE.Integer |It misses the declaration SELECTED_INT_KIND in the initialisation of “variables” | +|F90.TYPE.Real |It misses the declaration SELECTED_REAL_KIND in the initialisation of “variables” | -## 5. Limitations +## 6. Limitations | LIMITATION | ALTERNATIVE | LINKED ISSUE | |----------------------------------------------|-------------|---------------------| @@ -57,13 +238,13 @@ Before using i-Code CNES, you should: | Files without identified extension are not analyzed | Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an analysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension.
Extension supported by languages:
- Shell: sh, ksh, bash
- Fortran: f, f77, f90, F, F90, F77, fortran
**A Shell file for instance `no_extension` should be renamed `no_extension.sh` in order to be analyzed.**| [#00](../issues/00) | | | | | -## 6. References -[R1]: #6-references -[R2]: #6-references -[R3]: #6-references -[R4]: #6-references -[R5]: #6-references -[R6]: #6-references +## 7. References +[R1]: #7-references +[R2]: #7-references +[R3]: #7-references +[R4]: #7-references +[R5]: #7-references +[R6]: #7-references + [ [R1] ] [Eclipse Documentation](http://www.eclipse.org/documentation/) + [ [R2] ] RNC-CNES-Q-HB-80-505 - Coding rules Fortran 77 Version 7 From ad1b02dec769258f439860c7a6e8b1e6c3c5d162 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 4 Feb 2020 00:46:43 +0100 Subject: [PATCH 28/34] add fortran rules --- User-Manual.md | 77 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 76 insertions(+), 1 deletion(-) diff --git a/User-Manual.md b/User-Manual.md index 36d9fbbb..aadc7d81 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -14,7 +14,7 @@ + [3.2.2. Fortran 77 rules](#322-fortran-77-rules) + [3.2.3. Fortran 90 rules](#323-fortran-90-rules) + [4. Metrics description](#4-metrics-description) -+ [5. Messages] ++ [5. Messages](#5-messages) + [5.1. Common messages](#51-common-messages) + [5.2. Shell messages](#52-shell-messages) + [5.3. Fortran 77 messages](#53-fortran-77-messages) @@ -83,8 +83,83 @@ Before using i-Code CNES, you should: | SH.SYNC.Signals | It’s mandatory to define intercepted signals using trap by their name. It’s forbidden to define it by its numeric value. | :heavy_check_mark: | #### 3.2.2. Fortran 77 rules + +|Rule |Description |Coverage | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------| +|F77.BLOC.Common |White COMMON are forbidden. |:heavy_check_mark:| +|F77.BLOC.Else |In an instruction IF, the last ELSE IF should be follow by ELSE. |:heavy_check_mark:| +|F77.BLOC.File |File access whould be done using OPEN and CLOSE instructions. |:x: | +|F77.BLOC.Function |Parameter’s braces sohuld be used when defining a FUNCTION whenever there is no parameter. |:heavy_check_mark:| +|F77.BLOC.Loop |Nested DO loop should have different end instructions (one for each). |:heavy_check_mark:| +|F77.DATA.Array |Arrays dimension should be declared explicitly. The use of * is tolerated for the last one if justified with a comment. A(*), A(4, *), A(4, *, *), A(4, 4, *), but A(*, 4) |:heavy_check_mark:| +|F77.DATA.Common |INCLUDE must be used to declare COMMON in program units referencing it. |:heavy_check_mark:| +|F77.DATA.Double |In a constante initialisation or in an expression evaluation, the use of (D) (as double precision is mandatory. |:heavy_check_mark:| +|F77.DATA.Initialisation |Variable initialisation should be done using DATA or BLOCKDATA |:heavy_check_mark:| +|F77.DATA.IO |Implicit logical units defined by * are forbidden. READ (*,f) [iolist], READ f [,iolist], WRITE (*,f) [iolist], PRINT f [,iolist] |:heavy_check_mark:| +|F77.DATA.LoopDo |DO loop condition parameter should use INTEGER. |:heavy_check_mark:| +|F77.DATA.Parameter |The use of constants, computed values or function calls as function parameters is forbidden. CALL function (3, x*y, f(z), var) |:heavy_check_mark:| +|F77.ERR.OpenRead |The check of eturn status for instructions OPEN and READ is mandatory. It is recommended to use “IOSTAT = “ to do it. |:heavy_check_mark:| +|F77.INST.Assign |ASSIGN instruction is forbidden. |:heavy_check_mark:| +|F77.INST.Dimension |DIMENSION instruction is forbidden. |:heavy_check_mark:| +|F77.INST.Equivalence |EQUIVALENCE instruction is forbidden. |:heavy_check_mark:| +|F77.INST.Function |FUNCTION instruction should be used with an explicite type declaration, at function definition. |:heavy_check_mark:| +|F77.INST.If |Arithmetic IF is forbidden. IF (Arithmetic expression) e1,e2,e3 Where "eN" are tags |:heavy_check_mark:| +|F77.INST.Include |If instruction INCLUDE is used, the included file should not contain executable instructions. (ASSIGN, GOTO, IF, ELSE, CONTINUE, STOP, PAUSE ; DO, READ, WRITE, PRINT, REWIND ; BACKSPACE, ENDFILE, OPEN, CLOSE, INQUIER, CALL, RETURN, END) |:heavy_check_mark:| +|F77.INST.Pause |PAUSE instruction is forbidden. |:heavy_check_mark:| +|F77.INST.Return |RETURN(i) instruction is forbidden in subprogram. |:heavy_check_mark:| +|F77.INST.Save |SAVE instruction is forbidden except for local variables with justification in a comment. |:heavy_check_mark:| +|F77.MET.Line |Interdiction de dépasser 72 caractères par ligne. |:heavy_check_mark:| +|F77.NAME.GenericIntrinsic |The use of generic names for intrinseque functions is mandatory. |:heavy_check_mark:| +|F77.NAME.Intrinsic |Intrinseque function names reuse is forbidden. |:heavy_check_mark:| +|F77.NAME.KeyWords |Fortran 77 keywords should not be reused for variable names. |:heavy_check_mark:| +|F77.NAME.Label |Tags are limited to FORMAT and CONTINUE. |:heavy_check_mark:| +|F77.PROTO.Declaration |External functions should be declared with EXTERNAL keyword. |:heavy_check_mark:| +|F77.REF.IO |Logical unit should be identified with symbolic name. |:heavy_check_mark:| +|F77.REF.Open |OPEN parameters FILE, STATUS and POSITION should be defined. |:heavy_check_mark:| +|F77.REF.Parameter |It is forbidden to set as subroutine parameter variables which are already in a COMMON bloc accessible from the subroutine and the program which calls it. COMMON /CONTROL/ A, B, C, D … PROGRAM ESSAI CALL MY_SUB1 (A, B, C, D) … END PROGRAM ESSAI …. SUBROUTINE MY_SUB1 (C _A, B, _C, C_D) |:heavy_check_mark:| +|F77.TYPE.Basic |Only standard types (INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL, CHARACTER) are allowed. |:heavy_check_mark:| +|F77.TYPE.Hollerith |Data and constant of type Hollerith are forbidden. |:heavy_check_mark:| + #### 3.2.3. Fortran 90 rules +|Rule |Description |Coverage | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------| +|F90.DESIGN.Free |Allocated memory should be free in the same conceptual level. |:x: | +|F90.DESIGN.Include |File inclusion is forbidden. INCLUDE ‘file_to_include.F90’ |:heavy_check_mark:| +|F90.DESIGN.Interface |Modules should only contains USE, PRIVATE and PUBLIC clauses. MODULE interface_syslog Implicit none PRIVATE Interface Subroutine f_syslog(cdata) USE message_syslog Type(opendata_type) End subroutine End interface PUBLIC f_syslog End module interface_syslog |:heavy_check_mark:| +|F90.DESIGN.IO |In an OPEN function, units number should depend on another function or array. |:white_check_mark: `partial`| +|F90.DESIGN.Obsolete |This rule checks the following points: - Do not use computed GO TO - Do not use syntaxe: CHARACTER*N - Do not use arithmetic IF - In a DO loop, do not use REAL variables, neither as indice, nor as interval limits, nor as increment step - Do not exit a DO loop with other than END DO or CONTINUE - Do not branch on ENDIF - Do not use PAUSE - Do not use assigned GOTO - Do not use FORMAT label - Do not use descriptor H (Hollerith) in formats|:heavy_check_mark:| +|F90.BLOC.File |Every open file should be closed. OPEN ( unit = f_unit, …) … CLOSE ( unit = f_unit, …) |:heavy_check_mark:| +|F90.DATA.Array |Array dimensions should be respected. Example: Subroutine s1(tab) -> Subroutine s1(tab, x) Integer :: tab(2) Integer :: tab(x) |:heavy_check_mark:| +|F90.DATA.ArrayAccess |In an array of indirections, it is not possible to define the same item several times. Integer,dimension(3) :: a Integer.dimension(3) :: b a = ( / 1,1,3 / ) b(a) = ( / 1,2,3 / ) |:heavy_check_mark:| +|F90.DATA.Constant |Constants which appear in several subprograms should be defined into a module. Subroutine s1() Real PI = 3,141519 End subroutine s1 module precision -> real PI = 3.141519 Function f1() end module precision Real PI = 3,141519 End function|:heavy_check_mark:| +|F90.DATA.ConstantFloat |Numerical constants (see above) should be followed by subtype parameter. Integer,parameter :: DOUBLE=selected_real_kind(15) Real (DOUBLE) :: x = 0.1_DOUBLE |:heavy_check_mark:| +|F90.DATA.Declaration |The use of IMPLICITE NONE instruction is mandatory for each method header. Limitations : this rule is not checked for function and array |:heavy_check_mark:| +|F90.DATA.Float |It is forbidden to use * output format (WRITE instruction) for REAL |:heavy_check_mark:| +|F90.DATA.Parameter |Functions SELECTED_REAL_KIND and SELECTED_INT_KIND should be grouped in the same module. MODULE precision Integer, parameter :: DOUBLE = SELECTED_REAL_KIND(15) END MODULE |:heavy_check_mark:| +|F90.ERR.Allocate |Allocation and deallocation should contain “STAT” parameter. Then, « STAT » value should be tested. ALLOCATE(x, STAT = iom) IF (iom > 0) THEN … |:heavy_check_mark:| +|F90.ERR.OpenRead |OPEN and READ instructions, which work on files, should contain IOSTAT parameter and check this variable value. To check this, OPEN instruction should contain FILE attribute. |:heavy_check_mark:| +|F90.INST.Associated |Between declaration and ASSOCIATED instruction, it is mandatory to call NULLIFY. |:heavy_check_mark:| +|F90.INST.Entry |ENTRY instruction is forbidden. |:heavy_check_mark:| +|F90.INST.Equivalence |EQUIVALENCE instruction is forbidden. |:heavy_check_mark:| +|F90.INST.If |IF followed by one of these instructions : EXIT, GOTO, CYCLE, RETURN is forbidden. ``` IF (x == 0) THEN GO TO 1000 End IF ``` |:heavy_check_mark:| +|F90.INST.Intent |Each subprogram parameter should be declared with INTENT keyword ``` Function f1(x, y, z) Integer, INTENT(IN) :: x Integer, INTENT(IN) :: y Integer, INTENT(OUT) :: z ``` |:heavy_check_mark:| +|F90.INST.Nullify |After deallocate, the use of NULLIFY into the same logical uniti s mandatory ``` DEALLOCATE (C, stat = iom ) NULLIFY ( C ) ``` |:x: | +|F90.INST.Only |The use of keyword ONLY without comment is forbidden |:heavy_check_mark:| +|F90.INST.Operator |Do not use old notation. Replace .EQ., .NE., .LT., .LE., .GT., .GE. by ==, /=, <, <=, >, >= |:heavy_check_mark:| +|F90.INST.Pointer |POINTER is forbidden except in those cases: - Complex data structure creation - Manage array references - Dynamic allocation into composants with derivated types |:heavy_check_mark:| +|F90.NAME.GenericIntrinsic |Do not use specific functions (INT, IFIX, IDINT, REAL, FLOAT, SNGL, ICHAR, CHAR, AINT, DINT, ANINT, DNINT, NINT, IDNINT, IABS, ABS, DABS, CABS, MOD, AMOD, DMOD, ISIGN, SIGN, DSIGN, IDIM, DIM, DDIM, DPROD, MAX0, AMAX1, DMAX1, AMAX0, MAX1, MIN0, AMIN1, DMIN1, AMIN0, MIN1, AIMAG, CONJG, SQRT, DSQRT, CSQRT, EXP, DEXP, CEXP, ALOG, DLOG, CLOG, ALOG10, DLOG10, SIN, DSIN, CSIN, COS, DCOS, CCOS, TAN, DTAN, ASIN, DASIN, ACOS, DACOS, ATAN, DATAN, ATAN2, DATAN2, SINH, DSINH, COSH, DCOSH, TANH, DTANH), use generic ones (INT, REAL, AINT, ANINT, NINT, ABS, MOD, SIGN, DIM, MAX, MIN, SQRT, EXP, LOG, LOG10, SIN, COS, TAN, ASIN, ACOS, ATAN, ATAN2, SINH, COSH, TANH).|:heavy_check_mark:| +|F90.NAME.KeyWords |Fortran keywords should not be used as variable names. |:heavy_check_mark:| +|F90.PROTO.Overload |Overraded operators are forbidden |:heavy_check_mark:| +|F90.REF.ARRAY |The use of a whole array should be represented using the notation (:) Y = A*X + B Y(:) = A(:)*X + B où Y et A sont des tableaux |:heavy_check_mark:| +|F90.REF.Interface |Called subprogram should be visible. subroutine Pas_1 subroutine Pas_1 call Mouv(3.0,resul) call Mouv(3.0,resul) end subroutine Pas_1 contains subroutine Mouv(oper0, resul) -> subroutine Mouv(oper0, resul) … … end subroutine Mouv end subroutine Mouv end subroutine Pas_1|:heavy_check_mark:| +|F90.REF.Label |END keyword should be followed by the type (function, subroutine…) and the name. function f function f … -> … end function end function f |:heavy_check_mark:| +|F90.REF.Open |Every OPEN instruction should have parameters FILE, STATUS, IOSTAT and POSITION OPEN (UNIT=f_unit, FILE=c_args, STATUS=’old’, POSITION=’rewind’, IOSTAT=ios) |:heavy_check_mark:| +|F90.REF.Variable |A variable should be referenced with the same name in subprogram. Call incr( i ) call incr( i ) … … subroutine incr( j ) -> subroutine incr( j ) i = i + 1 j = j + 1 end subroutine incr end subroutine incr |:heavy_check_mark:| +|F90.TYPE.Derivate |Every type declaration should be placed into a module |:heavy_check_mark:| +|F90.TYPE.Integer |INTEGER parameters should be followed by SELECTED_INT_KIND expression. |:heavy_check_mark:| +|F90.TYPE.Real |REAL parameters should be followed by SELECTED_REAL_KIND Real, parameter :: LONG real, parameter :: LONG = SELECTED_REAL_KIND(5) |:heavy_check_mark:| + ## 4. Metrics description ## 5. Messages From d07ebd9b595a4018a73c58e0017575e8b806da7f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 4 Feb 2020 01:34:52 +0100 Subject: [PATCH 29/34] Updated User Manual (markdown) --- User-Manual.md | 39 +++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/User-Manual.md b/User-Manual.md index aadc7d81..0936e938 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -43,6 +43,45 @@ Before using i-Code CNES, you should: ### 3.1. Common rules +|Rule |Description |Coverage | +|--------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------| +|COM.DATA.Array |Two dimensions arrays should be declared in this way : line x column |:x: | +|COM.DATA.DeclarationOrder |**Fortran 77:** not applicable
**Fortran 90:** Parameters should declared in the following order: input, input/output, output. Declaration is made using keyword “INTENT”, and then “IN”, “INOUT” and “OUT”. If “INTENT” keyword is not used, the check is impossible.
**Shell:** not applicable |:x:
:heavy_check_mark:
:x:| +|COM.DATA.FloatCompare |**Fortran:** Equality and non-equality (.EQ., ==, .NE., /=) are forbidden on reals (REAL, DOUBLE PRECISION, COMPLEX)
**Shell:** not applicable |:heavy_check_mark:
:x:| +|COM.DATA.Initialisation |Variables have to be initialized before being used. When a variable is used, the algorithm should checked if it is initialized and if not throw an error. |:heavy_check_mark:| +|COM.DATA.Invariant |Data declared into subroutine, function, … and which are never modified then should be declared as constant. |:heavy_check_mark:| +|COM.DATA.LoopCondition |It is forbidden to modify loop condition inside the loop. |:heavy_check_mark:| +|COM.DATA.NotUsed |**Fortran:** Every declared variable should be used.
**Shell:** Every declared variable should be used.
*Limitations:* a variable is considered as used if used with ${variable} |:heavy_check_mark:| +|COM.DATA.Using |It is forbidden to reuse local object in several different treatments. |:x: | +|COM.DESIGN.Alloc |**Fortran:** Allocation and deallocation of resources should be in the same level. For each “DEALLOCATE” keyword found, i-Code CNES checks that the keyword “ALLOCATE” is also found and checks that they are relative to the same resource.
**Shell:** not applicable |:white_check_mark: `partial`
:x:| +|COM.DESIGN.ActiveWait |Fortran: in a loop, SLEEP, WAIT and PAUSE instructions are forbidden. Shell: WHILE[1] and keyword READ are forbidden. |:heavy_check_mark:| +|COM.FLOW.Abort |**Fortran:** Keyword STOP is forbidden
**Shell:** Keyword KILL, PKILL and KILLALL are forbidden.
*Limitation:* i-Code CNES do not consider keyword “RETURN”, “BREAK” and “EXIT”. |:heavy_check_mark:| +|COM.FLOW.BooleanExpression|In a condition (IF,DO), maximum number of operands is 5 (AND, OR, NEQV, XOR, EQV, NOT, LT, <, LE, <=, GT, >, GE, >=, EQ, ==, NE, /=) |:heavy_check_mark:| +|COM.FLOW.CaseSwitch |**Fortran 77:** not applicable
**Fortran 90:** SWITCH instruction should define the DEFAULT case as last one.
**Shell:** CASE instruction should finish with *) |:x:
:heavy_check_mark:
:heavy_check_mark:| +|COM.FLOW.CheckArguments |**Fortran:** Every parameter should be checked.
**Shell:** see SH.FLOW.CheckArguments |:x: | +|COM.FLOW.CheckCodeReturn |**Fortran:** Function return values should be checked.
**Shell:** see SH.FLOW.CheckCodeReturn |:heavy_check_mark:
:x:| +|COM.FLOW.CheckUser |**Fortran:** The identity of the user running the program should be checked.
**Shell:** see SH.FLOW.CheckUser |:heavy_check_mark:
:x:| +|COM.FLOW.Exit |**Fortran:** Function, procedure and method should have a unique exit point.
**Shell:** not available |:heavy_check_mark:
:x:| +|COM.FLOW.ExitLoop |Loops should have a unique exit point. |:heavy_check_mark:| +|COM.FLOW.FileExistence |**Fortran:** File opening (OPEN, READ, WRITE) should be done after using INQUIRE and EXIST instruction of this file.
**Shell:** A file access (> file_name) should be preceded by the check : if[ ! -f $file_name]
*Limitations:* - No detection in commands $(…) or `…` - A redirection or a redirected variable could be considered as a file |:heavy_check_mark:
:heavy_check_mark:| +|COM.FLOW.FilePath |In the OPEN instruction, it is forbidden to use directly the file name (file.txt). Path should be defined through a variable. |:heavy_check_mark:| +|COM.FLOW.Recursion |**Fortran77:** not applicable
**Fortran 90:** Recursivity is forbidden. In Fortran, i-Code CNES checks that « RECURSIVE FUNCTION(params) » is not found. |:x:
:heavy_check_mark:| +|COM.INST.BoolNegation |Double negation is forbidden on Boolean expressions. Negations are defined with the keyword « NOT ». Following expressions are not allowed: NOT. (.NOT. a) -> ( a ) .NOT. ( a .AND. .NOT. b) -> .NOT. a .OR. B |:heavy_check_mark:| +|COM.INST.Brace |**Fortran:** Every expression should be braced.
**Shell:** not available |:heavy_check_mark:
:x:| +|COM.INST.CodeComment |Fortran: Code comments are forbidden. I-Code CNES checks all keywords in comments, except in the header. Shell: Code comments are forbidden. I-Code CNES checks all keywords in comments (after #). Limitation: False positive will be raised due to common word used as keyword, for example “date”. |:heavy_check_mark:| +|COM.INST.GOTO |**Fortran:** “GO TO” is forbidden
**Shell:** not applicable |:heavy_check_mark:
:x:| +|COM.INST.Line |Fortran 77 : not applicable Fortan 90 and shell: Each line should be limited to only one expression. Shell Limitation: The use of keywords in command messages without using « » could produce false positive. |:x: :heavy_check_mark:| +|COM.INST.LoopCondition |**Fortran:** In a loop instruction, comparison using (.EQ., ==, .NE., \=) are forbidden.
**Shell:** not available |:heavy_check_mark:
:x:| +|COM.NAME.Homonymy |**Fortran:** Variable name should be unique. |:heavy_check_mark:| +|COM.PRES.Data |Important objects should be well commented. |:x: | +|COM.PRES.Indent |Source code should be indented with space. Example: DO i = 2, nb somme = somme + x(i) IF (isnan(somme)) THEN print *, 'somme is a NaN' moy = -1.0 END IF END DO |:heavy_check_mark:| +|COM.PRES.LengthLine |A line of source code should contain 100 characters maximum. |:heavy_check_mark:| +|COM.PROJECT.Analyser |All source code should be analyzed with checkers. |:x: | +|COM.PROJECT.CodeCloning |Duplicated code is forbidden. |:x: | +|COM.PROJECT.Header |**Shell:** named COM.PRES.Header Fortran: Headers are mandatory for each module and function |:heavy_check_mark:| +|COM.PROJECT.Warnings |Warning should be displayed and fixed. |:x: | +|COM.TYPE.Expression |**Fortran:** in a expression (defined by operator like +, -, /, *, **) all variables should have the same type : REAL, INTEGER, …
**Shell:** not available |:heavy_check_mark:
:x:| + ### 3.2. Specific rules #### 3.2.1. Shell rules From 96af0a073931f9d28340944828ae3fc789780378 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 11 Feb 2020 10:48:49 +0100 Subject: [PATCH 30/34] Updated User Manual (markdown) --- User-Manual.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/User-Manual.md b/User-Manual.md index 0936e938..8b0ceebb 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -201,6 +201,14 @@ Before using i-Code CNES, you should: ## 4. Metrics description +| Metric | File computation | +|-------------------------|-----------------------------------------------------------| +| MET.Nesting | Maximum number of nested levels if a function/method. This number is 0 if there is no imbrication. | +| MET.Cyclomatic | Number of decisions into the source code. | +| MET.LineOfCode | Number of lines into the source code (except white line and comment line). | +| MET.RatioComment | Ratio of comment in the source code. | +| MET.LineOfComment | Number of comment lines. | + ## 5. Messages ### 5.1. Common messages From d7dd7e6b28b8b5abc9875ce81e68e190bb62de30 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 11 Feb 2020 12:12:05 +0100 Subject: [PATCH 31/34] End of SUM --- User-Manual.md | 76 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 75 insertions(+), 1 deletion(-) diff --git a/User-Manual.md b/User-Manual.md index 8b0ceebb..a0d67ce8 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -29,16 +29,90 @@ This document is the i-Code CNES user manual. It describes how to use i-Code CNE Before using i-Code CNES, you should: + Know eclipse. Eclipse documentation is available here [ [R1] ]. + Read CNES coding rules [ [R2] ] [ [R3] ] [ [R4] ] [ [R5] ]. -+ Installation instructions are available in the installation manual [ [R6] ]. + +> Installation instructions are available in the installation manual [ [R6] ]. ## 2. i-Code CNES products + +The new architecture of i-Code is decomposed as described in the following schema. It is designed to be easily extendable. Users can build their own checkers and simply add their `jar` in the `icode/plugins` directory. See the [Developer Guide](https://github.com/lequal/icode-custom-plugin-example/wiki) for more details. + +![i-Code CNES 4 architecture](https://github.com/lequal/i-CodeCNES/blob/wiki/Architecture.svg) + ### 2.1. i-Code App or i-Code CLI +This is the common command line application for i-Code. In your project directory, use the following command to analyze all files: +```sh +# Analyze whole project +icode . + +# Analyze whole project and make an xml output of the analysis +icode . -f xml -o output.xml + +# List all functionality and description +icode --help +``` + +Use `icode --helph` to get the following help about *i-Code*: + +``` +usage: icode [ [...]] [-c ] [-e] [-f ] [-h] [-l] [-o ] [-p ] [-q ] [-r] [-v] [-x ] +Analyze Shell, F77 & F90 code to find defects & bugs. + + -c,--checked-languages Comma separated list of languages checked during analysis. All by default. + -e,--exporters Display all available exporters. + -f,--export-format Set the format for result file. Default format is XML. + -h,--help Display this message. + -l,--languages Display all available languages. + -o,--output Set the name for result file. Results are displayed in standard output by default. + -p,--export-parameters Comma separated list of parameters for the export. Format is: + key1=value1,key2=value2,key3=value3. Default values depend on the chosen export plugin. + -q,--list-export-parameters Display all available parameters for the given export. + -r,--rules Display all available rules. + -v,--version Display version information. + -x,--excluded-rules Comma separated list of rules id to exclude from analysis. None by default. +``` + ### 2.2. i-Code IDE + +This is the common GUI application for i-Code. + +#### Preferences +Select `Window > Preferences > i-Code CNES`. + +You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit metrics' threshold. + +#### Launching an analysis +Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. + ### 2.3. i-Code plugin for Eclipse + +The Eclipse plugin for i-Code allows to use i-Code from Eclipse IDE. + +#### Preferences +Select `Window > Preferences > i-Code CNES`. + +You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit Metrics threshold. + +#### Launching an analysis +Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. + ### 2.4. i-Code plugin for SonarQube + +The SonarQube plugin for i-Code allows to use i-Code through SonarQube analysis. + +> Please refer to [sonar-icode-cnes-plugin](https://github.com/lequal/sonar-icode-cnes-plugin) for more details. + ### 2.5. i-Code Core + +This is the core library containing all i-Code utilities for code analysis. + +> See the [Developer Guide](https://github.com/lequal/icode-custom-plugin-example/wiki) for more details. + ### 2.6. i-Code Library +This is the full library containing all official checkers. It includes i-Code Core and all official language analyzers. + +> See the [Developer Guide](https://github.com/lequal/icode-custom-plugin-example/wiki) for more details. + ## 3. Rules description ### 3.1. Common rules From f991bbe7ae33ad36de951fcb2a0b6220c910f8c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 11 Feb 2020 12:13:13 +0100 Subject: [PATCH 32/34] Fix typo --- User-Manual.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/User-Manual.md b/User-Manual.md index a0d67ce8..39eb94e6 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -51,7 +51,7 @@ icode . -f xml -o output.xml icode --help ``` -Use `icode --helph` to get the following help about *i-Code*: +Use `icode --help` to get the following help about *i-Code*: ``` usage: icode [ [...]] [-c ] [-e] [-f ] [-h] [-l] [-o ] [-p ] [-q ] [-r] [-v] [-x ] From 23f9d7bb9ea9db9771b2ae12b0f2c804fa9eee62 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Beno=C3=AEt=20Gar=C3=A7on?= Date: Tue, 11 Feb 2020 12:13:54 +0100 Subject: [PATCH 33/34] Updated Home (markdown) --- Home.md | 62 +-------------------------------------------------------- 1 file changed, 1 insertion(+), 61 deletions(-) diff --git a/Home.md b/Home.md index f00129d5..ef6a3535 100644 --- a/Home.md +++ b/Home.md @@ -5,64 +5,4 @@ i-Code CNES is a static analysis tool for Fortran and Shell, it's verifying code ## Documentation * [[User Manual]] * [[Installation Manual]] -* [Developer Guide](/lequal/icode-custom-plugin-example/wiki) (redirect to [lequal/icode-custom-plugin-example](/lequal/icode-custom-plugin-example) wiki) - -## Quick install -### i-Code CNES Eclipse plugin -Download the eclipse plugin archive of the [last release](https://github.com/lequal/i-CodeCNES/releases). - -Then, launch Eclipse and select the **Help > Install new Software**. On the wizard, select **Add** and **Archive...** and select i-Code CNES archive. - -Restart Eclipse. - -### i-Code CNES IDE - -Download and unzip the latest IDE version in a folder. - -### i-Code CNES CLI -Download the latest i-Code CNES CLI version [link](https://github.com/lequal/i-CodeCNES/releases). Then put the archive in your chosen location. - -**On linux** -```sh -unzip i-CodeCNES-3.1.0-CLI-linux.gtk.x86.zip -alias icode=$(pwd)/i-CodeCNES-3.1.0-CLI-linux/icode -``` - -**On Windows (powershell)** -Extract the archive, then: -```ps -Set-Alias icode c:\user\tools\icode.exe -``` - -## Quick analysis -### ⚠️ Filename extension -Analysis on project are based on file extension to attribute the good file to the good analyzer. Which mean, it's not required to filter file's extension when launching an analysis on a project, however it's important (especially in shell) that files that should be analyzed have an appropriate extension. - -Extension supported by languages: -* Shell: sh, ksh, bash -* Fortran: f, f77, f90, F, F90, F77, fortran - -> A Shell file for instance `no_extension` should be renamed `no_extension.sh` in order to be analyzed. - -### i-Code CNES IDE and Eclipse plugin -#### Preferences -Select `Window > Preferences > i-Code CNES`. - -You can set the severity configuration of the analysis using the scrollbar from RNC A to D, and choose rules to enable or disable in the different tables. You can also edit Metrics threshold. - -#### Launching an analysis -Select files to analysis, one or several, and then click on `i-Code CNES > Run analysis`. -### i-Code CNES CLI - -In your project folder, use the following command to analyze all files: -```sh -# Analyse whole project -icode '**/*' - -# Analyse whole project and make an xml output of the analysis -icode '**/*' -f xml -o output.xml - -# List all functionality and description -icode --help -``` - +* [Developer Guide](/lequal/icode-custom-plugin-example/wiki) (redirect to [lequal/icode-custom-plugin-example](/lequal/icode-custom-plugin-example) wiki) \ No newline at end of file From 02dc91e26ddde589a69d601bdc1b530c8fc1fb90 Mon Sep 17 00:00:00 2001 From: "F. S. Farimani" Date: Tue, 9 Apr 2024 10:56:59 +0200 Subject: [PATCH 34/34] added more information about the --checked-languages option --- User-Manual.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/User-Manual.md b/User-Manual.md index 39eb94e6..54b83710 100644 --- a/User-Manual.md +++ b/User-Manual.md @@ -71,6 +71,20 @@ Analyze Shell, F77 & F90 code to find defects & bugs. -x,--excluded-rules Comma separated list of rules id to exclude from analysis. None by default. ``` +`icode` can automatically detect the language from the file extensions: + +* Fortran 77: `for`, `f`, `fpp`, `ftn`, `FOR`, `F`, `FPP`, `FTN` +* Fortran 90: `f90`, `F90` +* Shell: `bash`, `sh`, `ksh` + +but you may also specify the language you want to check against: + +``` +icode -c "Fortran 77" +``` + +Please pay attention to the double quotation marks, the spacing and the first capital character. + ### 2.2. i-Code IDE This is the common GUI application for i-Code.