I Code CNES User Manual EN

User Manual:

Open the PDF directly: View PDF PDF.
Page Count: 59

DownloadI-Code CNES - User Manual EN
Open PDF In BrowserView PDF
i-Code CNES User Manual

Réf :

DNO/DA/AQ - 2017.0002478

Date :

24/05/2018

Page : 1/59

User Manual
i-Code CNES
DNO/DA /AQ - 2017.0002478
Version 3.0.1

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

Date : 24/05/2018

i-Code CNES User Manual

Page : 2/59

References
References
R1

Title
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

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 3/59

Table of contents

1. INTRODUCTION ............................................................................................................. 4
2. I-CODE CNES IDE INTEGRATED INTO ECLIPSE ......................................................... 4
I-CODE CNES CONFIGURATION................................................................................... 4
2.1.1. CONFIGURATION CHOICE ............................................................................................5
2.1.2. RULES FILTER ................................................................................................................6
2.1.3. RULES SELECTION ........................................................................................................6
2.1.4. RULE’S SEVERITY CONFIGURATION ..........................................................................7
2.1.5. METRICS’ THRESHOLD CONFIGURATION .................................................................7
2.1.6. RESTORE TO DEFAULT ................................................................................................8
CHECK RULES AND COMPUTE METRICS ................................................................... 9
2.2.1. ANALYSE LAUNCH ........................................................................................................9
2.2.2. RESULTS DISPLAY ......................................................................................................10
2.2.3. I-CODE CNES DISPLAY IN THE EDITOR ....................................................................12
2.2.4. RESULTS EXPORT .......................................................................................................13

3. I-CODE CNES COMMAND LINE .................................................................................. 15
XML FORMAT ............................................................................................................... 15
HTML FORMAT ............................................................................................................. 15
HELP DISPLAY ............................................................................................................. 15
4. RULES DESCRIPTION ................................................................................................. 16
COMMON RULES ......................................................................................................... 16
SPECIFIC RULES ......................................................................................................... 26
4.2.1. FORTRAN 77 .................................................................................................................26
4.2.2. FORTRAN 90 .................................................................................................................31
4.2.3. SHELL ............................................................................................................................43

5. COMPUTED METRICS ................................................................................................. 48
6. USER MESSAGES ........................................................................................................ 51
RULE’S VIOLATION MESSAGES ................................................................................ 51
6.1.1. REGLES COMMUNES...................................................................................................51
6.1.2. FORTRAN 77 .................................................................................................................53
6.1.3. FORTRAN 90 .................................................................................................................55
6.1.4. SHELL ............................................................................................................................57

7. LIMITATIONS ................................................................................................................ 59
POWERSHELL DOES NOT ALLOW ANALYSE LAUNCH ........................................... 59
SHELL: STRINGS SHOULD BE LIMITED WITH « » .................................................... 59

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 4/59

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]

2. I-CODE CNES IDE INTEGRATED INTO ECLIPSE
I-CODE CNES CONFIGURATION
The whole i-Code CNES configuration is accessible from eclipse preference pages.
To open eclipse preference pages, click on Window > Preferences

In the eclipse preference window, select the « i-Code CNES » item on the left.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 5/59

To see all available coding rules, open up « Metrics » or “Rules” tabs.

2.1.1. CONFIGURATION CHOICE
i-Code CNES preference pages offer the user to create his own configuration, selecting the rules he wants to
check. Default configurations are of course available.
Au-dessus des volets « Metrics » et « Rules » un menu déroulant propose de sélectionner la configuration
souhaitée.
Right above the « Metric » and « Rules » tabs, a combo box permits to choose one of the predefined
configuration.

« Custom » allows the user to:

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 6/59





Activate/desactivate the rules;
Define each rule severity;
Define thresold for each metric;

If a predefined configuration is selected, no modification is possible.

2.1.2. RULES FILTER
Rules can be filtered with keyword, using for example the language name: Shell.

2.1.3. RULES SELECTION
You can select/unselect a rule using the checkbox on the left of the rule considered.

You can select/unselect all the rules using the first checkbox.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 7/59

2.1.4. RULE’S SEVERITY CONFIGURATION
Rule criticity can be: Error / Warning / Info
It can be modified in the Severity column. No bulk change is available.

2.1.5. METRICS’ THRESHOLD CONFIGURATION
The thresholds can be modified in the « Minimum » and « Maximum » columns.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 8/59

2.1.6. RESTORE TO DEFAULT
You can go back to the default configuration using the « Restore Defaults » button.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 9/59

CHECK RULES AND COMPUTE METRICS
2.2.1. ANALYSE LAUNCH
Required: All the files to analyze are available into Project Explorer.
Step 1 : Select all the files you want to analyze into the Project Explorer.

Step 2: Launch the analyse from i-code CNES menu: i-Code CNES > Check Code.

The following progress bar appears. When the analyze is done, the results are displayed into « I-Code
CNES Violations » and « i-Code CNES Metrics »

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 10/59

2.2.2. RESULTS DISPLAY
2.2.2.1. I-CODE CNES VIOLATIONS

This tab displays :





Rule: name of the rule which is not respected
Line: line detection
Number of violations: total number of violations.
Message: error details

Violations on the same rule are displayed into a tree. The first level is the rule, the second level is the location.
2.2.2.1.1. Change display
The display can be changed using toolbar:

Il est donc possible de choisir une arborescence :

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 11/59




Quality analyze display : Règles > Fichiers > Functions > Violations
Development display : Fichiers > Functions > Règles > Violations

2.2.2.1.2. Results filter
It is possible to filter results in two ways:
Search toolbar: Search field allows to filter by rule name, file name, or keyword.

Severity: Checkboxes allows to directly filter on severity
2.2.2.1.3. Results sort
You can sort results using the column headers

2.2.2.2. I-CODE CNES METRICS
i-Code CNES Metrics displays all the metrics computed.

When a metric value is higher than the threshold, it is displayed in red.
This tab displays :
-

Metric : metric name
Total : total for this metric

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

Date : 24/05/2018

i-Code CNES User Manual

Page : 12/59

-

Mean : mean for this metric
Minimum : minimum value
Maximum : maximum value

2.2.3. I-CODE CNES DISPLAY IN THE EDITOR
When double click on a violation, the file is opened in the editor at the right line.
A marker on the left side displays the error details.

Error details

Double click to open the
file

In the Project Explorer, a marker is displayed on the files containing violations.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 13/59

2.2.4. RESULTS EXPORT
Results can be exported as csv or xml file.
1. Click on Export button, in the top right in « i-Code CNES Violations » or « i-Code CNES Metrics »

2. Select export format : csv ou xml

3. Precise export file name and location.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 14/59

4. Results file is created in the selected project

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 15/59

3. I-CODE CNES COMMAND LINE
To launch an analyze with the command line version, you can use the following commands:
icode –f   -output  : export format (xml/cvs)
 : only for xml (see following sections)
 : results output file
  : paths to the files to analyze
Example : icode *.f90 ; icode ./tmp/myfiles.f77 ;

XML FORMAT
XML format allows to add specific values into the output file.
Optional parameters are the following :





