/plugadvpl:metrics

Rank ADVPL/TLPP functions by maintainability using McCabe complexity and related metrics.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/JoniPraia/plugadvpl --skill plugadvpl-metrics
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: /plugadvpl:metrics
Source: https://github.com/JoniPraia/plugadvpl/tree/main/skills/metrics
Command: npx skills add https://github.com/JoniPraia/plugadvpl --skill plugadvpl-metrics

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Ajuda você a identificar quais funções do seu código ADVPL/TLPP estão mais complexas e caras de manter, para saber por onde começar um refactor sem depender de achismos.

Core Features & Use Cases

  • Ranking por complexidade (McCabe): calcula cc (1 + decisões por If/ElseIf/While/For/Case/Catch/IIf) para priorizar risco e dificuldade.
  • Métricas complementares: coleta loc, nesting (profundidade), n_calls_out (fan-out/chamadas) e params_count (quantidade de parâmetros), além de has_doc (presença de header Protheus.doc).
  • Casos de uso práticos: encontrar funções “grandes” para quebrar, priorizar refactors onde há alta ramificação e pouca documentação, e comparar qualidade entre fontes.

Quick Start

Peça para listar as 10 funções mais complexas do projeto: /plugadvpl:metrics --sort cc

Frequently Asked Questions about /plugadvpl:metrics

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I rank ADVPL functions by cyclomatic complexity to prioritize refactoring?

Rank ADVPL functions by cyclomatic complexity to prioritize refactoring by computing McCabe complexity alongside LOC, nesting depth, fan-out, and parameter count to identify high-maintenance functions. The tool parses decision constructs like If/ElseIf/While/For/Case and outputs sortable lists.

What ADVPL metrics are needed to identify large functions for breaking down?

ADVPL metrics needed to identify large functions include lines of code, nesting depth, fan-out calls, parameter count, and header documentation presence. These combined metrics highlight functions with high ramification and low documentation that are prime candidates for decomposition.

Can I calculate code quality metrics for a single .prw file in an ADVPL project?

Yes, you can calculate code quality metrics for a single .prw file or across a whole ADVPL project. The tool parses function boundaries and caches the computed metrics, allowing you to apply threshold filters to target specific files or scan the entire codebase.

How do I find the most complex TLPP functions in my codebase without manual review?

Find the most complex TLPP functions by sorting the computed metrics output by cyclomatic complexity. This automatically ranks functions based on decision constructs and structural factors, eliminating guesswork and highlighting where maintenance risks are highest.

Does the ADVPL metrics analysis check for Protheus.doc documentation presence?

Yes, the ADVPL metrics analysis checks for Protheus.doc header documentation presence. It evaluates the has_doc flag alongside structural metrics like nesting and fan-out to prioritize refactoring efforts on complex functions lacking proper documentation.

What is the best way to triage ADVPL refactoring targets across a full project?

The best way to triage ADVPL refactoring targets is by ranking functions using combined metrics including cyclomatic complexity, LOC, and nesting depth. This approach processes the entire project to produce a sortable output with optional threshold filters for targeted triage.