Git Repository CLOC API

June 12, 2025 ยท View on GitHub

A FastAPI service that provides code metrics for Git repositories using CLOC (Count Lines of Code).
Originally developed by Stefano Campanella in the REVEAL group.

Note


This project is designed to work as a submodule for a larger project. It is not intended to be used as a standalone application. The API endpoints and functionality are tailored for integration into a larger system. You can find the main project here.

Overview

This service exposes an API that allows users to analyze a Git repository at a specific commit and obtain code metrics such as:

  • Number of blank lines
  • Number of comment lines
  • Number of code lines
  • Statistics broken down by file

Prerequisites

  • Docker

Quick Start

Build the Docker Image

docker build -t cloc-api .

Run the Docker Container

docker run -d -p 8080:8080 cloc-api