Details
-
Bug
-
Resolution: Unresolved
-
Minor
-
None
-
5.0.0.Final
-
None
-
None
-
False
-
False
-
Undefined
-
-
---
-
---
Description
Hi
We have some text files that contain the literals
- NOMBRE-00010 and APELLIDO-00010
- NOMBRE-00011 and APELLIDO-00011
- NOMBRE-00012 and APELLIDO-00012
- NOMBRE-00013 and APELLIDO-00013
We have a file that contains all those literals, another file that contains only NAME-0001X and another file that contains only LASTNAME-0001X.
The rules are as follows
<rule id="pruebas-usage-00010">
<when>
<and>
<filecontent pattern="NOMBRE-00010"/>
<filecontent pattern="APELLIDO-00010"/>
</and>
</when>
<rule id="pruebas-usage-00011">
<when>
<filecontent pattern="NOMBRE-00011"/>
<filecontent pattern="APELLIDO-00011"/>
</when>
<rule id="pruebas-usage-00012">
<when>
<and>
<filecontent pattern="NOMBRE-00012"/>
</and>
<and>
<filecontent pattern="APELLIDO-00012"/>
</and>
</when>
<rule id="pruebas-usage-00013">
<when>
<filecontent pattern="NOMBRE-00013"/>
</when>
<perform>
<iteration>
<when>
<filecontent pattern="APELLIDO-00013"/>
</when>
When running the analysis, the results are as follows:
- tests-usage-00010 finds 2 issues in the file containing NOMBRE-00010 and APELLIDO-00010 and 1 issue in each of the files containing only NOMBRE-00010 or APELLIDO-00010
- tests-usage-00011 finds 2 issues in the file containing NOMBRE-00011 and APELLIDO-00011 and 1 issue in each of the files containing only NOMBRE-00011 or APELLIDO-00011
- tests-usage-00012 finds 2 issues in the file containing NOMBRE-00012 and APELLIDO-00012 and 1 issue in each of the files containing only NOMBRE-00012 or APELLIDO-00012
- tests-usage-00013 finds 1 incidence in the file that contains the literals NOMBRE-00013 and APELLIDO-00013
It seems that the rules behave like a logical OR
On the other hand we have other rules in which we want to find java classes that use a notation and contain a literal. Separately both rules are fulfilled, but not when they are together in a rule, even if they are indicated within an OR
The rules are as follows
<rule id="pruebas-usage-00040">
<when>
<javaclass references="javax.persistence.Table" as="entity">
<location>ANNOTATION</location>
</javaclass>
<filecontent from="entity" pattern="private{*}
</when>
----
<rule id="pruebas-usage-10040">
<when>
<or>
<javaclass references="javax.persistence.Table" as="entity">
<location>ANNOTATION</location>
</javaclass>
<filecontent from="entity" pattern="private{*}{B|b}
oolean "/>
</or>
</when>
<rule id="pruebas-usage-00041">
<when>
<filecontent pattern="private{*}
oolean "/>
</when>
<rule id="pruebas-usage-00042">
<when>
<javaclass references="javax.persistence.Table">
<location>ANNOTATION</location>
</javaclass>
</when>
The rules testing-usage-00040 and testing-usage-10040 do not obtain any incidents, but the rules testing-usage-00041 and testing-usage-00042 do obtain incidents
[^fichero-2-contexto.txt] [^pruebas-usage.windup.xml]fichero-2-contexto.txt^^[^fichero-3-contexto.txt][^fichero-4-contexto.text]