How jubenitezg/go-clone-thesis works
Project’s Purpose and Type
• Purpose: The project supports a master thesis study on “Code cloning in Go open source projects” by mining GitHub repositories, extracting code metadata (like abstract syntax trees and functions), and then performing clone detection and topic analysis.
• Project Type: It is a research and data-processing pipeline that includes data collection, static code analysis, and machine learning / topic modeling components. There is a significant emphasis on extracting code fragments and analyzing similarities between them.
File Structure
• Top-Level Modules/Subprojects:
• GitHubMiner: Contains scripts (e.g., index.js, command.sh) for collecting repository data. It outputs files in CSV/JSON from mining GitHub.
• ast-builder: A Go-coded component that builds AST representations from source code. It includes tests and utilizes constants, nodes, and extractor logic.
• function-extractor: Another Go project that focuses on extracting functions (or code fragments) from the source code. It includes common utilities, test assets, and tests.
• metadata-extraction: A module (written in Go) responsible for collecting metadata from repositories, outputting processed JSON and tracking skipped files.
• repositories-function-extraction: Uses shell scripts and helpers to count and extract repository functions.
• clone-detection: Contains several Python scripts and Jupyter Notebooks for analyzing clone detection data, computing clone density, similarities, and correlations.
• topic-analysis: Comprises multiple methods for topic modeling including submodules for bertopic, description extraction, and LDA analysis with its own set of notebooks and configuration files.
• utils: A set of Python utility scripts that support various extraction and upload tasks.
• Configuration & CI/CD: The .github directory with multiple workflow YAML files and linting configurations in .golangci.yml files in various modules indicate automated testing and code quality checks.
• Main Components:
• Data Collection Module: Represent GitHubMiner as the starting point for collecting Go repositories from GitHub.
• Code Extraction Modules: Group ast-builder and function-extractor as components responsible for parsing source code and building ASTs / extracting relevant function data.
• Metadata and Repository Analysis: Include metadata-extraction and repositories-function-extraction, which extract and aggregate additional details.
• Clone Detection Analysis: Capture clone-detection as the component where processed code data is analyzed for clone types (Exact, Renamed, Near miss, Semantic).
• Topic Modeling & NLP Analysis: Represent topic-analysis (subdivided into bertopic, description extraction, and LDA) for deriving insights and topics from textual metadata or clone patterns.
• CI/CD / Quality Assurance: Note the presence of GitHub Actions workflows for testing and linting as part of the development operations.
• Relationships & Data Flow:
Architectural Patterns and Design Principles
• Modularity: Each subproject is a self-contained module with its own responsibilities, tests, and configurations.
• Pipeline Architecture: The system can be viewed as a sequential pipeline—from data collection to extraction and finally, data analysis.
• Interoperability: Components are implemented in different languages (Go, Node.js, Python) but interoperate through file-based outputs (CSV, JSON) and scripts.
• CI/CD integration: The inclusion of GitHub workflows that automate testing and linting is also an important part of the system's operational design.
• A separate container or notation for CI/CD integrations (.github workflows) that monitors code quality.
• Data is harvested via GitHubMiner,
• Source code is processed (AST & function extraction) by dedicated Go-based modules,
• Additional metadata and repository function count is collected,
• Clone detection analysis is performed using Python notebooks,
• And finally, topic analysis is applied to derive insights from the aggregated data.
This detailed view will help capture the essential architecture, making it easier for the principal software engineer to understand the distinct responsibilities, dependencies, and technologies used across this multifaceted research project.