Skip to content

Commit 11cc4cf

Browse files
committed
Add EUMETSAT Rules
1 parent e7ee4b5 commit 11cc4cf

File tree

4 files changed

+275
-62
lines changed

4 files changed

+275
-62
lines changed

src/main/resources/rules/icode-f77-rules.xml

Lines changed: 130 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
2222
<key>COM.DATA.FloatCompare</key>
2323
<name>COM.DATA.FloatCompare</name>
2424
<internalKey>*</internalKey>
25-
<description>Equality and non equality (.EQ., ==, .NE., /=) are forbidden on reals (REAL, DOUBLE PRECISION, COMPLEX).</description>
25+
<description>Equality and non equality (.EQ., ==, .NE., /=) are forbidden on reals (REAL,
26+
DOUBLE PRECISION, COMPLEX).</description>
2627
<severity>MAJOR</severity>
2728
<status>READY</status>
2829
<type>CODE_SMELL</type>
@@ -32,7 +33,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
3233
<key>COM.DATA.Initialisation</key>
3334
<name>COM.DATA.Initialisation</name>
3435
<internalKey>*</internalKey>
35-
<description>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.</description>
36+
<description>Variables have to be initialized before being used. When a variable is used,
37+
the algorithm should checked if it is initialized and if not throw an error.</description>
3638
<severity>MAJOR</severity>
3739
<status>READY</status>
3840
<type>CODE_SMELL</type>
@@ -42,7 +44,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
4244
<key>COM.DATA.Invariant</key>
4345
<name>COM.DATA.Invariant</name>
4446
<internalKey>*</internalKey>
45-
<description>Data declared into subroutine, function, ... and which are never modified then should be declared as constant.</description>
47+
<description>Data declared into subroutine, function, ... and which are never modified then
48+
should be declared as constant.</description>
4649
<severity>MAJOR</severity>
4750
<status>READY</status>
4851
<type>CODE_SMELL</type>
@@ -72,7 +75,9 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
7275
<key>COM.DESIGN.Alloc</key>
7376
<name>COM.DESIGN.Alloc</name>
7477
<internalKey>*</internalKey>
75-
<description>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.</description>
78+
<description>Allocation and desallocation of ressources should be in the same level. For
79+
each “DEALLOCATE” keyword found, i-Code CNES checks that the keyword “ALLOCATE” is also
80+
found and checks that they are relative to the same resource.</description>
7681
<severity>MAJOR</severity>
7782
<status>READY</status>
7883
<type>CODE_SMELL</type>
@@ -102,7 +107,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
102107
<key>COM.FLOW.BooleanExpression</key>
103108
<name>COM.FLOW.BooleanExpression</name>
104109
<internalKey>*</internalKey>
105-
<description>In a condition (IF,DO), maximum number of operands is 5 (AND, OR, NEQV, XOR, EQV, NOT, LT, &lt;, LE, &lt;=, GT, &gt;, GE, &gt;=, EQ, ==, NE, /=).</description>
110+
<description>In a condition (IF,DO), maximum number of operands is 5 (AND, OR, NEQV, XOR,
111+
EQV, NOT, LT, &lt;, LE, &lt;=, GT, &gt;, GE, &gt;=, EQ, ==, NE, /=).</description>
106112
<severity>MAJOR</severity>
107113
<status>READY</status>
108114
<type>CODE_SMELL</type>
@@ -152,7 +158,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
152158
<key>COM.FLOW.FileExistence</key>
153159
<name>COM.FLOW.FileExistence</name>
154160
<internalKey>*</internalKey>
155-
<description>File opening (OPEN, READ, WRITE) should be done after using INQUIRE and EXIST instruction of this file.</description>
161+
<description>File opening (OPEN, READ, WRITE) should be done after using INQUIRE and EXIST
162+
instruction of this file.</description>
156163
<severity>MAJOR</severity>
157164
<status>READY</status>
158165
<type>CODE_SMELL</type>
@@ -162,7 +169,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
162169
<key>COM.FLOW.FilePath</key>
163170
<name>COM.FLOW.FilePath</name>
164171
<internalKey>*</internalKey>
165-
<description>In the OPEN instruction, it is forbidden to use directly the file name (file.txt). Path should be defined through a variable.</description>
172+
<description>In the OPEN instruction, it is forbidden to use directly the file name
173+
(file.txt). Path should be defined through a variable.</description>
166174
<severity>MAJOR</severity>
167175
<status>READY</status>
168176
<type>CODE_SMELL</type>
@@ -172,9 +180,10 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
172180
<key>COM.INST.BoolNegation</key>
173181
<name>COM.INST.BoolNegation</name>
174182
<internalKey>*</internalKey>
175-
<description>Double negation is forbidden on Boolean expressions. Negations are defined with the keyword « NOT ». Following expressions are not allowed:
176-
NOT. (.NOT. a) -> ( a )
177-
.NOT. ( a .AND. .NOT. b) -> .NOT. a .OR. b</description>
183+
<description>Double negation is forbidden on Boolean expressions. Negations are defined with
184+
the keyword « NOT ». Following expressions are not allowed:
185+
NOT. (.NOT. a) -> ( a )
186+
.NOT. ( a .AND. .NOT. b) -> .NOT. a .OR. b</description>
178187
<severity>MAJOR</severity>
179188
<status>READY</status>
180189
<type>CODE_SMELL</type>
@@ -194,7 +203,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
194203
<key>COM.INST.CodeComment</key>
195204
<name>COM.INST.CodeComment</name>
196205
<internalKey>*</internalKey>
197-
<description>Commented code is forbidden. i-Code CNES checks all keywords in comments, except in the header.</description>
206+
<description>Commented code is forbidden. i-Code CNES checks all keywords in comments,
207+
except in the header.</description>
198208
<severity>MAJOR</severity>
199209
<status>READY</status>
200210
<type>CODE_SMELL</type>
@@ -246,11 +256,11 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
246256
<internalKey>*</internalKey>
247257
<description>Source code should be indented with spaces:
248258
DO i = 2, nb
249-
somme = somme + x(i)
250-
IF (isnan(somme)) THEN
251-
print *, 'somme is a NaN'
252-
moy = -1.0
253-
END IF
259+
somme = somme + x(i)
260+
IF (isnan(somme)) THEN
261+
print *, 'somme is a NaN'
262+
moy = -1.0
263+
END IF
254264
END DO
255265
</description>
256266
<severity>MAJOR</severity>
@@ -272,7 +282,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
272282
<key>COM.TYPE.Expression</key>
273283
<name>COM.TYPE.Expression</name>
274284
<internalKey>*</internalKey>
275-
<description>In a expression (defined by operator like +, -, /, *, **) all variables should have the same type : REAL, INTEGER, …</description>
285+
<description>In a expression (defined by operator like +, -, /, *, **) all variables should
286+
have the same type : REAL, INTEGER, …</description>
276287
<severity>MAJOR</severity>
277288
<status>READY</status>
278289
<type>CODE_SMELL</type>
@@ -302,7 +313,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
302313
<key>F77.BLOC.Function</key>
303314
<name>F77.BLOC.Function</name>
304315
<internalKey>*</internalKey>
305-
<description>Parameter’s braces should be used when defining a FUNCTION whenever there is no parameter.</description>
316+
<description>Parameter’s braces should be used when defining a FUNCTION whenever there is no
317+
parameter.</description>
306318
<severity>MAJOR</severity>
307319
<status>READY</status>
308320
<type>CODE_SMELL</type>
@@ -322,7 +334,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
322334
<key>F77.DATA.Array</key>
323335
<name>F77.DATA.Array</name>
324336
<internalKey>*</internalKey>
325-
<description>Arrays dimension should be declared explicitly. The use of * is tolerated for the last one if justified with a comment.</description>
337+
<description>Arrays dimension should be declared explicitly. The use of * is tolerated for
338+
the last one if justified with a comment.</description>
326339
<severity>MAJOR</severity>
327340
<status>READY</status>
328341
<type>CODE_SMELL</type>
@@ -342,7 +355,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
342355
<key>F77.DATA.Double</key>
343356
<name>F77.DATA.Double</name>
344357
<internalKey>*</internalKey>
345-
<description>In a constant initialisation or in an expression evaluation, the use of (D) (as double precision is mandatory.</description>
358+
<description>In a constant initialisation or in an expression evaluation, the use of (D) (as
359+
double precision is mandatory.</description>
346360
<severity>MAJOR</severity>
347361
<status>READY</status>
348362
<type>CODE_SMELL</type>
@@ -382,7 +396,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
382396
<key>F77.DATA.Parameter</key>
383397
<name>F77.DATA.Parameter</name>
384398
<internalKey>*</internalKey>
385-
<description>The use of constants, computed values or function calls as function parameters is forbidden.</description>
399+
<description>The use of constants, computed values or function calls as function parameters
400+
is forbidden.</description>
386401
<severity>MAJOR</severity>
387402
<status>READY</status>
388403
<type>CODE_SMELL</type>
@@ -392,7 +407,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
392407
<key>F77.ERR.OpenRead</key>
393408
<name>F77.ERR.OpenRead</name>
394409
<internalKey>*</internalKey>
395-
<description>The check of return status for instructions OPEN and READ is mandatory. It is recommended to use “IOSTAT = “ to do it.</description>
410+
<description>The check of return status for instructions OPEN and READ is mandatory. It is
411+
recommended to use “IOSTAT = “ to do it.</description>
396412
<severity>MAJOR</severity>
397413
<status>READY</status>
398414
<type>CODE_SMELL</type>
@@ -432,7 +448,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
432448
<key>F77.INST.Function</key>
433449
<name>F77.INST.Function</name>
434450
<internalKey>*</internalKey>
435-
<description>FUNCTION instruction should be used with an explicite type declaration, at function definition.</description>
451+
<description>FUNCTION instruction should be used with an explicite type declaration, at
452+
function definition.</description>
436453
<severity>MAJOR</severity>
437454
<status>READY</status>
438455
<type>CODE_SMELL</type>
@@ -452,7 +469,9 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
452469
<key>F77.INST.Include</key>
453470
<name>F77.INST.Include</name>
454471
<internalKey>*</internalKey>
455-
<description>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).</description>
472+
<description>If instruction INCLUDE is used, the included file should not contain executable
473+
instructions. (ASSIGN, GOTO, IF, ELSE, CONTINUE, STOP, PAUSE ; DO, READ, WRITE, PRINT,
474+
REWIND ; BACKSPACE, ENDFILE, OPEN, CLOSE, INQUIER, CALL, RETURN, END).</description>
456475
<severity>MAJOR</severity>
457476
<status>READY</status>
458477
<type>CODE_SMELL</type>
@@ -482,7 +501,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
482501
<key>F77.INST.Save</key>
483502
<name>F77.INST.Save</name>
484503
<internalKey>*</internalKey>
485-
<description>SAVE instruction is forbidden except for local variables with justification in a comment.</description>
504+
<description>SAVE instruction is forbidden except for local variables with justification in
505+
a comment.</description>
486506
<severity>MAJOR</severity>
487507
<status>READY</status>
488508
<type>CODE_SMELL</type>
@@ -572,9 +592,10 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
572592
<key>F77.REF.Parameter</key>
573593
<name>F77.REF.Parameter</name>
574594
<internalKey>*</internalKey>
575-
<description>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.</description>
595+
<description>It is forbidden to set as subroutine parameter variables which are already in a
596+
COMMON bloc accessible from the subroutine and the program which calls it.</description>
576597
<severity>MAJOR</severity>
577-
598+
578599
<status>READY</status>
579600
<type>CODE_SMELL</type>
580601
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
@@ -583,7 +604,8 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
583604
<key>F77.TYPE.Basic</key>
584605
<name>F77.TYPE.Basic</name>
585606
<internalKey>*</internalKey>
586-
<description>Only standard types (INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL, CHARACTER) are allowed.</description>
607+
<description>Only standard types (INTEGER, REAL, DOUBLE PRECISION, COMPLEX, LOGICAL,
608+
CHARACTER) are allowed.</description>
587609
<severity>MAJOR</severity>
588610
<status>READY</status>
589611
<type>CODE_SMELL</type>
@@ -599,4 +621,84 @@ Please, report this error to i-Code CNES maintainers to improve the tool: <a hre
599621
<type>CODE_SMELL</type>
600622
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
601623
</rule>
624+
<rule>
625+
<severity>MAJOR</severity>
626+
<status>READY</status>
627+
<type>CODE_SMELL</type>
628+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
629+
<internalKey>*</internalKey>
630+
<name>COM.PRES.FileLength</name>
631+
<key>COM.PRES.FileLength</key>
632+
<description>The file must be short</description>
633+
</rule>
634+
<rule>
635+
<severity>MAJOR</severity>
636+
<status>READY</status>
637+
<type>CODE_SMELL</type>
638+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
639+
<internalKey>*</internalKey>
640+
<name>COM.MET.LineOfCode</name>
641+
<key>COM.MET.LineOfCode</key>
642+
<description>The number of line of code must be lower</description>
643+
</rule>
644+
<rule>
645+
<severity>MAJOR</severity>
646+
<status>READY</status>
647+
<type>CODE_SMELL</type>
648+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
649+
<internalKey>*</internalKey>
650+
<name>COM.FLOW.CheckArguments</name>
651+
<key>COM.FLOW.CheckArguments</key>
652+
<description>You must control every arguments</description>
653+
</rule>
654+
<rule>
655+
<severity>MAJOR</severity>
656+
<status>READY</status>
657+
<type>CODE_SMELL</type>
658+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
659+
<internalKey>*</internalKey>
660+
<name>COM.MET.ComplexitySimplified</name>
661+
<key>COM.MET.ComplexitySimplified</key>
662+
<description>The cylcomatic number from Simplified McCabe must be lowered</description>
663+
</rule>
664+
<rule>
665+
<severity>MAJOR</severity>
666+
<status>READY</status>
667+
<type>CODE_SMELL</type>
668+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
669+
<internalKey>*</internalKey>
670+
<name>F77.DESIGN.LogicUnit</name>
671+
<key>F77.DESIGN.LogicUnit</key>
672+
<description>Please refer to RNC Q80.</description>
673+
</rule>
674+
<rule>
675+
<severity>MAJOR</severity>
676+
<status>READY</status>
677+
<type>CODE_SMELL</type>
678+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
679+
<internalKey>*</internalKey>
680+
<name>COM.MET.RatioComment</name>
681+
<key>COM.MET.RatioComment</key>
682+
<description>You must add more comments on your code</description>
683+
</rule>
684+
<rule>
685+
<severity>MAJOR</severity>
686+
<status>READY</status>
687+
<type>CODE_SMELL</type>
688+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
689+
<internalKey>*</internalKey>
690+
<name>COM.PRES.Data</name>
691+
<key>COM.PRES.Data</key>
692+
<description>Please refer to RNC Q80.</description>
693+
</rule>
694+
<rule>
695+
<severity>MAJOR</severity>
696+
<status>READY</status>
697+
<type>CODE_SMELL</type>
698+
<remediationFunctionBaseEffort>30min</remediationFunctionBaseEffort>
699+
<internalKey>*</internalKey>
700+
<name>F77.FILE.Header</name>
701+
<key>F77.FILE.Header</key>
702+
<description>You must add an header to this file</description>
703+
</rule>
602704
</icodelint-rules>

0 commit comments

Comments
 (0)