Inspection results mismatch in IntelliJ IDEA vs. inspectCode CLI
0 reputation · 14 Sept 2026, 10:15 UTC
0 reputation · 14 Sept 2026, 10:15 UTC
When running code inspections locally in IntelliJ IDEA, the output often differs from the results produced by the standalone inspectCode command‑line tool. The local IDE uses the project’s .idea configuration and the current inspection profile, while the CLI relies on the supplied config.xml and the environment’s classpath. This inconsistency can lead to false positives or missed warnings in continuous‑integration pipelines.
The goal is to achieve a deterministic, environment‑agnostic inspection outcome. However, the following uncertainties remain:
What specific factors cause the discrepancy in inspection results between the local IDE and the inspectCode CLI tool, and how can they be aligned for consistent CI/CD validation?
34775 reputation · 14 Sept 2026, 11:04 UTC
Assumption: inspectCode is the JetBrains IntelliJ command-line inspection tool, and the IDE and CLI are from the same major version family. The mismatch is usually caused by different inputs to the same inspection engine, not by different inspection logic. IntelliJ IDEA applies the active profile from .idea/inspectionProfiles, project-specific severity and suppression overrides, the open project module graph, SDK, language level, roots, exclusions, encoding, and loaded plugins. inspectCode applies the profile or config passed to it, the project root and classpath it resolves, and the plugins available in that headless installation. Missing dependencies can make symbol-resolving inspections report unresolved-reference false positives or skip downstream checks, and scope differences can make a whole-project CLI run look noisier than a changed-file IDE run.
| Factor | Effect | Alignment action |
|---|---|---|
| Inspection profile | Different enabled rules, severities, or suppressions | Export the active IDE profile to XML, commit it, and pass it explicitly to inspectCode |
| Scope | IDE may inspect changed files; CLI may inspect whole project | Run a full-project IDE inspection with the same profile and scope as CLI |
| JDK and language level | API and language-level inspections change with runtime | Use the same project SDK/JDK and language level in IDE and CI |
| Classpath and modules | Missing modules, generated sources, test roots, or exclusions change symbol resolution | Match .idea/.iml module dependencies, source/test/resource roots, and exclusions |
| Plugins and language support | Kotlin, JavaScript, database, or framework inspections may be absent headless | Enable the same plugin set or restrict comparison to inspections present in both |
| Encoding | File encoding affects inspections that read non-ASCII content | Set the same project and file encoding in CI |
List enabled inspections and plugin versions in both environments if results still differ. CLI flags and plugin-loading behavior are version-sensitive, so check them against your installed inspectCode rather than assuming they match the desktop IDE.
Are the same bundled and third-party plugins enabled in the headless inspectCode run as in the desktop IDE? This changes the recommendation because a different plugin set changes which rules exist, so you may need to align plugins or exclude plugin-specific rules from the comparison.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.