-project  : project name
-projectVersion  : project version.
-author  : author name.
-configID  : configuration id.

Exemples :




icode –f xml –output result.xml *f
icode –f xml –author “John Doe” –output result.xml *f ;
icode –f xml –author “John Doe” –project “MyProject” –output export.xml
./tmp/file.sh

HTML FORMAT
It is possible to directly convert xml to html using the option –html and –htmlOuput xx.html.
Exemples :



icode –f xml –output result.xml -html *f
icode –f xml –author Me –output result.xml –html –htmlOuput file.html *f ;

HELP DISPLAY
icode –help

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 16/59

4. RULES DESCRIPTION
COMMON RULES

Rule

Rule description

i-Code Check

Obligation d'utiliser les tableaux à deux dimensions de manière à
avoir "ligne x colonne"
COM.DATA.Array

------------------------------------------------

Non

Two dimensions arrays should be declared in this way : line x
column
Fortran 77 : Non applicable / not applicable

Non

Fortran 90 : Les paramètres des fonctions doivent être déclarés,
en premier les données d’entrée, après entrée/sortie puis les
données de sortie. La déclaration se fait au travers du mot clé
‘INTENT’ puis ‘IN’ pour les données d’entrée, INOUT pour les
entrées/sorties et OUT pour les sorties. S’il n’y a pas de paramètre
INTENT, ce n’est pas possible de faire la vérification.
COM.DATA.DeclarationOrder

------------------------------------------------

Oui

Fortran 90 : Parameters should declared in the following order :
input, input/output, output. Déclaration is made using keyword
“INTENT”, and then “IN”, “INOUT” and “OUT”.
If “INTENT” keyword is not used, the check is impossible.
Shell : non applicable / not applicable

Non

Comparaison d’égalité/inégalité (.EQ., ==, .NE., /=) interdite entre
des nombres réels (REAL, DOUBLE PRECISION ou COMPLEX).
------------------------------------------------

Oui

COM.DATA.FloatCompare
Equality and non equality (.EQ., ==, .NE., /=) are forbidden on
reals (REAL, DOUBLE PRECISION, COMPLEX)
Shell : non applicable / not applicable

Non

Les variables doivent être initialisées avant d’être utilisées. Quand
une variable est utilisée dans le code, le programme vérifie qu'elle
est initialisée (nom de la variable puis signe d'égalité), sinon, il
renvoie une erreur.
COM.DATA.Initialisation

-----------------------------------------------Variables have to be initialized before being used. When a variable
is used, the algorithme should checked if it is initialized and if not
throw an error.

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 17/59

Rule

Rule description
Shell : Non implémenté / not available

i-Code Check
Non

Les données déclarées dans une subroutine, fonction, etc et
jamais modifiées (pas d’occurrence de la variable puis signe
d’égalité) doivent être définies comme constantes
COM.DATA.Invariant

------------------------------------------------

Oui

Data declared into subroutine, fonction, … and which are never
modified then should be declared as constant.
Shell : Non implémenté / not available

Non

Interdiction de modifier les données de condition de sortie des
boucles à l'intérieur de celle-ci
COM.DATA.LoopCondition

------------------------------------------------

Oui

It is forbidden to modify loop condition inside the loop.
Fortran : Toute variable déclarée doit être utilisée, sinon une erreur
est remontée.
-----------------------------------------------Fortran : Every declared variable should be used.
Shell : Toute variable déclarée doit être utilisée.
COM.DATA.NotUsed

Limitation : Les assignations dans les options de la commande
awk peuvent engendrer des faux-positifs. Une variable est
considérée comme utilisé si elle on l’utilise avec ${variable}.

Oui

-----------------------------------------------Shell: Every declared variable should be used.
Limitations: a variable is considered as used if used with
${variable}
Interdiction de réutiliser un objet local dans des traitements de type
différent.
COM.DATA.Using

------------------------------------------------

Non

It is forbidden to reuse local object in several different treatments.
COM.DESIGN.Alloc

1

Fortran : L’allocation et la desallocation des ressources doit être
dans le même niveau (function, subroutine, …). Chaque fois que le

PC1

Les ressources vérifiés sont les blocs de mémoire, pas les fichiers. Si le développeur encapsule les allocations et desallocations dans les subroutines, l’application
remonte une erreur.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 18/59

Rule

Rule description

i-Code Check

mot ‘DEALLOCATE’ est trouvé, le programme vérifie qu’il y a le
mot ‘ALLOCATE’ et que les deux utilisent la même ressource.
-----------------------------------------------Fortran : Allocation and desallocation of ressources 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 : non applicable / not applicable

Non

Fortran : dans une boucle, les instructions SLEEP, WAIT et
PAUSE sont interdites.
------------------------------------------------

COM.DESIGN.ActiveWait

Oui

Fortran : in a loop, SLEEP, WAIT and PAUSE instructions are
forbidden.
Shell : La boucle WHILE [1] et le mot READ sont interdits
------------------------------------------------

Oui

Shell : WHILE[1] and keyword READ are forbidden.
Fortran : Le mot STOP est interdit.
-----------------------------------------------Fortran : Keyword STOP is forbidden

COM.FLOW.Abort

Shell : Les mot KILL, PKILL et KILLALL sont interdit
Limitation : Ne prend pas en compte les return,break et exit, même
s’ils peuvent interrompre l’exécution de commandes.

Oui

-----------------------------------------------Shell : Keyword KILL, PKILL and KILLALL are forbidden.
Limitation: i-Code CNES do not consider keyword “RETURN”,
“BREAK” and “EXIT”.
Dans une instruction conditionnelle (IF, DO) il n’est pas possible
de définir plus de cinq expressions conditionnelles (AND, OR,
NEQV, XOR, EQV, NOT, LT, <, LE,<=, GT, >, GE, >=, EQ, ==,
NE, /=).
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, /=)

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 19/59

Rule

Rule description
Fortran77 : Non Applicable / not applicable

i-Code Check
Non

Fortran90 : Obligation de finir l’instruction SWITCH avec
DEFAULT, afin de traiter tous les cas possibles.
-----------------------------------------------COM.FLOW.CaseSwitch

Oui

Fortran90 : SWITCH instruction should define the DEFAULT case
as last one.
Shell : Obligation de finir l’instruction CASE avec *), afin de traiter
tous les cas possibles
------------------------------------------------

Oui

Shell : CASE instruction should finish with *)
Fortran : Obligation de contrôler les paramètres passés à un
programme
COM.FLOW.CheckArguments

------------------------------------------------

Non

Fortran : Every paramaters should be checked.
Shell : voir /see SH.FLOW.CheckArguments
Fortran : Obligation de tester tous les retours de fonction
------------------------------------------------

Oui

COM.FLOW.CheckCodeReturn
Fortran : Function return values should be checked.
Shell : voir/see SH.FLOW.CheckCodeReturn

Non

Fortran : Obligation de vérifier l'identité de l'utilisateur qui exécute
un programme
------------------------------------------------

Oui

COM.FLOW.CheckUser
Fortran : The identity of the user running the program should be
checked.
Shell : voir SH.FLOW.CheckUser

Non

