MaibornWolff / codecharta

CodeCharta is a visualization tool that transforms complex software architecture and code metrics into interactive, customizable visual maps, empowering everyone to communicate and analyze your codebase. Improve code quality, maintainability, and architectural decisions
https://maibornwolff.github.io/codecharta/
BSD 3-Clause "New" or "Revised" License
192 stars 30 forks source link

Path Unification for better merging #3495

Open phanlezz opened 9 months ago

phanlezz commented 9 months ago

Path Unification

modules as in importer / parser

All modules of the analysis should produces similar paths if possible for the same code. As a user I want to merge a variety of used modules, without modifying paths/roots of files.

The motivation for this issue was the sonar importer, which unfortunately currently nests the paths additionally, but it should be checked to what extent this also affects the other modules.

One approach could be to develop an automatic merge mode that tries to find a lowest common denominator across multiple project files. This mode should allow paths to be matched and folders to be nested correctly without manual input.

A short example:

- root
- - a
- - b

- someKey
- - root
- - a
- - b

- b 

should all get merged without user input to:

- root
- - a
- - b

Open questions

Modify modules or automatic merge

Side note

unification might be the wrong term.

Richargh commented 1 month ago

The motivation for this issue was the sonar importer, which unfortunately currently nests the paths additionally

@phanlezz If that is the main motivation, wouldn't it then be better to work on the sonar importer and not touch the merge? If sonar returns a single root folder and that contains the other stuff:

- root
- - theprojectname
- - - src/
- - - something.else

then instead return:

- root
- - src/
- - something.else

If sonar instead returns

- root
- - anotherfolder
- - theprojectname
- - - src/
- - - something.else

Then return that because there must be some reason.

Wouldn't that solve most problems and be the easiest to implement?

PS: The tokeiimporter has the same problem and could be fixed in a similar way. tokei codecharta -o json > codecharta.tokei.json and ccsh tokeiimporter codecharta.tokei.json -o codecharta.tokei.cc.json.gz will return a file with the contents:

root
- codecharta
- - analysis
- - gh-pages
- - visualization
- - package.json

But it would be much better if it returned:

root
- analysis
- gh-pages
- visualization
- package.json
phanlezz commented 1 month ago

I agree, that the answer to the question, that I asked, is to modify the existing parsers to produce similar structures. After that, we can look into the topic of automatic merging, and if it is something useful to have as a tool.