PSI and Architecture IntelliJ IDEA 8 min read

Building custom IntelliJ PSI code inspection rules for internal standards

External CLI linters only catch violations in CI, 15 minutes after an engineer opened a pull request. Custom IntelliJ PSI inspections highlight internal API misuse, forbidden annotations, and unsafe SQL patterns right in the editor with one-click quick fixes.

Engineering context

Why local IDE checks beat late CI failures

Applies to IntelliJ Platform 2025.2+ through 2026.3+.

Teams often try to wrap slow regex scripts or shell commands as IDE plugins. Those freeze the Event Dispatch Thread (EDT) and get uninstalled by engineers within a week. Native LocalInspectionTool classes walk IntelliJ's pre-indexed Program Structure Interface (PSI) tree in background read actions, staying fast even across 500,000-line monorepos.

Skip months of PSI threading trial and error. Commission an Architecture and Security Blueprint ($12,000, 100% credited to build) or a Custom JetBrains Plugin from $70,000 fixed scope.

Implementation walkthrough

Four-step production setup

Tested against JetBrains Plugin Verifier and offline enterprise policies.

1

Target the exact PSI element type

Inspect your internal pattern with IntelliJ's PSI Viewer first. Match specific PsiMethodCallExpression, KtCallExpression, or YAMLKeyValue nodes instead of scanning raw document text.

2

Implement LocalInspectionTool with a quick fix

Register the rule in plugin.xml under localInspection with a clear groupName and defaultLevel. Pair every warning with a LocalQuickFix so engineers fix the issue with Alt+Enter.

3

Guard read actions and avoid heavy resolve calls

Keep visitor callbacks lightweight. Check cheap name and qualifier strings before invoking full type resolution so typing latency stays under 10 milliseconds.

4

Verify with LightJavaCodeInsightFixtureTestCase and Plugin Verifier

Write JUnit fixture tests with highlighted caret markers and run Gradle verifyPlugin against 2025.2+ and 2026.x snapshots so platform upgrades don't break your rules.

plugin.xml (registering a local PSI inspection)
<extensions defaultExtensionNs="com.intellij">
  <localInspection
      language="kotlin"
      shortName="InternalDeprecatedClient"
      displayName="Deprecated internal RPC client usage"
      groupName="Company Platform"
      enabledByDefault="true"
      level="WARNING"
      implementationClass="com.company.inspections.DeprecatedClientInspection"/>
</extensions>

Plugins referenced in this guide

More IntelliJ IDEA plugins

Spring Properties Guard icon

Spring Properties Guard

com.notemods.spring-properties-guard
Queued Proxy and Dev Tools

Parse Spring Boot application.properties files, detect duplicate keys, and block unsafe production defaults inside your JetBrains IDE.

Gradle Dependency Guard icon

Gradle Dependency Guard

com.notemods.gradle-dependency-guard
Queued Proxy and Dev Tools

Parse build.gradle and build.gradle.kts dependencies and repositories, catch dynamic versions, SNAPSHOT leaks, and insecure HTTP repos inside your JetBrains IDE.

Agent Diff Gate icon

Agent Diff Gate

com.notemods.agent-diff-gate
Live ID 36698 AI and Agents

Review, guard, and revert external file edits made by AI coding agents outside your JetBrains IDE.

Git Commit Gate icon

Git Commit Gate

com.notemods.git-commit-gate
Live ID 36776 Security and CI

Validate Conventional Commit messages, block WIP or fixup commits, enforce ticket references, and group release changelogs inside your JetBrains IDE.

FREEMIUM Native JetBrains Marketplace licensing

$29/yr Personal · $59/yr Org (30-day free trial, zero telemetry)

Core parsers and sidebar inspectors stay free forever with no account required. Upgrade inside JetBrains Marketplace for deep security audits, secret leak scanners, breaking-change guards, and JSON or Markdown report exports. Need a private air-gapped plugin or custom PSI inspection engine for your company?

Related JetBrains engineering guides

View all 65 guides