Fortran : Interdiction d'implémenter plusieurs points de sortie dans
les fonctions, procédures ou méthodes.
------------------------------------------------

Oui

COM.FLOW.Exit
Fortran : Function, procedure and method should have a unique
exit point.
Shell : Non implémenté / not available

Non

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 20/59

Rule

Rule description

i-Code Check

Interdiction d'implémenter plus d'une sortie dans les boucles.
COM.FLOW.ExitLoop

------------------------------------------------

Oui

Loops should have a unique exit point.
Fortran : Avant d’ouvrir ou créer (mot clé OPEN, READ, WRITE)
un fichier, doit apparaître l’instruction INQUIRE avec le flag EXIST
sur le même fichier.
------------------------------------------------

Oui

Fortran : File opening (OPEN, READ, WRITE) should be done
after using INQUIRE and EXIST instruction of this file.
Shell :
Avant d’accéder à un fichier ( > nom_fichier), il faut faire apparaître
la vérification : if [ ! -f $nom_fichier ]
COM.FLOW.FileExistence

Limitations :



Pas de détection dans les commandes $(…) ou `…`
Une variable (or redirections standards) sur laquelle est
réalisée une redirection peut être interprétée comme un fichier
------------------------------------------------

Oui

Shell: A file access (> file_name) should be preceeded 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

Dans l’instruction OPEN, il est interdit d’utiliser directement le nom
du fichier (fichier.txt). Le chemin d’accès doit être défini au travers
d'une variable qui contient le chemin vers le fichier.
COM.FLOW.FilePath

------------------------------------------------

Oui

In the OPEN instruction, it is forbidden to use directly the file name
(file.txt). Path should be defined through a variable.

COM.FLOW.Recursion

Shell : Non implémenté / not available

Non

Fortran77 : Non Applicable / not applicable

Non

Fortran90 : Interdiction d’utiliser la récursivité. En Fortran, une
fonction récursive est définie comme suit :
RECURSIVE FUNCTION (params)

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 21/59

Rule

Rule description

i-Code Check

-----------------------------------------------Fortran 90 : Recursivity is forbidden. In Fortran, i-Code CNES
checks that « RECURSIVE FUNCTION(params) » is not found.
Shell : Non implémenté / not available

Non

La double négation est interdite sur les expressions booléennes.
Les négations sont définies avec le mot. NOT. Donc les
expressions suivantes ne sont pas permises :
.NOT. (.NOT. a)

-> ( a )

.NOT. ( a .AND. .NOT. b)

-> .NOT. a .OR. b

-----------------------------------------------Oui
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)
.NOT. ( a .AND. .NOT. b)

-> ( a )
-> .NOT. a .OR. b

Shell : Non implémenté / not available

Non

Fortran : Toute expression doit être parenthésée, ainsi le nombre
de parenthèses ouvertes doit être supérieur ou égal au nombre
d'opérateurs utilisés (+, -, *, /, **)
a +b * c

-> a + (b * c)

Oui

COM.INST.Brace
-----------------------------------------------Fortran : Every expression should be braced.
Shell : Non implémenté / not available

COM.INST.CodeComment

Fortran : Interdiction de commenter le code. Tout mot clé
(ASSIGN, BACKSPACE, BLOCK DATA, CALL, …) dans une ligne
de commentaire est une erreur. Le header (commentaires juste
avant ou juste après de la déclaration de la fonction ou subroutine)
peut contenir ces mots.
-----------------------------------------------Fortran : Code comments are forbidden. I-Code CNES checks all
keywords in comments, except in the header.

Non

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 22/59

Rule

Rule description

i-Code Check

Shell : Interdiction de commenter le code. Le premier mot après le
symbole de commentaire (#), ne doit pas être un mot clé (cd,
date,…), ni une affectation de variable (var=).
Limitation : un texte courant commençant par un mot clé du
langage sera incorrectement détecté comme du code commenté.
Ex :
# date de mise a jour
# set the starting value

Oui

-----------------------------------------------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”.
Fortran: L ’instruction GO TO est interdite.
------------------------------------------------

Oui

COM.INST.GOTO
Fortran : “GO TO” is forbidden
Shell: non applicable / not applicable

Non

Fortran 77 : non applicable / not applicable

Non

Fortran 90 et Shell : Chaque ligne doit contenir maximum une
expression. En Fortran il est possible d’implémenter plusieurs
instructions dans une ligne grâce au point-virgule.
a=b+c;d=e*f

-> a = b + c
d=e*f

-----------------------------------------------COM.INST.Line

Fortan 90 and shell: Each line should be limited to only one
expression.
Shell : Interdiction de réaliser plusieurs instructions sur une même
ligne.
Limitation : L’utilisation de mots clefs dans les messages de
commandes non encadrés de guillemets peut engendrer des
erreurs sur l’analyse du fichier.
-----------------------------------------------Shell Limitation: The use of keywords in command messages
without using « » could produce false positive.

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 23/59

Rule

Rule description

i-Code Check

Fortran : Dans une instruction de boucle, les comparaison d’égalité
( .EQ., ==) ou de différence ( !=, .NE.) sont interdites.
------------------------------------------------

Oui

COM.INST.LoopCondition
Fortran: In a loop instruction, comparison using (.EQ., ==, .NE., \=)
are forbidden.
Shell : Non implémenté / not available

Non

Fortran : Une variable doit d’avoir un nom unique. Chaque fois
qu'une variable est trouvée, le programme vérifie que le nom de
cette variable n’est pas déjà utilisé dans le programme.
Oui
COM.NAME.Homonymy

-----------------------------------------------Fortran :Variable name should be unique.
Shell : Non implémenté / not available

Non

Obligation de commenter par une description détaillée les objets
importants.
COM.PRES.Data

------------------------------------------------

Non

Important objects should be well commented.
Le code doit être indenté par espaces. Une ligne doit commencer
à la même colonne que la ligne précédente. Après l’instruction DO,
IF, WHILE, WHERE, SELECT et TYPE la ligne doit commencer
dans une colonne supérieure, à l'exception de la fin de
l’expression (dénoté par END). Exemple :
DO i = 2, nb
somme = somme + x(i)
IF (isnan(somme)) THEN
print *, 'somme is a NaN'
Oui

COM.PRES.Indent
moy = -1.0
END IF
END DO
-----------------------------------------------Source code should be indented with space (see example above)

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 24/59

Rule

Rule description
Shell : Non implémenté / not available

i-Code Check
Non

Une ligne de code doit contenir un maximum de 100 caractères.
Le caractère 101 doit être écrit à la ligne suivante.
COM.PRES.LengthLine

------------------------------------------------

Oui

A line of source code should contain 100 characters maximum.
Shell : Non implémenté / not available

Non

Obligation de passer un outil d'analyse statique sur tous les codes
sources d’un projet.
COM.PROJECT.Analyser

------------------------------------------------

Non

All source code should be analyzed with checkers.
Interdiction de dupliquer / cloner du code.
COM.PROJECT.CodeCloning

------------------------------------------------

Non

Duplicated code is forbidden.
Fortran : Obligation de définir et d’appliquer les entêtes/cartouche
de chaque module et fonctions en début de projet.
Shell : nommer COM.PRES.Header
COM.PROJECT.Header

