JavaFormatter Free Online Java Formatter
Best Practices

Java Code Review Checklist: Formatting

2026-08-03 · 5 min read
Java Code Review Checklist: Formatting Code reviews should focus on logic, design, and correctness. Formatting should be automated so reviewers spend zero time on it. If your team does not have an automated formatter, use this checklist to spot formatting issues quickly. Before the Review Run the Java Formatter on every changed file. Paste the file content, click Format, and compare the output with what is in the pull request. If the formatter changes anything, ask the author to apply formatting before you continue the review. This eliminates whitespace noise from the diff. During the Review: Formatting Checks Indentation. Every block should be indented 4 spaces from its parent. Look for blocks at the wrong depth. The formatter catches these, but spot-check a few methods. Brace placement. Opening braces on the same line as if, for, while, and method declarations. Closing braces aligned with the start of the block they close. This takes two seconds to verify on each file. Import organization. No wildcard imports (import java.util.*). Standard library imports first (java.*, javax.*), then third-party, then project imports. Sorted alphabetically within each group. Line length. Lines over 120 characters should be rare and justified. If half the lines in a file exceed 120 characters, the code needs reformatting or refactoring. Naming. Classes in PascalCase, methods and variables in camelCase, constants in UPPER_SNAKE_CASE. Descriptive names over short names. Single-letter names only in loop counters. Blank lines. One blank line between methods. One blank line between logical sections within a method. No two consecutive blank lines. After the Review If formatting issues are the only findings, the review should take under a minute. Automated formatting makes this the norm. If formatting issues are mixed with logic issues, ask the author to split the PR into two commits: one for formatting, one for logic changes. Tooling Recommendation Add a formatting check to your CI pipeline. Tools like Spotless (Maven/Gradle plugin) or Checkstyle can enforce formatting rules automatically. If the CI build fails on formatting, the author fixes it before asking for review. This removes formatting from the review process entirely.

More Free Developer Tools

DevToolCore

JSON formatter, regex tester, Base64, URL encoder, and 15+ more dev tools.

FontGenerator

14 Unicode font styles for social media, Discord, and anywhere you paste text.

CyberFengShui

Online Feng Shui compass with flying star analysis and AI interpretation.