R28SAFEfunctionVisibility Widened (Exported)
Flags when a previously internal function becomes exported. The API surface expands, but existing callers are unaffected.
Applies to
TypeScriptPythonGoJavaRust
Why it matters
This is a warning (not truly safe) because exporting a function creates a new backward-compatibility contract. Once consumers depend on it, you cannot unexport it without breaking them.
Example
Before (internal)
// utils.ts
function calculateTax(amount: number): number {
return amount * 0.2;
}After (exported)
// utils.ts (WARNING — now public)
export function calculateTax(amount: number): number {
return amount * 0.2;
}What you see in the terminal
$ npx dg check
[WARNING] calculateTax (visibility_changed)
src/utils.ts:2
Function is now exported. This expands the public API surface and introduces a new backward-compatibility contract.How detection works
The classifier checks if the old signature had exported: false and the new has exported: true.
Real-world scenario
A developer exports a utility function so another module can use it. Nothing breaks, but the team should be aware that this function is now part of the public API and cannot be freely modified.
Edge cases
- In Go, this is lowercase -> uppercase function name
- In Rust, this is adding the pub modifier