------------------------------------------------

Oui

Fortran : Headers are mandatory for each module and function

Obligation d'afficher tous les warnings et de les corriger
COM.PROJECT.Warnings

------------------------------------------------

Non

Warning should be displayed and fixed.
Fortran : Dans une expression (une expression est définie par un
opérateur comme +, -, *, /, **), Les variables doivent être de même
type : soit REAL, soit INTEGER, etc.
-----------------------------------------------COM.TYPE.Expression

Oui

Fortran :in a expression (defined by operator like +, -, /, *, **) all
variables should have the same type : REAL, INTEGER, …
Shell : Non implémenté / not available
Shell : Les variables d’une même expression doit être du même
type : integer ou char/string définis selon première initialisation.

Non

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 25/59

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 26/59

SPECIFIC RULES
4.2.1. FORTRAN 77
Règle

Vérification

Couverture
au
standard

Interdiction d’utiliser des COMMON blanc.
F77.BLOC.Common

------------------------------------------------

Oui

White COMMON are forbidden.
Dans une instruction IF, le dernier ELSE IF doit toujours être
suivi d'un ELSE.
-----------------------------------------------Oui

F77.BLOC.Else
In an instruction IF, the last ELSE IF should be follow by
ELSE.

Obligation d’utiliser les instructions OPEN et CLOSE pour
accéder aux fichiers.
F77.BLOC.File

------------------------------------------------

Non

File access whould be done using OPEN and CLOSE
instructions.
Obligation d’utiliser les parenthèses d’argument pour
l’instruction FUNCTION, même s'il n'y a pas d'argument
F77.BLOC.Function

------------------------------------------------

Oui

Parameter’s braces sohuld be used when defining a
FUNCTION whenever there is no parameter.
Les boucles DO imbriquées doivent avoir des indicateurs de
fermeture différents. Ce n’est pas possible de partager le
label.
F77.BLOC.Loop

------------------------------------------------

Oui

Nested DO loop should have different end instructions (one
for each).

F77.DATA.Array

Obligation de déclarer explicitement les dimensions des
tableaux. Par contre, est possible d’utiliser la notation * pour
la dernière dimension mais toujours avec la justification d’un
commentaire avant.
A(*), A(4, *), A(4, *, *), A(4, 4, *), mais
A(*, 4)

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 27/59

Règle

Vérification

Couverture
au
standard

-----------------------------------------------Arrays dimension should be declared explicitly. The use of * is
tolerated for the last one if justified with a comment.
Obligation d’utiliser l’instruction INCLUDE pour déclarer les
COMMON dans les unités de programmes qui les
référencent.
F77.DATA.Common

------------------------------------------------

Oui

INCLUDE must be used to declare COMMON in program
units referencing it.
Dans une initialisation de constante ou dans l'évaluation d'une
expression arithmétique, l'utilisateur souhaite que cette
constante soit évaluée en double précision, la présence d'un
exposant double précision (lettre D) est obligatoire.
Oui

F77.DATA.Double
-----------------------------------------------In a constante initialisation or in an expression evaluation, the
use of (D) (as double precision is mandatory.
Obligation d’initialiser toutes les variables avant leurs
utilisations avec l’instruction DATA ou BLOCKDATA.
F77.DATA.Initialisation

------------------------------------------------

Oui

Vairable initialisation should be done using DATA or
BLOCKDATA
Les unités logiques implicites définies par * sont interdites.

F77.DATA.IO

READ (*,f) [iolist], READ f [,iolist], WRITE (*,f) [iolist], PRINT f
[,iolist]

Oui

-----------------------------------------------Implicit logical units defined by * are forbidden.
Obligation d’utiliser un type ENTIER comme paramètre de
contrôle des boucles DO.
F77.DATA.LoopDo

------------------------------------------------

Oui

DO loop condition parameter should use INTEGER.

F77.DATA.Parameter

Interdiction d’utiliser des constantes, expression calculé ou
appel de fonction comme paramètres de fonction.
CALL function (3, x*y, f(z), var)

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 28/59

Règle

Vérification

Couverture
au
standard

-----------------------------------------------The use of constants, computed values or function calls as
function parameters is forbidden.
Obligation des tester le statut de retour des instructions OPEN
et READ, de préférence à l’aide du paramètre “ IOSTAT = ”,
et vérifier le value de cette variable.
F77.ERR.OpenRead

------------------------------------------------

Oui

The check of eturn status for instructions OPEN and READ is
mandatory. It is recommended to use “IOSTAT = “ to do it.
Interdiction d’utiliser l’instruction ASSIGN.
F77.INST.Assign

------------------------------------------------

Oui

ASSIGN instruction is forbidden.
Interdiction d’utiliser l’instruction DIMENSION.
F77.INST.Dimension

------------------------------------------------

Oui

DIMENSION instruction is forbidden.
Interdiction d’utiliser l’instruction EQUIVALENCE.
F77.INST.Equivalence

------------------------------------------------

Oui

EQUIVALENCE instruction is forbidden.
Il faut utiliser l'instruction FUNCTION avec une déclaration
explicite de type, à la définition de la fonction.
F77.INST.Function

------------------------------------------------

Oui

FUNCTION instruction should be used with an explicite type
declaration, at function definition.
Interdiction d’utiliser le IF arithmétique :
IF (Expression arithmétique) e1,e2,e3
F77.INST.If

Où les « eN » sont des étiquettes.

Oui

-----------------------------------------------Arithmetic IF is forbidden.
F77.INST.Include

Avec une instruction INCLUDE, le fichier inclus, ne peut pas
inclure instructions exécutables (ASSIGN, GOTO, IF, ELSE,
CONTINUE, STOP, PAUSE ; DO, READ, WRITE, PRINT,

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 29/59

Règle

Vérification

Couverture
au
standard

REWIND ; BACKSPACE, ENDFILE, OPEN, CLOSE,
INQUIER, CALL, RETURN, END)
-----------------------------------------------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)
Interdiction d’utiliser l’instruction PAUSE.
F77.INST.Pause

------------------------------------------------

Oui

PAUSE instruction is forbidden.
L’instruction RETURN(i) est interdite dans les sousprogrammes.
F77.INST.Return

------------------------------------------------

Oui

RETURN(i) instruction is forbidden in subprogram.
Interdiction d’utiliser l’instruction SAVE hormis pour des
variables locales avec une justification par commentaire.
F77.INST.Save

------------------------------------------------

Oui

SAVE instruction is forbidden except for local variables with
justification in a comment.
Interdiction de dépasser 72 caractères par ligne.
F77.MET.Line

------------------------------------------------

Oui

Each line should contain less than 72 characters.
Obligation d’utiliser les noms génériques des fonctions
intrinsèques.
F77.NAME.GenericIntrinsic

------------------------------------------------

Oui

The use of generic names for intrinseque functions is
mandatory.

F77.NAME.Intrinsic

Interdiction de réutiliser les noms des fonctions intrinsèques.
Quand une fonction définie par le développeur a le même
nom qu’une fonction intrinsèque (définie aux standards),
l’application lance une erreur.
------------------------------------------------

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 30/59

Règle

