adamtornhill / code-maat

A command line tool to mine and analyze data from version-control systems

Home Page:http://www.adamtornhill.com/code/codemaat.htm

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[question] Example GROUP file for the --group command line option

hydrosquall opened this issue · comments

Hi Adam,

Thanks for making this powerful tool free and open source!

I was wondering if you could provide an example GROUP file for usage with the -g CLI option for grouping related entities. I have some files I found the test file that implements this functionality which might offer some clues, but I'm not familiar enough with Clojure to determine how to write my input text files. I have some deep folders that I'd like to roll-up into a single entity to reduce the noisiness of the visualization.

https://github.com/adamtornhill/code-maat/blob/master/test/code_maat/app/grouper_test.clj

Thanks for any pointers or ideas!

I read through the grouper class source + the instaparse docs, and using these lines:

We expect the groups to be specified as text:
some-path => some_name
or with a regex:
^some-regexp$ => some_name

figured out how to write a custom grouping file for my project. It was along the lines of

src/components/utils => utils
src/pages/PageB => PageB
src/pages/PageA/*.test.js => PageATests
#...etc

If I come up with a useful example for this in an open source project, would you be interested in having an additional section in the README.md about how to use this flag?

Thanks for your kind words! I'm happy to hear that.

There are some sample text files in the end_to_end test folder, for example this one

Here's an excerpt:

src/Features/Core      => Core
^src\/.*\/.*Tests\.cs$ => CS Tests

The format is regex_pattern => logical_group_name. Code Maat takes everything that matches a regex and analyses it as a holistic whole by aggregating all file contributions for the matches.

I'll try to make a PR soon that adds an example to the docs. It's a good idea.