devonfw / sonar-devon4j-plugin

Plugin for SonarQube to validate devonfw architecture
Apache License 2.0
10 stars 16 forks source link

devon layer violation rule hitting on Cobigen generated code #138

Closed rhobolic closed 2 years ago

rhobolic commented 2 years ago

Problem When I generate the code in Cobigen and then it passes SonarQube the devon for layer violation is hit. image It is importing the *SearchCriteriaTo.java in the Repository

Expected behavior There is no layer violation caused by Cobigen generated code at all

hohwille commented 2 years ago

@rhobolic thanks for reporting. IMHO in this case, actually the rule is correct. A lower layer may not depend on code from upper layers. So actually the SearchCriteriaTo has to be generated in dataaccess since it is required and defined here as representation for the query. A next problem could then be that the service layer will then directly depend on dataaccess bypassing the logic layer. This is then a matter of the strictness of a layered architecture. It is interesting that you seem to be the first one to notice this problem and nobody ever found this before. My suggestion is still to change the CobiGen Templates but this one might be a little tricky and could cause some time to get resolved properly.

hohwille commented 2 years ago

I created this issue in CobiGen https://github.com/devonfw/cobigen/issues/1548 and hence close this issue as sonar-devon4j-plugin behaves correct here.