gohorse-score
v0.1.0
Published
Lightweight CLI tool that scans Java repositories and produces a legacy modernization diagnostic report
Maintainers
Readme
🐎 GoHorse Score
GoHorse Score is a lightweight CLI tool that scans Java repositories and produces a legacy modernization diagnostic report.
It helps engineers and architects understand:
- how outdated the stack is
- architectural risks
- structural hotspots
- CRUD coverage and feature complexity
- shared dependencies and coupling
- testing maturity
The tool runs offline and never uploads code.
Inspired by the famous Brazilian engineering philosophy:
"Go Horse Programming" 🐎
Why this tool exists
Many enterprise Java systems accumulate years of technical debt.
Common symptoms:
- giant classes
- legacy frameworks
- missing tests
- tightly coupled dependencies
- incomplete CRUDs scattered everywhere
GoHorse Score gives a quick architectural diagnosis.
Example
🐎 GoHorse Score
GoHorse Score: 42 / 100 (higher = worse)
Classification: Smelly
Key Findings
• Java 8 runtime detected
• 37 classes larger than 1000 lines
• Controllers calling repositories directly
• Test coverage extremely lowInstallation
Run directly with npx:
npx gohorse-scoreOr install globally:
npm install -g gohorse-scoreUsage
From the root of a Java repository:
gohorse-scoreOptional:
gohorse-score --path ./project
gohorse-score --catalog ./version-catalog.json
gohorse-score --parent-pom ../parent/pom.xmlOutput
The scanner generates:
legacy-report/
summary.md
details.json
hotspots.md
entity-graph.mmd
tests.mdMetrics Analyzed
Stack & Frameworks
Detects:
- Java version
- Spring Boot
- Hibernate (including XML configs, HBM mappings, dialects)
- Quarkus
- Java EE / Jakarta
- JSF
- EJB
- Struts
- Database (via JDBC drivers and Hibernate dialect)
- web.xml (servlets, filters, servlet API version)
Modules / Features
Detects controllers and modules by:
- Annotations:
@RestController,@Controller,@Path,@ManagedBean,@Named - Class name conventions:
*Controller,*Resource(covers legacy projects without annotations) - Struts: classes ending with
Action
For each module, reports endpoint count, type (REST/JSF/Struts/other), and injected services.
CRUD Detection
Identifies CRUD operations per controller using two strategies:
REST controllers — detected via HTTP verb annotations:
| Annotation | Operation |
|---|---|
| @PostMapping / @POST | Create |
| @GetMapping / @GET | Read |
| @PutMapping / @PatchMapping / @PUT / @PATCH | Update |
| @DeleteMapping / @DELETE | Delete |
JSF / Struts / Legacy controllers — detected via method name patterns (PT-BR + EN):
| Operation | Method name patterns |
|---|---|
| Create | save, insert, create, register, persist, store, cadastrar, salvar, inserir, adicionar, registrar, gravar, novo, criar |
| Read | get, find, fetch, load, list, search, query, read, show, buscar, consultar, listar, pesquisar, carregar, exibir, mostrar, obter, detalhar |
| Update | update, edit, modify, patch, change, put, merge, alterar, atualizar, editar, modificar, corrigir |
| Delete | delete, remove, destroy, drop, purge, excluir, remover, deletar, apagar, inativar |
Each controller gets:
- CRUD completeness: full (C+R+U+D), partial, or none
- Complexity: low, medium, or high (based on endpoints, injected services, and line count)
Shared Dependencies
Aggregates service dependencies across all controllers to identify:
- Highly coupled services — used by many controllers
- Cross-cutting concerns — audit, notification, logging services
- Critical dependencies — high blast radius on changes
Detected dependency suffixes (case insensitive):
*Service, *ServiceImpl, *BO, *DAO, *Facade, *Manager, *Helper, *Bean, *Delegate, *Repository, *Controle
Supports injection detection via:
@Autowired,@Inject(field and setter)- Constructor injection
@EJB@ManagedProperty(JSF)- Field type matching (covers XML-wired Spring/Java EE projects with no annotations)
Code Complexity
Detects:
- large classes (> 1000 lines)
- large methods (> 120 lines)
- code hotspots (risk score = lines x imports)
Architecture Violations
Detects:
- controllers calling repositories directly (layering violation)
@Transactionalin wrong layers
Entity Model
Detects JPA entities and relationships:
@Entity@OneToMany@ManyToOne@ManyToMany@OneToOne
Generates entity relationship graph (Mermaid).
Testing
Detects:
- test presence
- test ratio
- test frameworks
Frameworks detected:
- JUnit
- Mockito
- Spring Test
- Testcontainers
- RestAssured
Dependency Status
Checks project dependencies against a version catalog to identify:
- Current versions
- Outdated versions
- End-of-life (EOL) dependencies
GoHorse Score
Score starts at 0 and increases with each issue found.
Higher score = more technical debt.
Penalties added for:
- old Java versions (< 11: +15, < 17: +8)
- legacy frameworks (Struts: +10)
- old Servlet API (< 3.0: +10, < 4.0: +5)
- large classes (+1 each, max 15)
- large methods (+1 each, max 10)
- missing tests (+15) or low test ratio (+10)
- layering violations (+8)
@Transactionalmisuse (+5)- legacy HBM XML mappings (up to +8)
- EOL dependencies (up to +25)
- outdated dependencies (up to +10)
Score Levels
| Score | Classification | |-------|---------------| | 0–20 | Clean | | 21–40 | Acceptable | | 41–60 | Smelly | | 61–80 | GoHorse | | 81–100 | Extreme GoHorse |
Philosophy
This tool intentionally avoids:
- heavy static analysis
- compilation
- dependency resolution
- AI analysis
Instead it focuses on fast architectural heuristics.
Roadmap
Future improvements may include:
- HTML dashboard
- CI integration
- deeper dependency analysis
- modernization roadmap generator
License
MIT
Disclaimer
This tool is intended for diagnostic purposes only.
It does not replace architectural review by experienced engineers.