Vérification

Couverture
au
standard

Intrinseque function names reuse is forbidden.
Interdiction de réutiliser les mots-clés u Fortran77 pour les
variables
F77.NAME.KeyWords

------------------------------------------------

Oui

Fortran 77 keywords should not be reused for variable names.
Restriction des étiquettes aux instructions FORMAT et
CONTINUE.
F77.NAME.Label

------------------------------------------------

Oui

Obligation de déclarer les fonctions externes (lesquelles qui
ne sont pas dans le même fichier) par le mot EXTERNAL
avant de leur utilisation.
F77.PROTO.Declaration

------------------------------------------------

Oui

External functions should be declared with EXTERNAL
keyword.
Obligation d’identifier les unités logiques par un nom
symbolique.
F77.REF.IO

READ (5, *) NOMBRE

-> READ (STDIN, *) NOMBRE

Oui

-----------------------------------------------Logical unit should be identified with symbolic name.
Obligation de définir les paramètres FILE, STATUS et
POSITION de l’instruction OPEN
F77.REF.Open

------------------------------------------------

Oui

OPEN parameters FILE, STATUS and POSITION should be
defined.
Interdiction de transmettre comme paramètre d’une
subroutine les variables qui sont déjà dans un bloc COMMON
accessible par la subroutine et le programme qui l’appel.
F77.REF.Parameter

COMMON /CONTROL/ A, B, C, D
…
PROGRAM ESSAI

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 31/59

Règle

Vérification

Couverture
au
standard

CALL MY_SUB1 (A, B, C, D)
…
END PROGRAM ESSAI
….
SUBROUTINE MY_SUB1 (C _A, B, _C, C_D)
-----------------------------------------------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.
Obligation d’utiliser les types standards (INTEGER, REAL,
DOUBLE PRECISION, COMPLEX, LOGICAL, CHARACTER)
uniquement. Autres typs non standards seront considerées
erreurs INTEGER*4, LOGICAL*n
F77.TYPE.Basic

------------------------------------------------

Oui

Only standard types (INTEGER, REAL, DOUBLE
PRECISION, COMPLEX, LOGICAL, CHARACTER) are
allowed.
Les données et les constantes de type HOLLERITH sont
interdites.

F77.TYPE.Hollerith

Une donnée Hollerith est de la forme : numeroH par example
0.8H

Oui

-----------------------------------------------Data and constant of type Hollerith are forbidden.

4.2.2. FORTRAN 90
Règle

Vérification

Couverture
au standard

Obligation de libérer la mémoire allouée dans le même niveau
conceptuel.
F90.DESIGN.Free

-----------------------------------------------Allocated memory should be free in the same conceptual level.

Non

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 32/59

Règle

Vérification

Couverture
au standard

L’include d’un fichier est interdit. Si l’INCLUDE contient un fichier écrit
en F90, le programme retourne une erreur.
F90.DESIGN.Include

INCLUDE ‘file_to_include.F90’

Oui

-----------------------------------------------File inclusion is forbidden.
Le contenu des modules doit être limité aux clauses USE, PRIVATE
et PUBLIC
MODULE interface_syslog
Implicit none
PRIVATE
Interface
Subroutine f_syslog(cdata)
F90.DESIGN.Interface

USE message_syslog

Oui

Type(opendata_type)
End subroutine
End interface
PUBLIC f_syslog
End module interface_syslog
-----------------------------------------------Modules should only contains USE, PRIVATE and PUBLIC clauses.
Le nombre d’unité dans une fonction OPEN doit dépendre d’une autre
fonction ou un tableau.
Integer :: f_unit = 15
F90.DESIGN.IO

integer :: f_unit

OPEN (UNIT = f_unit, …) -> f_unit = getNumber()

PC2

OPEN(UNIT = f_unit, …)
------------------------------------------------

2

La règle demande de vérifier ces trois cas : 1) Des primitives d’allocation et de libération de numéros d’unité. 2) Une primitive de réservation d’un numéro d’unité
donné, pour permettre l’utilisation de sous-programmes Fortran 77 utilisant des numéros fixés. 3) Des constantes nommées pour l’entrée et la sortie standard. Notre
vérification inclue les options 2 et 3.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 33/59

Règle

Vérification

Couverture
au standard

In an OPEN function, units number should depend on another
function or array.
Cette règle vérifie les clauses suivantes :
- Ne pas utiliser le GOTO calculé.
- Ne pas utiliser la syntaxe : CHARACTER*N
- Ne pas utiliser le IF arithmétique
- Dans une boucle DO, ne pas utiliser de variables réelles ni comme
indice, ni pour les bornes de l’intervalle de contrôle, ni pour le pas
d’incrémentation.
- Ne pas utiliser de terminaison de boucle DO autre que END DO ou
CONTINUE.
- Ne pas faire de branchements sur ENDIF.
- Ne pas utiliser l’instruction PAUSE.
F90.DESIGN.Obsolete

- Ne pas utiliser l’instruction GOTO assigné.
- Ne pas utiliser l’affectation d’étiquette de FORMAT

Oui

- Ne pas utiliser le descripteur H (Hollerith) dans les formats.
-----------------------------------------------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
Tout fichier ouvert doit être fermé. Le programme cherche l’instruction
CLOSE pour chaque fichier ouvert en amont.
OPEN ( unit = f_unit, …)
F90.BLOC.File

…
CLOSE ( unit = f_unit, …)
------------------------------------------------

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

Date : 24/05/2018

i-Code CNES User Manual

Page : 34/59

Règle

Couverture
au standard

Vérification
Every open file should be closed.
La dimension du tableau doit être respectée. Il faut obligatoirement
utiliser les paramètres qui ont été déclarés à la création du tableau
lors de l’appel dans une fonction ou une procédure.
Example :

F90.DATA.Array

Subroutine s1(tab)

->

Subroutine s1(tab, x)

Integer :: tab(2)

Oui

Integer :: tab(x)
------------------------------------------------

Array dimensions should be respected.
Dans un tableau d’indirection il n’est pas possible de spécifier
plusieurs fois le même élément.
Integer,dimension(3) :: a
Integer.dimension(3) :: b
F90.DATA.ArrayAccess

Oui

a = ( / 1,1,3 / )
b(a) = ( / 1,2,3 / )
-----------------------------------------------In an array of indirections, it is not possible to define the same item
several times.
Les constantes qui apparaissent dans plusieurs sous-programmes
doivent être définies dans un module.
Subroutine s1()
Real PI = 3,141519
End subroutine s1

F90.DATA.Constant

module precision
->

real PI =

3.141519
Function f1()

end module precision

Real PI = 3,141519
End function
------------------------------------------------

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 35/59

Règle

Vérification

Couverture
au standard

Constants which appear in several subprograms should be defined
into a module.
Les constantes littérales numériques doivent être suivies par le
paramètre de sous-type
Integer,parameter :: DOUBLE=selected_real_kind(15)
F90.DATA.ConstantFloat

Real (DOUBLE) :: x = 0.1_DOUBLE

Oui

