mark-malyshev/intellijentstyleguide icon
public
Published on 8/16/2025
InterlliJentStyleGuide

Rules

follow the java style guide: Tabs, Spacing, Braces

Always use 4 spaces for indentation; never use tab characters.

Always put spaces around operators, commas, and semicolons.

Always separate keywords from parentheses with a space, except method names.

Never put spaces inside parentheses.

Always pick one brace style (same line or next line) and use it consistently.

final Modifier

Always declare method parameters as final.

Always mark fields and local variables final if they never change.

Naming

Always name classes and interfaces in CamelCase starting with uppercase.

Always name methods in camelCase starting with lowercase.

Always name constants in ALL_CAPS_WITH_UNDERSCORES.

Always name instance fields as myFieldName.

Always name method parameters as theName or name1.

Always name local variables in camelCase with no prefix.

Documentation

Always write complete Javadoc for every class, method, and field.

Always add a file header comment with project info.

Imports & Packages

Always place package first, then imports, then class Javadoc.

Always separate groups of imports with one blank line.

Always sort imports alphabetically within groups.

Always order groups: java., then javax., then others.

Code Organization

Always declare fields before constructors.

Always declare constructors before methods.

Always declare static fields before non-static fields.

Always declare static methods before non-static methods.

Always declare inner classes last.

Always order visibility: public, protected, package/default, private.

Miscellaneous

Always prefer a single exit point per method (except equals).

Always avoid deeply nested conditionals—refactor instead.

Always avoid excessively long methods, constructors, or classes.

Always replace magic numbers/strings with constants.

Never create meaningless constants like THREE = 3. Comment and javadoc all code