---
title: "lint/complexity/no-constant-via-variable"
pagination: false
---

{/* Generated by scripts/gen-rule-docs.py. Edit mapping.toml, not this file. */}

<RuleId id="lint/complexity/no-constant-via-variable" />

In the [`code-quality`](/docs/rules/sets/code-quality) set. Safe fix.

## What it does

Change variable class constant fetch to direct class constant fetch when class or constant target is final

## Configuration

```toml title="pun.toml"
[lint.rules]
"complexity/no-constant-via-variable" = "error"
```

To skip it in some files or lines, add an [override](/docs/configuration/pun-toml#lint) or an [ignore comment](/docs/configuration/ignore-comments).

## Replaces

- [`VariableConstFetchToClassConstFetch`](https://getrector.com/rule-detail/variable-const-fetch-to-class-const-fetch-rector) (rector)

[More lint/complexity rules](/docs/rules/lint/complexity) · [Edit this page](https://github.com/shipfastlabs/pun/edit/main/crates/pun-config/rules/mapping.toml)
