@@ -590,6 +590,62 @@ the following configuration will raise an error:
590
590
Forbidden_Attributes: {Forbidden: ["Length"], instance_name: "Forbid_Attr"}
591
591
}
592
592
593
+ You cannot provide more than **one ** LKQL rule file when running GNATcheck. In
594
+ order to compose a rule file with another you have to use the
595
+ :ref: `LKQL importation mechanism<module_importation> ` and concatenate rule
596
+ objects. Here is an example of LKQL rule file composition:
597
+
598
+ .. code-block :: lkql
599
+
600
+ # common_rules.lkql
601
+
602
+ val rules = @{
603
+ Goto_Statements
604
+ }
605
+
606
+ .. code-block :: lkql
607
+
608
+ # specific_rules.lkql
609
+
610
+ import common_rules
611
+
612
+ val rules = common_rules.rules & @{
613
+ Redundant_Null_Statements
614
+ }
615
+
616
+ Then you can run GNATcheck with the ``specific_rules.lkql `` file as coding
617
+ standard to perform rules defined in ``common_rules.lkql `` combined to the ones
618
+ defined in ``specific_rules.lkql ``.
619
+
620
+ .. note ::
621
+
622
+ You can use the ``--lkql-path `` command-line switch and the
623
+ ``Check'Lkql_Path `` GPR attribute to configure directories LKQL rule files
624
+ are going to be searched in.
625
+
626
+ You can enable the same rule in multiple files, but the constraint about the
627
+ instance name uniqueness remains valid, meaning that such configuration is
628
+ invalid:
629
+
630
+ .. code-block :: lkql
631
+
632
+ # common_rules.lkql
633
+
634
+ val rules = @{
635
+ Forbidden_Attributes: {Forbidden: ["First"], instance_name: "Forbid_Attr"}
636
+ }
637
+
638
+ .. code-block :: lkql
639
+
640
+ # specific_rules.lkql
641
+
642
+ import common_rules
643
+
644
+ val rules = common_rules.rules & @{
645
+ Forbidden_Attributes: {Forbidden: ["Last"], instance_name: "Forbid_Attr"}
646
+ }
647
+ # error: This rule configuration defines two instances with the same name: "Forbid_Attr"
648
+
593
649
594
650
.. _gnatcheck_Rule_Options :
595
651
0 commit comments