-
Notifications
You must be signed in to change notification settings - Fork 328
Documentation
This document covers the features of gitinspector, it's options and how to use them.
- Git executable defined somewhere in your PATH, otherwise gitinspector will not be able to run git.
- Python 2.6+.
The program can be executed using two different methods.
- By changing directory to a GIT repository and running the command
gitinspector.py [OPTION]...
- By running the command
gitinspector.py [OPTION]... [GIT REPOSITORY]
The gitinspector script itself accepts a number of options that modifies it's behavior and how statistics are generated. It is possible to get a brief explanation of all available options by supplying -h or --help when running the program. Boolean arguments can only be given to long options.
Option | Availability | Description |
---|---|---|
-c,--checkout-missing[=BOOL] | < 0.4.0 | By default, gitinspector will just print out missing files in a list and skip the inclusion of certain statistics from those files. With this option, gitinspector will try to checkout any missing files before computing statistics. |
-f, --file-types=EXTENSIONS | A comma separated list of file extensions to include when computing statistics. The default file extensions used are: java,c,cpp,h,hpp,py,glsl,rb,js,sql | |
-F, --format=FORMAT | > 0.2.0 | Defines in which format output should be generated; the default format is "text" and the available formats are: html,htmlembedded,text,xml. Refer to Output Formats section for more information about each format available. |
--grading[=BOOL] | > 0.2.0 | Show statistics and information in a way that is formatted for grading of student project; this is the same as supplying -HlmrTw. |
-H, --hard[=BOOL] | Track rows and look for duplicates harder. In essence, this passes additional -C (and -M) options to the git executable. | |
-l, --list-file-types[=BOOL] | List all the file extensions available in the current branch of the repository. This can be very useful when you want to check what extensions are available in the repository. These can later be passed to gitinspector using the -f or --file-types options. | |
-L, --localize-output[=BOOL] | > 0.3.0 | By default; the generated statistics are always in English. This flag localizes the generated output to the selected system language if a translation is available. |
-m, --metrics[=BOOL] | Include checks for certain metrics during the analysis of commits. | |
-r, --responsibilities[=BOOL] | Show which files the different authors seem most responsible for. | |
--since=DATE | > 0.2.1 | Show statistics for commits more recent than a specific date. The date format is in approxidate; the same as the format used in git itself. |
-T, --timeline[=BOOL] | Show commit timeline, including author names. the timeline shows a statistical analysis where the amount of changes is calculated in relation to all other changes made by all other authors a specific month. Using the -w option, it is possible to get this output specified in weeks instead. | |
--until=DATE | > 0.2.1 | Show statistics for commits older than a specific date. The date format is in approxidate; the same as the format used in git itself. |
--tda367 | < 0.2.0 | Show statistics and information in a way that is formatted for the course TDA367/DIT211; this parameter equals -lmrTw. |
-w, --weeks[=BOOL] | Show all statistical information in weeks instead of in months. | |
-x, --exclude=PATTERN | An exclusion filtering expression describing patterns that should be excluded from the statistics. Works in the same manner as an inverted grep, meaning that any matched expressions will be excluded from the generated statistics. Refer to the Filtering section about possible expressions. Can be specified multiple times. (New since 0.3.0: Support for regular expressions.) | |
-h, --help | Display this help and exit. | |
--version | Output version information and exit. |
There is support for multiple output formats in gitinspector. An output format can be selected using the -F/--format flags when running the main gitinspector script.
Plain text with some very simple ANSI formatting, suitable for console output. This is the format chosen by default by gitinspector.
HTML with external links. The generated HTML page links to some external resources; such as the JavaScript library JQuery. It requires an active internet connection to properly function. This output format will most likely also link to additional external resources in the future.
HTML with no external links. Similar to the HTML output format, but requires no active internet connection. As a consequence; the generated pages are bigger (as certain scripts have to be embedded into the generated output).
XML suitable for machine consumption. If you want to parse the output generated by gitinspector in a script or application of your own; this is the format you should choose.
Gitinspector offers several different ways of filtering out unwanted information from the generated statistics.
-
gitinspector -x myfile
Filter out and exclude statistics from all files (or paths) with the string "myfile". -
gitinspector -x file:myfile
Filter out and exclude statistics from all files (or paths) with the string "myfile". -
gitinspector -x author:John
Filter out and exclude statistics from all authors containing the string "John". -
gitinspector -x email:@gmail.com
Filter out and exclude statistics from all authors with a gmail account. -
gitinspector -x revision:8755fb33
Filter out and exclude statistics from all revisions containing the hash "8755fb33".
The gitinspector command also lets you add multiple filtering rules by simply specifying the -x option several times or by separating each filtering rule with a comma;
gitinspector -x author:John -x email:@gmail.com
gitinspector -x author:John,email:@gmail.com
Sometimes, sub-string matching (as described above) is simply not enough. Therefore, gitinspector let's you specify regular expressions as filtering rules. This makes filtering much more flexible;
-
gitinspector -x "author:^(?!(John Smith))"
Only show statistics from author "John Smith". -
gitinspector -x "author:^(?!([A-C]))"
Only show statistics from authors starting with the letters "A/B/C". -
gitinspector -x "email:.com$"
Filter out statistics from all email addresses ending with ".com".
Options in gitinspector can be set using git config. Consequently, it is possible to configure gitinspector behavior globally (in all git repositories) or locally (in a specific git repository). It also means that settings will be permanently stored. All the long options that can be given to gitinspector can also be configure via git config (and take the same arguments).
To configure how gitinspector should behave in all git repositories, execute the following git command:
git config --global inspector.option setting
To configure how gitinspector should behave in a specific git repository, execute the following git command (with the current directory standing inside the repository in question):
git config inspector.option setting
If you want to run gitinspector under Windows, there are a few things to consider. Refer to the following page for more information: http://docs.python.org/using/windows.html