-----------------------------------------------Numerical constants (see above) should be followed by subtype
parameter.
Il est obligatoire de mettre l’instruction IMPLICITE NONE après
chaque en-tête de méthode. De plus chaque variable devra au
préalable être déclaré avant leur utilisation. Cette règle n’est pas prise
en compte pour les fonctions et les tableaux.
------------------------------------------------

F90.DATA.Declaration

Oui

The use of IMPLICITE NONE instruction is mandatory for each
method header.
Limitations : this rule is not checked for function and array
Est interdit d'utiliser le format * en sortie (instruction WRITE) pour les
nombres flottants
Real :: X
F90.DATA.Float

Write ( std_out, * ) , x

Oui

-----------------------------------------------It is forbidden to use * output format (WRITE instruction) for REAL
Les fonctions intrinsèques SELECTED_REAL_KIND et
SELECTED_INT_KIND doivent être regroupées dans un module.
MODULE precision
Integer, parameter :: DOUBLE = SELECTED_REAL_KIND(15)
Oui

F90.DATA.Parameter
END MODULE
-----------------------------------------------Functions SELECTED_REAL_KIND and SELECTED_INT_KIND
should be grouped in the same module.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 36/59

Règle

Vérification

Couverture
au standard

L’allocation (ALLOCATE) et libération (DEALLOCATE) doit contenir le
paramètre STAT. Ensuite, la valeur du STAT doit être testé après
l’instruction.
ALLOCATE(x, STAT = iom)
F90.ERR.Allocate

IF (iom > 0) THEN …

Oui

-----------------------------------------------Allocation and deallocation should contain “STAT” parameter. Then,
« STAT » value should be tested.
Les instructions OPEN et READ qui travaille avec des fichiers doivent
contenir le paramètre IOSTAT, et vérifier le value de cette variable.
Pour vérifier ça, l’instruction OPEN doit contenir l’attribut FILE. Un
exemple qui ne respecte pas la règle est :
OPEN (UNIT = FILE_UNIT, FILE = C_ARG)
Parce qu’il n’y a pas d’attribut IOSTAT, et le value de IOSTAT n’est
pas testé. Le même exemple correct sera :
OPEN (UNIT = FILE_UNIT, FILE = C_ARG, IOSTAT=IOS)
IF ( IOS .NE. 0) …
F90.ERR.OpenRead

Pour l’instruction READ, comme l’attribut FILE n’existe pas, la
vérification sera sur ces reads que le UNIT désigne une unité logique
qui a été ouverte par un OPEN avant a le code. En continuation avec
l’antérieur exemple :
READ (*, *)

Oui

//pas vérifiable, lecture du clavier

READ (UNIT = FILE_UNIT, FMT = 9011, IOSTAT = IOS) // verifiable
IF (IOS .LT. 0) …
-----------------------------------------------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.
F90.INST.Associated

Entre le mot ASSOCIATED et la déclaration il faut avoir l’instruction
NULLIFY.

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 37/59

Règle

Vérification

Couverture
au standard

Example :
Real, pointer :: ptr
…
NULLIFY(ptr)
ASSOCIATED(ptr)
-----------------------------------------------Between declaration and ASSOCIATED instruction, it is mandatory to
call NULLIFY.
L’instruction ENTRY est interdite
Subroutine s1
F90.INST.Entry

ENTRY rien

Oui

-----------------------------------------------ENTRY instruction is forbidden.
Interdiction d’utiliser l’instruction EQUIVALENCE.
INTEGER total (3,2)
INTEGER sum (6)
Oui

F90.INST.Equivalence
EQUIVALENCE (sum, total)
-----------------------------------------------EQUIVALENCE instruction is forbidden.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 38/59

Règle

Vérification

Couverture
au standard

L’instruction IF logique est interdite quand est suivi par un mot autre
que EXIT, CYCLE, GOTO et RETURN.
IF (x == 0) THEN
GO TO 1000
Oui

F90.INST.If
End IF
-----------------------------------------------IF followed by one of these instructions : EXIT, GOTO, CYCLE,
RETURN is forbidden.
Chaque paramètre des sous-programmes doit avoir le mot clé
INTENT à sa déclaration.
Function f1(x, y, z)
Integer, INTENT(IN) :: x
F90.INST.Intent

Integer, INTENT(IN) :: y

Oui

Integer, INTENT(OUT) :: z
-----------------------------------------------Each subprogram parameter should be declared with INTENT
keyword
Après une desallocation il y a obligation d’utiliser l’instruction
NULLIFY sur la même unité logique.
DEALLOCATE (C, stat = iom )
F90.INST.Nullify

NULLIFY ( C )
-----------------------------------------------After deallocate, the use of NULLIFY into the same logical uniti s
mandatory
Interdiction d’utiliser le mot clé ONLY sans commentaire avant qui
explique son utilisation.

F90.INST.Only

Use mes_functions_intrinseques , ONLY :: getuid -> my_getuid

Oui

-----------------------------------------------The use of keyword ONLY without comment is forbidden
F90.INST.Operator

Ne pas utiliser la notation ancienne pour les opérateurs relationnels.
Substituer .EQ., .NE., .LT., .LE., .GT., .GE. pour ==, /=, <, <=, >, >=

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 39/59

Règle

Vérification

Couverture
au standard

-----------------------------------------------Do not use old notation. Replace .EQ., .NE., .LT., .LE., .GT., .GE. by
==, /=, <, <=, >, >=
Le POINTER est interdit à exception des cas suivantes :
- pour créer des structures de données complexes (i.e. liste de
chaînes, arbre, etc.) ;
- pour manipuler des références à des tableaux (référence à un
tableau alloué dans un sous-programme, recopie par échange de
pointeurs,...) et à des parties de tableaux;
- pour utiliser de l’allocation dynamique dans les composants de types
dérivés.
F90.INST.Pointer

Le programme lance, donc, une erreur quand il trouve l’attribut
POINTER et il référence une variable simple.

Oui

real, pointer :: ppi
-----------------------------------------------POINTER is forbidden except in those cases:
 Complex data structure creation
 Manage array references
 Dynamic allocation into composants with derivated types
Ne pas se servir des fonctions intrinsèques spécifiques
(INT,IFIX,IDINT,REAL,FLOAT,SNGL,ICHAR,CHAR,AINT,DINT,ANIN
T,DNINT,NINT,IDNINT,IABS,ABS,DABS,CABS,MOD,AMOD,DMOD,I
SIGN,SIGN,DSIGN,IDIM,DIM,DDIM,DPROD,MAX0,AMAX1,DMAX1,
AMAX0,MAX1,MIN0,AMIN1,DMIN1,AMIN0,MIN1,AIMAG,CONJG,SQ
RT,DSQRT,CSQRT,EXP,DEXP,CEXP,ALOG,DLOG,CLOG,ALOG10,
DLOG10,SIN,DSIN,CSIN,COS,DCOS,CCOS,TAN,DTAN,ASIN,DASI
N,ACOS,DACOS,ATAN,DATAN,ATAN2,DATAN2,SINH,DSINH,COS
H,DCOSH,TANH,DTANH), utiliser les genériques
F90.NAME.GenericIntrins (INT,REAL,AINT,ANINT,NINT,ABS,MOD,SIGN,DIM,MAX,MIN,SQRT,
EXP,LOG,LOG10,SIN,COS,TAN,ASIN,ACOS,ATAN,ATAN2,SINH,C
ic
OSH,TANH).

