/>
PricingDownload
Product

Platform

All features44 capabilities, from IDE to CICompliance KitsISO 26262, DO-178C, IEC 62304...AI GovernanceControl AI-generated C/C++ codeWhat’s new in 2027Latest version highlightsScreenshotsSee the product in action

Analyze & improve

Coding standardsMISRA, CERT, CWE, AUTOSARArchitecture & dependenciesGraphs, matrix, cyclesTechnical debtMeasured in hours and dollarsQuality gatesStop regressions in CISmart Code CityYour codebase in 3D

Integrations

IDE pluginsVisual Studio, VS Code, CLion...CI/CD pipelinesJenkins, Azure DevOps, GitHub, GitLabSonarQube pluginC/C++ results in SonarQubeExternal analyzersClang-Tidy, Cppcheck, coverageFeature on Demand
Solutions

By need

Functional safetyCompliance kits per standardCoding standardsMISRA, CERT, AUTOSAR, ISO...Legacy modernizationRefactor large C/C++ safelyCode auditExpert review of your codebaseM&A due diligenceAssess technical health fast

By role

DevelopersSoftware architectsTech leadsDevOps engineersEngineering managersProject managers

CTOsCIOs / IT leadersQA engineersSecurity leadersComplianceConsultantsRequest a guided PoC
Industries

Safety-critical

AutomotiveISO 26262, MISRA, AUTOSARAerospace & DefenseDO-178C programsMedical DevicesIEC 62304 softwareEnergy & UtilitiesIEC 61508 systemsEmbedded SystemsFirmware and devices

Enterprise

Financial ServicesTrading and paymentsGame DevelopmentEngines and large C++Software VendorsCommercial C/C++ productsGovernmentAgencies and contractorsAll industries & case studies
Resources

Learn

DocumentationGuides, rules and CI setupKnowledge baseFrequently asked questionsBlogC and C++ code quality articlesRelease notesEvery version since 2009

Customers

Case studiesSuccess storiesTestimonialsWhat users sayOur customersCompanies using CppDependGold Code QualityOpen source projects we rate

Programs & company

Feature on DemandMissing features built for freeFree for open sourceLicenses for OSS and studentsContact usSales and supportEULALicense agreement
Docs
Documentation

PRQL & Code Query

PRQL Quick Reference

37 ready-to-use PRQL code queries, organized in 9 categories — copy them straight into the CppDepend query editor.

4 min readPRQL & Code QueryCppDepend 2027

How to use this reference

Each query below is a complete, runnable PRQL query. Click Copy to copy a query to your clipboard, paste it into the CppDepend query editor, and run it against your codebase. Use the search box to filter queries by name.

New to the language? Start with the PRQL overview and the Validating PRQL Rules guide.

No query matches your search.

Basic Queries

Get my public methods
from m in JustMyCode.Methods where m.IsPublic 
select m
Get my abstract classes
from t in JustMyCode.Types where t.IsAbstract 
select t
Get my generic classes
from t in JustMyCode.Types where t.IsGeneric 
select t
Get all struct definitions
from t in Application.Types where t.IsStructure
select t

Code Implementation Queries

Get complex methods
from m in Methods where m.CyclomaticComplexity>15
select new{m,m.CyclomaticComplexity}
Get big types
from t in Types where t.NbLinesOfCode>500
select new {t,t.NbLinesOfCode}
Get not maintainable methods
from m in JustMyCode.Methods where m.MaintainabilityIndex<40
select new {m,m.MaintainabilityIndex}
Get methods with too many parameters (>5)
warnif count > 0
from m in Application.Methods 
where m.NbParameters > 5 
select new { m, m.NbParameters }

Architecture & C++ Safety Rules

Detect cyclic dependencies between namespaces
warnif count > 0 
from n in Application.Namespaces
where n.DepthOfIsUsing(n) > 0
select new { Namespace = n, CyclicDependencies = n.NamespacesUsed.Where(n2 => n2.DepthOfIsUsing(n) > 0) }
Detect classes with virtual methods missing virtual destructors
warnif count > 0
from t in Application.Types
where t.IsClass && t.Methods.Any(m => m.IsVirtual) && !t.Methods.Any(m => m.IsDestructor && m.IsVirtual)
select new { MissingVirtualDestructorIn = t }
Find public fields using raw pointers
warnif count > 0
from f in Application.Fields
where f.IsPointer && !f.IsConst && f.IsPublic
select new { UnsafePublicPointerField = f }
Detect direct UI access to Low-Level Storage layer
warnif count > 0
let uiMethods = Application.Namespaces.WithNameLike("UI").ChildMethods()
let storageMethods = Application.Namespaces.WithNameLike("Storage").ChildMethods()

from m in uiMethods
where m.IsUsing(storageMethods)
select new { IllegalCallFrom = m, Target = m.MethodsCalled.Intersect(storageMethods) }

