devonfw / sonar-devon4j-plugin

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

Make scope optional #132

Open hohwille opened 3 years ago

hohwille commented 3 years ago

This plugins is requiring the «scope» as mandatory package segment. This is compliant with the classic project structure. However, with the modern project structure we made the scope optional. Our sonar plugin should therefore also accept the modern structure as valid architecture.

Therefore the scope needs to be made optional in the regex of the default config. Also DevonPackage needs to be changed such that isValidScope() also accepts no scope. Also add a new method hasScope() to DevonPackage that checks if the package has no scope (scope is null or empty String). See also https://github.com/devonfw/sonar-devon4j-plugin/blob/master/src/main/java/com/devonfw/ide/sonarqube/common/api/config/DevonPackageImpl.java

Also as part of this story all scope rules need to be checked that they do nothing if package.hasScope() returns false.

Also change and extend the integration tests. For packaging see:

Here the test is expected to fail and DevonArchitecturePackageCheck_NoScope.java should now be compliant to the comment needs to be removed.