collector_git/

directory
v0.0.1-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 17, 2024 License: Apache-2.0

README

About

An concurrent and efficient Go program which serves to collect Git Repo Metrics for criticality score, based on go-git

Layout

├─cmd
│  ├─Cli                    Cli collector
│  ├─Clone                  Clone repos
│  ├─Collect                Clone and Collect remote repos or Collect local repos
│  ├─CountDownloaded        Count how many of the repos are downloaded
│  └─integrate              CI unit
├─config                    Basic Config file
├─input                     Default input directory
├─internal                  Libraries
│  ├─collector              Collector for git repos
│  ├─io
│  │  ├─database            I/O with database
│  │  └─file                I/O with files like .json, .csv, .yaml
│  ├─logger                 Log runtime message
│  └─parser
│      ├─git                Parser for git repos
│      └─url                Parser for given urls
├─output                    Default output directory
└─storage                   Default storage directory

Quick Start

Configure

Before use the following functions, update your config/config.go

// I/O Config
INPUT_CSV_PATH  string = "./input/input.csv"
OUTPUT_CSV_PATH string = "./output/output.csv"
STORAGE_PATHstring = "./storage"

// Database Config

PSQL_HOST  string = ""
PSQL_USER  string = ""
PSQL_PASSWORD  string = ""
PSQL_DATABASE_NAME string = ""
PSQL_PORT  string = ""
PSQL_SSL_MODE  string = ""

SQLITE_DATABASE_PATH string = "./output/test.db"
SQLITE_USER  string = ""
SQLITE_PASSWORD  string = ""

If needed, you can also update internal/io/database/database.go and internal/parser/parser.go to make further customization.

Cli
./Cli [url]

With this command, collector will collect url and print metrics to standard output

Clone
./Clone [csv_file_path]

The collector will read urls from the csv file and download them.

Collect
./Collect [csv_file_path]

The collector will read urls/path from the csv file and collect metrics from corresponding repo. And the collected metrics will be stored at the database

Directories

Path Synopsis
cmd
Cli
* @Date: 2024-09-06 21:09:14 * @LastEditTime: 2024-12-09 19:31:36 * @Description: The Cli for collector
* @Date: 2024-09-06 21:09:14 * @LastEditTime: 2024-12-09 19:31:36 * @Description: The Cli for collector
Clone
* @Date: 2023-11-11 22:44:26
* @Date: 2023-11-11 22:44:26
Collect
* @Date: 2023-11-11 22:44:26 * @LastEditTime: 2024-12-09 19:32:13 * @Description: Collect Remote / Local Repo
* @Date: 2023-11-11 22:44:26 * @LastEditTime: 2024-12-09 19:32:13 * @Description: Collect Remote / Local Repo
CountDownloaded
* @Date: 2023-11-11 22:44:26 * @LastEditTime: 2024-12-09 19:32:35 * @Description: Just Count downloaded repos
* @Date: 2023-11-11 22:44:26 * @LastEditTime: 2024-12-09 19:32:35 * @Description: Just Count downloaded repos
integrate
* @Date: 2023-11-11 22:44:26 * @LastEditTime: 2024-12-14 16:48:46 * @Description: Integrate into Criticality Score system
* @Date: 2023-11-11 22:44:26 * @LastEditTime: 2024-12-14 16:48:46 * @Description: Integrate into Criticality Score system
* @Author: 7erry * @Date: 2024-08-31 03:44:46 * @LastEditTime: 2024-12-14 16:48:05 * @Description: Config file for the git metrics collector
* @Author: 7erry * @Date: 2024-08-31 03:44:46 * @LastEditTime: 2024-12-14 16:48:05 * @Description: Config file for the git metrics collector
internal
io/database
* @Date: 2024-09-07 20:46:04 * @LastEditTime: 2024-12-14 16:50:00 * @Description: Interact with database
* @Date: 2024-09-07 20:46:04 * @LastEditTime: 2024-12-14 16:50:00 * @Description: Interact with database
io/database/psql
* @Date: 2024-09-07 16:30:21 * @LastEditTime: 2024-11-27 20:22:56 * @Description:
* @Date: 2024-09-07 16:30:21 * @LastEditTime: 2024-11-27 20:22:56 * @Description:
io/database/sqlite
* @Date: 2024-09-07 20:07:35 * @LastEditTime: 2024-12-14 16:37:38 * @Description:
* @Date: 2024-09-07 20:07:35 * @LastEditTime: 2024-12-14 16:37:38 * @Description:
io/file/csv
* @Author: 7erry * @Date: 2024-12-13 20:57:15 * @LastEditTime: 2024-12-14 16:42:50 * @Description:
* @Author: 7erry * @Date: 2024-12-13 20:57:15 * @LastEditTime: 2024-12-14 16:42:50 * @Description:
io/file/json
* @Date: 2024-09-07 20:06:02 * @LastEditTime: 2024-12-14 16:43:08 * @Description:
* @Date: 2024-09-07 20:06:02 * @LastEditTime: 2024-12-14 16:43:08 * @Description:
io/file/yaml
* @Date: 2024-09-07 20:06:11 * @LastEditTime: 2024-12-14 16:43:23 * @Description:
* @Date: 2024-09-07 20:06:11 * @LastEditTime: 2024-12-14 16:43:23 * @Description:
logger
* @Author: 7erry * @Date: 2024-10-10 11:55:09 * @LastEditTime: 2024-12-14 16:50:32 * @Description: Log with logrus
* @Author: 7erry * @Date: 2024-10-10 11:55:09 * @LastEditTime: 2024-12-14 16:50:32 * @Description: Log with logrus
parser/url
* @Author: 7erry * @Date: 2024-09-29 14:41:35 * @LastEditTime: 2024-12-14 16:30:24 * @Description: Parse Input to make sure the provided URL is correct
* @Author: 7erry * @Date: 2024-09-29 14:41:35 * @LastEditTime: 2024-12-14 16:30:24 * @Description: Parse Input to make sure the provided URL is correct

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL