Code Style
Last modified on Fri 17 Apr 2026

Our code style is based on Google Java Style Guide with some slight modifications. Some of the most important guidelines are:

Additionally, here is a (non-exhaustive) list of modifications:

Style Guidelines

items.stream() .filter(item -> item.length() > 5) .forEach(System.out::println); ```

You can simply import described code style into IntelliJ IDEA as shown here. The XML file for the style is available here. Checkstyle XML file is available here.

Writing readable code

Developers usually spend most of their time maintaining existing codebase and that means you will be reading other peoples' code a lot. In order to reduce time spent on deciphering code someone wrote six months ago, try to write readable code.

One of the most important aspects of readable code is self-documentation. Instead of writing cryptic code and commenting each line, write code which can be easily understood on its own.

For example, when naming variables and fields, try to avoid abbreviated names like UserPremissionFetchingService upfs = .... Instead, try to match type name as closely as possible (for example UserPermissionFetchingService userPermissionService = ...), or even use the full type name. The reason for this is that variables with abbreviated names use one more short-term memory slot than variables with descriptive names because you have to remember what abbreviation stands for. Since most of the time is spent on reading existing code, take a few extra seconds to type longer names. You and your colleagues will be grateful next time someone tries to read your code. ๐Ÿ˜Ž

Another aspect to keep in mind for self-documenting code is cyclomatic complexity. Don't have too many nested if-else branches in one method, instead extract functionality in some other private method. Who knows - maybe you will even be able to reuse that code somewhere else!

Other tips for writing readable code: * Avoid having multiple boolean method parameters - use enum or create a class for passing boolean parameters ```java // avoid this public void doSomething(boolean isGoingToCrash, boolean isGoingFast) { if (isGoingToCrash) { dont(); } // ... }

// do this instead public static class AccordinglyNamedParameters {

private final boolean isGoingToCrash;
private final boolean isGoingFast;

public AccordinglyNamedParameters(boolean isGoingToCrash, boolean isGoingFast) {
    this.isGoingToCrash = isGoingToCrash;
    this.isGoingFast = isGoingFast;
}

}

public void doSomething(AccordinglyNamedParameters parameters) { if (parameters.isGoingToCrash) { dont(); } // ... }

// or this public enum Collision { NO_COLLISION, WILL_CRASH }

public enum Speed { FAST, SLOW }

public void doSomething(Collision collision, Speed speed) { if (collision == WILL_CRASH) { dont(); } // ... } ``` * Avoid large methods with side-effects - functional code is easier to understand as you don't have to worry about state * For methods that cannot avoid having side-effects, separate functional and non-functional parts

Code Quality

All projects must be analyzed with SonarQube before release and you can and should do so locally. However, you can get on the fly feedback for most of the issues which SonarQube reports by using the SonarLint plugin for IntelliJ IDEA. Analysis is performed on the fly for each file, but you can analyze current file on demand with Analyze -> Analyze with SonarLint (default hotkey โ‡งโŒ˜S) or entire project with Analyze -> Analyze All Files with SonarLint. Here is a full list of default rules for SonarLint.

In addition to SonarLint, IntelliJ itself offers a lot of support for code inspection. Here is a configuration file with some additional inspections enabled.

NOTE: after importing inspections, IntelliJ will notify you that you that there are missing definitions of severities. Select the option to create missing severities and then set their colors and stripe marks to you liking.