Oui

resultat = AMOD (argument, diviseur)
resultat = MOD (argument, diviseur)
-----------------------------------------------Do not use specific functions (see above), use generic ones.
F90.NAME.KeyWords

Les variables du code ne peuvent être nommées comme les mots
clés en Fortran (ALLOCATABLE, ALLOCATE ;

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 40/59

Règle

Vérification

Couverture
au standard

ASSIGN,BACKSPACE, …). De plus les noms de fonctions doivent
être différents des fonctions intrinsèques (ABS, ACHAR, ACOS, …)
integer, parameter :: DATA
integer, parameter :: MY_DATA
-----------------------------------------------Fortran keywords should not be used as variable names.
La surcharge des opérateurs est interdite. Celle-ci est définie par
l'instruction INTERFACE OPERATOR (symbole) et ensuite par leur
utilisation.
Oui

F90.PROTO.Overload
-----------------------------------------------Overraded operators are forbidden
Dans une expression, quand on veut représenter l'utilisation total d'un
tableau, il est obligatoire de se servir de la notation ( : )
Y = A*X + B
F90.REF.ARRAY

Y(:) = A(:)*X + B où Y et A sont des tableaux

Oui

-----------------------------------------------The use of a whole array should be represented using the notation (:)
Le sous-programme appelé doit être 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)
Oui

F90.REF.Interface
…

…

end subroutine Mouv

end subroutine Mouv
end subroutine Pas_1

-----------------------------------------------Called subprogram should be visible.
F90.REF.Label

L’END doit être suivi par le type (FUNCTION, SUBROUTINE, …) et le
nom

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

Date : 24/05/2018

i-Code CNES User Manual

Page : 41/59

Règle

Couverture
au standard

Vérification
function f

function f

…

…

->

end function

end function f
------------------------------------------------

END keyword should be followed by the type (function, subroutine…)
and the name.
Toute instruction OPEN doit avoir les paramètres FILE,
STATUS,IOSTAT et POSITION

F90.REF.Open

OPEN (UNIT=f_unit, FILE=c_args, STATUS=’old’,
POSITION=’rewind’, IOSTAT=ios)

Oui

-----------------------------------------------Every OPEN instruction should have parameters FILE, STATUS,
IOSTAT and POSITION
Une même variable doit être référencée sous le même nom dans un
sous-programme.

F90.REF.Variable

Call incr( i )

call incr( i )

…

…

subroutine incr( j )

->

i=i+1

subroutine incr( j )

Oui

j=j+1

end subroutine incr

end subroutine incr

-----------------------------------------------A variable should be referenced with the same name in subprogram.
Toute déclaration de type doit être dans un module.
F90.TYPE.Derivate

------------------------------------------------

Oui

Every type declaration should be placed into a module
Les paramètres INTEGER doivent être suivis par l’expression
SELECTED_INT_KIND.
F90.TYPE.Integer

Integer, parameter :: LONG

integer, parameter :: LONG = SELECTED_INT_KIND(5)

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 42/59

Règle

Vérification

Couverture
au standard

-----------------------------------------------INTEGER parameters should be followed by SELECTED_INT_KIND
expression.
Les paramètres REAL doivent être suivis par l’expression
SELECTED_REAL_KIND.
Real, parameter :: LONG
Oui

F90.TYPE.Real
real, parameter :: LONG = SELECTED_REAL_KIND(5)
-----------------------------------------------REAL parameters should be followed by SELECTED_REAL_KIND

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 43/59

4.2.3. SHELL
Règle

Vérification

Couverture
au standard

Obligation de définir les constantes en utilisant ‘typeset –r’.
SH.DATA.Constant

------------------------------------------------

Non

Constants should be defined using ‘typeset –r’.
Interdiction de modifier la variable IFS
SH.DATA.IFS

------------------------------------------------

Oui

It is forbidden to modify IFS variable
À la déclaration d’un integer doit apparaitre ‘typeset –i’
SH.DATA.Integer

------------------------------------------------

Oui

Integer declaration should be done with ‘typeset –i’
La première ligne d’n script doit être # !/bin/bash, # !/bin/ksh ou
# !/bin/false.
SH.DESIGN.Bash

------------------------------------------------

Oui

Script firs line should be # !/bin/bash, # !/bin/ksh or # !/bin/false.
Interdiction pour un programme de prendre fin avant les programmes
qu'il a lancés en tâches de fond.
SH.DESIGN.Exit

------------------------------------------------

Non

It is forbidden for a program to end before the processes it launches.
Le cas getopts doit être suivi par un case où ses options sont
évaluéess.
SH.DESIGN.Options

------------------------------------------------

Oui

Getopts should be followed by a case where options are evaluated.
Obligation d'afficher un message particulier lorsqu'un script ne
reconnaît pas une option. Ce message doit inclure le synopsis
d'utilisation du script.
SH.ERR.Args

------------------------------------------------

Non

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)
SH.ERR.Help

Les options doivent être gérées par un getopts ou getopt suivi par un
case. Une de ces options doit être –h ou –help.

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 44/59

Règle

Vérification

Couverture
au standard

Limitation : si un "h)" apparaît dans une chaîne de caractères dans le
traitement du case, alors que l’option –h n’est pas gérée, il n’y aura
pas de violation.
-----------------------------------------------Options should be managed with getopts or getopt followed by a
case. One of these cases should be –h or --help
Avant le premier pipe d’un script if faut avoir ‘set –o pipefail’
Limitations :


SH.ERR.NoPipe

