ejwa/gitinspector

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

fuhrmanator opened this issue · 2 comments

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:

  • I tried using -f test.ts as an extension, but it's not recognized.
  • Following the -x "author:^(?!(John Smith))" in the documentation, I tried something similar: -x "file:^(?!(test))" but it doesn't match the files, even though it will exclude them with -x file:test.

Is there another way?

@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.

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.