Skip to content

Commit 0379fbd

Browse files
committed
formatting
1 parent 104ba55 commit 0379fbd

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

website/src/pages/en/subgraphs/guides/subgraph-linter.mdx

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,14 @@ It complements existing tools by helping you catch problems locally while writin
99

1010
## When to use it
1111

12-
Run Subgraph Linter when you want to detect handler and mapping issues that don't often appear until indexing starts, such as:
12+
Run Subgraph Linter when you want to detect handler and mapping issues that don't often appear until indexing starts, such as:
1313

1414
- Entities saved with missing required fields
1515
- Entity overwrite issues from concurrent/stale instances
1616
- Optional values force-unwrapped without checks
1717
- Divisions without guaranteeing a non-zero denominator
1818
- `@derivedFrom` fields mutated directly or left stale
19-
- Contract calls are used without being declared in the manifest
20-
These bugs usually compile fine, but crash at runtime or silently produce incorrect data. Subgraph Linter performs static analysis on your mapping code to detect these issues before deploying the subgraph.
19+
- Contract calls are used without being declared in the manifest These bugs usually compile fine, but crash at runtime or silently produce incorrect data. Subgraph Linter performs static analysis on your mapping code to detect these issues before deploying the subgraph.
2120

2221
## How it works
2322

@@ -38,7 +37,7 @@ Subgraph Linter currently detects the following categories of issues:
3837
- `entity-overwrite`: Detects cases where a handler works with an entity instance that becomes stale after calling a helper (or other code path) that loads and saves the same entity, and then the handler saves its stale instance and overwrites those updates.
3938
- `unexpected-null`: Detects when entities may be saved in an invalid state—either because required fields weren’t initialized before `save()`, or because code attempts to assign to `@derivedFrom` fields.
4039
- `unchecked-load`: Detects risky patterns where `Entity.load(...)` is treated as always present (for example via `!`) instead of explicitly handling the case where the entity doesn’t exist yet.
41-
- `unchecked-nonnull`: Detects risky non-null assertions on values that can be missing at runtime, and encourages explicit guards instead of assuming the value is always set.
40+
- `uncheckednonnull-`: Detects risky non-null assertions on values that can be missing at runtime, and encourages explicit guards instead of assuming the value is always set.
4241
- `division-guard`: Detects divisions where the denominator may be zero on some execution paths, and suggests guarding the value before dividing.
4342
- `derived-field-guard`: Detects cases where code updates “base” fields that require derived recomputation, but then saves without the helper(s) that keep derived values consistent.
4443
- `helper-return-contract`: Detects helper functions that can return entities without fully initializing required fields, and flags call sites where the returned entity is used/saved without completing initialization.
@@ -79,7 +78,7 @@ You can also provide an explicit config file:
7978
npm run check -- --manifest ../your-subgraph/subgraph.yaml --config ./subgraph-linter.config.json
8079
```
8180

82-
*Configuration note:* Subgraph Linter supports configurable severities per check. By default, checks have sensible severities, but you can override them to match your project’s tolerance. Only checks with effective severity `error` cause a non-zero exit code; warnings-only runs exit successfully.
81+
_Configuration note:_ Subgraph Linter supports configurable severities per check. By default, checks have sensible severities, but you can override them to match your project’s tolerance. Only checks with effective severity `error` cause a non-zero exit code; warnings-only runs exit successfully.
8382

8483
#### Configuration (severity overrides and suppression)
8584

0 commit comments

Comments
 (0)