Un symbole "|" apparaissant dans une chaine de caractères
ou dans les options d’une commande provoquera une
violation, sauf suivant un printf ou un sed.
Les utilisations du pipe qui suivent un caractère "#" ne seront
pas détectées (ex : grep -v ^# | grep "
$POINT_DE_MONTAGE ")
------------------------------------------------

Oui

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

Dans les cas de if ou while avec les traitements de chaines de
caractères, il faut avoir le traitement de chaines vides, désignée par
[[ ]]
Limitation :
SH.ERR.String

L’appel de ls à l’intérieur d’une commande $(…) ou `…`est
susceptible d’être ignoré.

Oui

-----------------------------------------------The use of « if » or « while » with strings, empty wtrings should be
managed.
Dans une function, la première instruction, sera la vérification des
paramètes. L’instruction sera de la forme suivante : if [$# -ne 0]
SH.FLOW.CheckArgume
nts

Limitation : Un argument d’une même fonction sera signalé autant de
fois qu’il est présent dans la fonction
-----------------------------------------------In a function, first instruction should be the parameters check.

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 45/59

Règle

Vérification

Couverture
au standard

Shell : Non implémenté / not available
SH.FLOW.CheckCodeRe Pour toutes les funcions existantes et appelées dans le script, faudra
de vérifier son return avec l’aide de $#
turn

Non

La function CD est aussi considerée.
Si le script demande des droits d’administrateur, après la vérification
de l’utilisateur il faut demander l’action directe de l’admin.
SH.FLOW.CheckUser

------------------------------------------------

Oui

If root rights are needed, the administration intervention should be
asked right after the user check
Ne pas se servir de $0, utiliser ’basename $0’
SH.INST.Basename

------------------------------------------------

Oui

Do not use $0, replace it by ‘basename $0 ‘
SH.INST.Continue

SH.INST.Copy

Shell : Non implémenté / not available
Obligation d'utiliser des arguments de même nature pour les
commandes 'cp'. La nature des arguments est soit de type fichier ou
soit de type répertoire.
------------------------------------------------

Non

Non

‘cp’ command should be used with arguments of the same type (file or
directory)
L’instruction LS est interdite
SH.INST.Find

------------------------------------------------

Oui

LS instruction is forbidden
Cette règle vérifie les options passées comme paramètre dans le
script. L’application lance un warning à la dernière ligne s’il ne trouve
pas le mot GETOPS dans le script. Ce celui qui permet contrôler les
paramètres passes.
Limitation :
Partiel

SH.INST.GetOpts
Après l’appel de la commande getopt, la violation de $1 est ignoré
jusqu’à la déclaration d’une nouvelle fonction dans le fichier.
-----------------------------------------------GETOPS should be used to check parameters
SH.INST.Interpreter

La première ligne d’un script doit être l’accès à l’interpréter.

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 46/59

Règle

Vérification

Couverture
au standard

-----------------------------------------------First line should be the access to interpretor.
Une variable ne peut pas être le nom d’un mot clé (if, while, then…)
Limitation :
SH.INST.Keywords

L’appel d’option de commandes possédant un mot clef lèvent de fauxpositifs (ex : l’option if de la commande dd).

Oui

-----------------------------------------------Keyword should not be used as variable name.
Après le symbole logique && ou || seulement est permes des
instructions ‘echo’ et ‘exit’
SH.INST.Logical

------------------------------------------------

Oui

After « && » or « || », only echo and axit are allowed.
Interdiction d’écraser un fichier en utilisant la commande 'mv'.
SH.INST.Move

------------------------------------------------

Non

It is forbidden to erase a file using « mv » command.
Utiliser les commandes POSIX aux scripts. Liste dans le RNC-CNESQ-HB-80-516
Limitation :
SH.INST.POSIX

L’appel de la commande écho suivi d’une redirection (ex : echo &>2)
peut engendrer des erreurs sur l’analyse.

Oui

-----------------------------------------------POSIX commands should be used.
Les instructions SET et SHIFT sont interdites.
SH.INST.SetShift

------------------------------------------------

Oui

Instructions SET and SHIFT are forbidden.
Toute variable doit être écris comme ${nom_varable}
SH.INST.Variables

-----------------------------------------------Every variable should be written as : ${variable_name}

Oui

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 47/59

Règle

Vérification

Couverture
au standard

Les redirections non standards doit être commentées, et le
commentaire doit contenir le nom explicit de la redirection.
SH.IO.Redirect

------------------------------------------------

Oui

Nonstandard redirections should be commented, the comment should
contains the redirection name.
Pour toute instruction AWK, ne pas dépasser les 5 actions (denotées
par {…} )
SH.MET.LimitAWK

------------------------------------------------

Oui

AWK instruction should not exceed 5 actions.
Pour toute instruction SED,ne pas dépasser les 5 actions (denotées
par –e, --expresion, -f, …) et dans chaque action ne pas dépasser les
5 lignes.
Oui

SH.MET.LimitSed
-----------------------------------------------SED instruction should not exceed 5 actions.
Toute pipeline de ligne de commandes doit être commenté a priori.
SH.MET.PipeLine

------------------------------------------------

Oui

Every command pipeline should be commented.
SH.REF.Export

Shell : Non implémenté / not available

Non

Interdiction pour les scripts SHELL d'hériter des alias ou des fonctions
définis par l'utilisateur et d'utiliser des commandes interactives dans
un script.
Non

SH.REF.Inheritance
-----------------------------------------------Scripts should not inherit alias or user defined functions.
SH.SYNC.Signals

Shell : Non implémenté/ not available

Non

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 48/59

5. COMPUTED METRICS
Metric
MET.Nesting

File computation
Nombre maximum de niveaux d’imbrications de if, switch,while, for, … dans une
function/méthode. Ce nombre est 0 s’il y a aucune imbrication..

NB.Imbric = 2
-----------------------------------------------Maximum number of nested levels if a function/method. This number is 0 if there is no
imbrication.
MET.Cyclomati C’est le nombre de décisions du code (nb if, case, while, catch…). .
c

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 49/59

NB.Cycomatique = 2
-----------------------------------------------Number of decisions into the source code.
MET.LineOfCo
de

C’est le nombre total les lignes dans du code source du composant logiciel sauf les
lignes vides et les lignes de commentaires

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 50/59

NB.Line = 15
-----------------------------------------------Number of lines into the source code (except white line and comment line)
MET.RatioCom C’est la proportion de commentaires dans le code source du composant logiciel. L’entête
ment
se prend en compte dans le calcul du taux de commentaire (tant si elle est avant ou
après la définition).

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 51/59

RATE.Comment = 5 / 15 = 0.33
-----------------------------------------------Comment proportion in the source code. Header is taken into account.

6. USER MESSAGES
RULE’S VIOLATION MESSAGES
These messages are displayed into i-Code CNES violations when the analyse is done.

6.1.1. REGLES COMMUNES
Règle

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.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 52/59

Règle

Message

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.
SH : 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

Using more than five conditions in an expression is not
allowed.
SH : It is not allowed use five or more conditional
expressions in the same instruction.

COM.FLOW.CaseSwitch

A DEFAULT case is needed in a switch case instruction.
SH : 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.
SH : 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.
SH :
The keyword " + yytext() + " is used in a comment.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 53/59

Règle

Message
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

6.1.2. FORTRAN 77
Règle

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.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 54/59

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.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 55/59

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.

6.1.3. FORTRAN 90
Règle

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.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 56/59

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.GenericIntrinsi Use the generic name of the intrinsic functions instead of
c
“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.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 57/59

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”

6.1.4. SHELL
Règle

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

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 58/59

Règle

Message

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.

Réf : DNO/DA/AQ - 2017.0002478
CNES
DNO/DA/AQ

i-Code CNES User Manual

Date : 24/05/2018
Page : 59/59

7. LIMITATIONS
POWERSHELL DOES NOT ALLOW ANALYSE LAUNCH
Alternative : use cmd.exe
Issue : https://github.com/dupuisa/i-CodeCNES/issues/73

SHELL: STRINGS SHOULD BE LIMITED WITH « »
Issue: https://github.com/dupuisa/i-CodeCNES/issues/31

 END OF DOCUMENT 



Source Exif Data:
File Type                       : PDF
File Type Extension             : pdf
MIME Type                       : application/pdf
PDF Version                     : 1.5
Linearized                      : No
Page Count                      : 59
Language                        : fr-FR
Tagged PDF                      : Yes
Create Date                     : 2018:05:24 13:27:12+02:00
Modify Date                     : 2018:05:24 13:27:12+02:00
EXIF Metadata provided by EXIF.tools

Navigation menu