MaibornWolff / codecharta

CodeCharta visualizes multiple code metrics using 3D tree maps.
https://maibornwolff.github.io/codecharta/
BSD 3-Clause "New" or "Revised" License
178 stars 30 forks source link

Update Sourcecodeparser #3631

Open ChristianHuehn opened 1 month ago

ChristianHuehn commented 1 month ago

As a user of codecharta I want to use the source code parser on the newest features. So I can use it to analyze new code.

Probably linked Issues:

Nereboss commented 1 month ago

These issues seem to be caused by 'newer' java language features (v.15 and onward). The sourcecodeparser internally uses a sonar-java instance with version 6.8.0.23379, released was September 2020 and does not know newer java features. It therefore handles them as illegal/unknown tokens and throws errors.

We tried updating the sonar-java instance but their changelogs about breaking changes seems to be incomplete (https://docs.sonarsource.com/sonarqube/latest/analyzing-source-code/languages/java/). As we are more than 30 versions behind the current one, updating the parser will require significant effort because research has to be done for each breaking change (there are a lot of them).

This will therefore be handled at a later date. Note that the parser should still work for all projects written in java 14 and below.

For projects that currently throw errors, i noticed that adding the -nc flag (not compressing the cc.json file) results in the visualisation being able to display the map where as without the flag it would say the file is "empty or invalid". I tested this for Junit5 but it could work for other code too.