$ show phodal/coca
coca is a static code analysis and refactoring CLI tool written in Go, designed to assess code quality, detect bad smells, analyze dependencies, and support migration tasks (specifically Spring MVC to Spring Boot). It operates as a monolithic command-line application using the Clean Architecture pattern, with distinct layers for domain models, application logic, and infrastructure. The tool supports multiple languages including Java, Go, Python, JavaScript, TypeScript, and Groovy, leveraging ANTLR for parsing and generating ASTs for analysis. The system's primary function is to scan codebases for technical debt, architectural issues, and API definitions, outputting results in various formats (JSON, CSV, Graphviz). It includes features for bad smell detection (e.g., Long Method, Large Class), test smell analysis, and dependency usage evaluation. The architecture is modular, allowing individual analysis features to be executed independently, though the tool itself is a single binary. While the codebase demonstrates solid engineering practices with a clean separation of concerns and reusable domain models, it exhibits technical drift in its dependency ecosystem. The Go version specified (1.23) is ahead of current stable releases, and several core dependencies (e.g., spf13/cobra, gomega) are significantly outdated, creating a mismatch between the code's stated requirements and the available ecosystem versions. This suggests the project is either in a transitional state or relies on specific, potentially unstable, dependency versions.
The LLM identified 3 files worth highlighting for reuse:
This directory defines the core domain models used across the application, such as CodeDataStruct, CodeFunction, and CodeCall. These structures provide a unified representation of code entities regardless of the source language (Java, Go, Python, etc.), enabling language-agnostic analysis logic. This abstraction is a key reusable pattern for any tool requiring cross-language code understanding.
Contains the Go-specific AST parsing infrastructure, including the parser and builder implementations. This module demonstrates the skill required to integrate ANTLR with Go's type system to create a robust parsing layer. It serves as a reference implementation for adding support for other languages within the tool's architecture.
Implements the logic for detecting code bad smells (e.g., Long Method, Large Class, Data Class). This component encapsulates specific quality rules and thresholds, making it a reusable module for any static analysis tool focused on code quality metrics. It demonstrates how to translate abstract quality rules into concrete code analysis logic.