Skip to main content

A tool to collect statistics about a git repository over time

Project description

Repotracer: Watch your code changing over time

Repotracer gives you insight into the change going on in your codebase.

It will loop through every day in the history of a git repository, and collect any stat you might ask it to. Eg:

  • Typescript migration: count the number of lines of JS vs TS
  • Count number of deprecated function calls
  • Measure adoption of new APIs

It compiles the results for each day into a csv, and also immediately gives you a plot of the data in csv. It supports incremental computation: re-run it every so often without starting from scratch.

Use it to watch:

  • Percent of commits that touched at least one test, and count of authors writing tests
  • Count number of authors who have used a new library

These are only the beginning. You can write your own stats and plug them into repotracer. If you can write a script to calculate a property of your code, then repotracer can graph it for you over time. For example you could run your build toolchain and counting numbers of a particular warning, or use a special tool.

Repotracer aims to be a swiss army knife to run analytics queries on your source code.

Installation

For now this is a cumbersome affair. A pip install will come soon.

  • Clone this repo
  • Install poetry
  • Run poetry install
  • Now you can run repotracer

Usage

A collection of commands for onboarding will come soon. In the meantime:

  • Copy the sampleconfig.json file to config.json, and update the stats value in the JSON.

  • Add a new repo under repos, and a new stat under that object's stats. ATM the only type of stat is regex_count:

  • Run repotracer run to compute the stat. The data will show up in ./stats/stat_name.csv, and a plot will be written to ./stats/stat_name.png.

Stat types

More documentation about the configuration options will come soon.

  • regex_count runs ripgrep (needs to be installed ahead of time, eg homebrew install ripgrep)
  • The next stat will be script, which will run any bash script the user will want, to allow for max customization.

Stat options

"repos" : {
    "svelte": {
      "url": "", // the url to clone the repo from
      "stats": {
        "count-ts-ignore": { // the name of the stat. Will be used in filenames
          "description": "The number of ts-ignores in the repo.", //Optional. A short description of the stat.
          "type": "regex_count", //
          "start": "2020-01-01", // Optional. When to start the the collection for this stat. If not specified, will use the beginning of the repo
          "params": { // any parameters that depend on the measurement type
            "pattern": "ts-ignore",  //The pattern to pass to rigpgrep
            "ripgrep_args": "-g '!**/tests/*'" // any extra arguments to pass to ripgrep
          }
        },
      }
    }
}
``

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

repotracer-0.2.0.tar.gz (13.7 kB view details)

Uploaded Source

Built Distribution

repotracer-0.2.0-py3-none-any.whl (16.2 kB view details)

Uploaded Python 3

File details

Details for the file repotracer-0.2.0.tar.gz.

File metadata

  • Download URL: repotracer-0.2.0.tar.gz
  • Upload date:
  • Size: 13.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/22.3.0

File hashes

Hashes for repotracer-0.2.0.tar.gz
Algorithm Hash digest
SHA256 d53b36ff662da4acd930f41e8ed337fbaf89074c35c7565f068ebee24bfa8c68
MD5 1b9a407dca10ab6e1b649368a0c2258c
BLAKE2b-256 cb5bd68d18e59044290594ec2ca030cc91f9298d14089288d4d4107f4f3c2985

See more details on using hashes here.

File details

Details for the file repotracer-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: repotracer-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 16.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.6.1 CPython/3.11.4 Darwin/22.3.0

File hashes

Hashes for repotracer-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 204d3460a34767e88f0852c8e4b9d10a336d22cf0bf9465396aa15fc8938861b
MD5 960069dccdf228ba0f591218d8bb4945
BLAKE2b-256 0d16b0bb725ff47ebdcc898a8e23e9f9faebd71787a8c9e8b6cc3ad1c611b2b5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page