ejwa / gitinspector

:bar_chart: The statistical analysis tool for git repositories
GNU General Public License v3.0
2.34k stars 324 forks source link

How to get a report for only `.test.ts` files in a `/test` directory? #211

Closed fuhrmanator closed 4 years ago

fuhrmanator commented 4 years ago

Hello - thanks for making and contributing gitinspector!

My students have to write tests, too, and they're in .test.ts files in a /test directory, e.g., test/useCase01.test.ts. I have tried to get a report for only tests, and haven't succeeded yet:

Is there another way?

adam-waldenberg commented 4 years ago

@fuhrmanator

Here is a test run on the gitinspector repo targeting the translations directory and only considering the .po extension:

./gitinspector.py -x 'file:^(?!(gitinspector/translations))' -f po
Statistical information for the repository 'gitinspector' was gathered on 2020/07/06.
The following historical commit information, by author, was found in the repository:

Author                     Commits    Insertions      Deletions    % of changes
Adam Waldenberg                 28          1037            709           40.23
Agustín Cañas                    2           421              8            9.88
Bill Wang                        3           406            108           11.84
Kamila Chyla                     2           327             17            7.93
Luca Motta                       2           413            102           11.87
Philipp Nowak                    1           391              0            9.01
Yannick Moy                      1           401              0            9.24

Below are the number of rows from each author that have survived and are still intact in
the current revision:

Author                     Rows      Stability          Age       % in comments
Adam Waldenberg             583           56.2         11.2                7.89
Agustín Cañas               403           95.7          4.3                7.20
Bill Wang                   280           69.0         26.0               10.36
Kamila Chyla                300           91.7         22.6                9.67
Luca Motta                  301           72.9         20.2                9.63
Philipp Nowak               209           53.5         14.1               13.88
Yannick Moy                 376           93.8         14.1                7.45

Note that this is the relative path from the root of the project directory. If you want to be more broad and catch all translations directories recursively you would do something like, -x 'file:^(?!(.*translations))'

Also note there might be a difference between using single quotes vs double quotes depending on what terminal you are using.

In your case I would guess -f ts -x 'file:^(?!(*.test))' would do the trick. This would recursively consider all the test directories and only include .ts files in the analysis.

fuhrmanator commented 4 years ago

Thank you - it worked with -x 'file:^(?!(test))' -f ts -- I wasn't aware that the -f ts was also needed, but it makes sense now.