jqassistant-archive / jqa-core-framework

The core framework of jQAssistant providing the infrastructure for scanners, rules, analysis and reports.
http://jqassistant.org/
GNU General Public License v3.0
23 stars 6 forks source link

Allow extension of concepts using "providesConceptId(s)" #59

Closed DirkMahler closed 3 years ago

DirkMahler commented 3 years ago

A user of jQAssistant should be able to extend existing concepts.

Example: The constraints related by the Spring plugin report violations for generated code (e.g. by Maven plugins). Therefore these rules should exclude generated classes, but sadly there's no general concept to identify them.

The proposed solution is as follows:

<concept id="java:GeneratedType">
    <cypher><![CDATA[
        MATCH
          (a:Artifact)-[:CONTAINS]->(generated:Java:Type:Generated)
        RETURN
          a as Artifact, count(generated) as GeneratedTypes
    ]]></cypher>
</concept>
<concept id="my-project:GeneratedType">
  <providesConcept refId="java:GeneratedType"
   <cypher><![CDATA[
        MATCH
          (generated:Java:Type)
        WHERE
          generated.fqn starts with "com.acme.generated."
        SET
           generated:Generated
        RETURN
          count(generated) as GeneratedTypes
    ]]></cypher>
obfischer commented 3 years ago

Hi @DirkMahler, do we need this for 1.10.0 or can it be done also for 1.11.0?

DirkMahler commented 3 years ago

It's easy to implement, provides high value and actually already nearly finished...