Issues & Technical Debt

Get high severity issues
from issue in Issues where issue.Severity==Severity.High
select issue
Get debt of medium issues
from issue in Issues where issue.Severity==Severity.Medium
select new{issue,issue.Debt}
Get issues in public generic methods
from issue in Issues where issue.CodeElement!=null &&
 issue.CodeElement.AsMethod!=null  && issue.CodeElement.AsMethod.IsPublic && issue.CodeElement.AsMethod.IsGeneric 
select new{issue,issue.Debt}
Top 10 code elements with highest technical debt
from issue in Issues 
orderby issue.Debt descending 
select new { issue.CodeElement, issue.Debt, issue.Severity }
Technical debt of most coupled methods
from m in Application.Methods 
where m.NbMethodsCalled > 10 
let debt = m.Issues.Sum(i => i.Debt) 
orderby m.NbMethodsCalled descending 
select new { 
    Method = m, 
    CouplingCount = m.NbMethodsCalled, 
    TotalDebt = debt, 
    IssueCount = m.Issues.Count() 
}

Issues Diff Queries

Get new issues
from issue in Issues where issue.WasAdded()
select new {issue,issue.Debt}
Get fixed issues
from issue in IssuesInBaseline where issue.WasFixed()
select new {issue,issue.Debt}
Get new violated rules
from rule in Rules where rule.IsInNewerIssuesSet() && !rule.IsInOlderIssuesSet()
select rule
Newly introduced high complexity methods in current commit
warnif count > 0
from m in Application.Methods 
where m.WasAdded() && m.CyclomaticComplexity > 10
select new { NewComplexMethod = m, m.CyclomaticComplexity }

Code Design Queries

Get most coupled methods
from m in Methods where m.NbMethodsCalled>10 orderby m.NbMethodsCalled descending
select new{m,m.NbMethodsCalled}
Get not cohesive types
from t in JustMyCode.Types where t.LCOM > 0.8  && 
  t.NbFields > 10 &&   t.NbMethods >10 select t
Get classes with many base classes
from t in Types where t.BaseClasses.Count()>4
select t
Types with excessive Efferent Coupling (>20 used types)
from t in Application.Types 
where t.TypesUsed.Count() > 20 
select new { Type = t, CouplingCount = t.TypesUsed.Count() }

Code Diff Queries

Get added methods
from m in Methods where m.WasAdded()
select m
Get removed public methods
from m in codeBase.OlderVersion().Application.Methods where m.IsPublic && m.WasRemoved()
select m
Get changed generic classes
from t in Types where t.isGeneric &&  t.WasChanged()
select t
Methods where LOC grew significantly (>30 LOC)
warnif count > 0
from m in Application.Methods
where m.IsCodeModified() && (m.NbLinesOfCode - m.OlderVersion().NbLinesOfCode) > 30
select new { m, CurrentLOC = m.NbLinesOfCode, OldLOC = m.OlderVersion().NbLinesOfCode }

Dependencies & API Tracking

Get methods used by complex methods
from m in Methods where m.MethodsCallingMe.Where(m=>m.CyclomaticComplexity>15).Any()
select new{m,m.MethodsCallingMe}
Get methods using complex methods
from m in Methods where m.MethodsCalled.Where(m=>m.CyclomaticComplexity>15).Any()
select new{m,m.MethodsCalled}
Get methods using the Windows API
from m in Methods where m.MethodsCalled.Where(m=>m.ParentProject.Name=="Windows SDK").Any()
select new{m,m.MethodsCalled.Where(m=>m.ParentProject.Name=="Windows SDK")}
Find all methods directly or transitively calling raw allocators (malloc)
let rawAllocators = ThirdParty.Methods.WithSimpleName("malloc")
from m in Application.Methods
where m.DepthOfIsUsing(rawAllocators) >= 1
select new { CallerMethod = m, Depth = m.DepthOfIsUsing(rawAllocators) }

Statistics & Metrics

Get most popular methods
from m in Methods where m.NbMethodsCallingMe>20 orderby m.NbMethodsCallingMe descending 
select new{m,m.NbMethodsCallingMe}
Get most big classes
from t in Types where t.NbLinesOfCode>400 orderby t.NbLinesOfCode 
select new{t,t.NbLinesOfCode}
Get most used classes
from t in Types where t.NbTypesUsingMe>10 orderby t.NbTypesUsingMe 
select new{t,t.TypesUsingMe}
Top 10 dead code candidates (unused private methods)
from m in Application.Methods
where m.IsPrivate && m.NbMethodsCallingMe == 0 && !m.IsMain
select new { UnusedMethod = m, m.NbLinesOfCode }
Was this page helpful?
Evaluating CppDepend on a production codebase?Get a guided proof of concept with our static analysis architects.
Request a PoC