5 Essential IntelliJ IDEA Plugins for Automated Java Code Quality Analysis
This article details five IntelliJ IDEA plugins — Alibaba Java Coding Guidelines, CheckStyle, PMD, FindBugs, and SonarLint — covering installation, usage, configuration, and rule sets to automate code review, detect bugs, enforce standards, and improve overall code health in Java projects.
As systems grow in complexity, maintaining code quality becomes critical to prevent instability and business loss. Manual code review is inefficient and error‑prone, so automated static analysis tools integrated into the IDE can significantly reduce review workload while catching defects early. This article introduces five IntelliJ IDEA plugins that address different aspects of code quality.
1. Alibaba Java Coding Guidelines
Overview
Focuses on Java coding standards derived from Alibaba's internal guidelines. It scans code and reports violations at three severity levels: Blocker > Critical > Major. Most issues support auto‑fix, and real‑time inspection runs while you type.
Rule Categories
OOP conventions
Concurrency handling
Control statements
Naming conventions
Constant definitions
Comment standards
Installation
File > Settings > Plugins > Marketplace→ search "Alibaba Java Coding Guidelines" → install → restart IDE.
Usage
Run via Tools > 阿里编码规约 > 编码规约扫描 or right‑click a file/project and choose "编码规约扫描". The results panel groups issues by severity and allows:
Scoping a scan to a selected region to find similar issues across the project.
Previewing the exact non‑compliant code snippet.
Toolbar actions: Rerun Inspection, Expand All / Collapse All, Go Pre/Next Problem, Group by Severity, Group by Directory, Filter resolved items, Autoscroll to Source, Export (XML/HTML), Edit Settings.
2. CheckStyle
Overview
Checks syntactic and stylistic rules: naming, Javadoc, whitespace, method length, duplicate code, unused imports. It operates at the grammar level and has minimal bug‑detection capability.
Default bundles (Sun Checks) are overly strict; the article recommends importing a custom configuration file.
Installation
File > Settings > Plugins > Marketplace→ search "CheckStyle" → install → restart.
Usage
Results show mostly indentation and formatting warnings; the author suggests they can be deprioritized.
3. PMD
Overview
Emphasizes secure coding rules with data‑flow and path analysis. Supports custom rule sets. Built‑in rules cover:
Potential bugs : empty try/catch/finally/switch blocks.
Dead code : unused variables, parameters, private methods.
Suboptimal code : String/StringBuffer misuse.
Complex expressions : unnecessary if, for replaceable by while.
Duplicate code : copy/paste implies copy/paste bugs.
Object creation in loops : avoid instantiating inside loop bodies.
Resource closure : ensure Connection, ResultSet, Statement are closed.
Installation
File > Settings > Plugins > Marketplace→ search "PMDPlugin" → install → restart.
Running
Via Tools > Run PMD (scans whole project) or right‑click a file/directory (scopes to selection). The dialog offers Pre Defined (built‑in rules, including "All") and Custom Rules (imported via settings).
Configuration
File > Settings > Other Settings > PMD→ RuleSets manages custom rule files; Options tab includes Skip TestSource to exclude generated test code (e.g., Android Studio test stubs).
4. FindBugs
Overview
Specializes in detecting runtime bugs: null‑pointer dereferences, unclosed resources, incorrect string comparison ( == vs equals), etc. Provides actionable fix suggestions.
Installation
File > Settings > Plugins > Marketplace→ search "FindBugs" → install → restart.
Usage
Right‑click a file, package, module, or project → "FindBugs". Results panel lists issues categorized as:
Bad practice
Dodgy code
Internationalization
Performance
Experimental
Malicious code vulnerability
Multithreaded correctness
Correctness
Clicking an item jumps to the offending source line.
5. SonarLint
Overview
Operates at a higher level than FindBugs: besides static bugs, it evaluates overall project health — code quality, package/class dependencies, coupling, complexity (class/method/file), copy‑paste density. Available as IDE plugin ( sonarLint) or server‑based platform.
Installation
File > Settings > Plugins > Marketplace→ search "SonarLint" → install → restart.
Local Analysis
Right‑click project/file → analyze. Report shows issues with suggested fixes.
Server‑Bound Configuration
Configure Sonar server : Add connection → Configuration Name, server URL, Login/Password.
Bind project : Choose server connection → Search in list → select target project.
Run bound analysis : Same right‑click flow; additionally, enable Perform Sonarlint analysis in the commit dialog to scan staged changes.
Summary & Recommendations
Coding standards : Use Alibaba Java Coding Guidelines alone.
Bug hunting : Combine PMD, FindBugs, SonarLint for complementary coverage: PMD — strong customization; ideal for project‑specific bug rules. FindBugs — powerful bug detection; findings useful for onboarding/training. SonarLint — richest rule set; covers more scenarios than FindBugs.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
Su San Talks Tech
Su San, former staff at several leading tech companies, is a top creator on Juejin and a premium creator on CSDN, and runs the free coding practice site www.susan.net.cn.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
