# Reformat Code

# Description

Reformats code according to the coding conventions defined in Eclipse. For example, line breaks will be added if lines are too long. Properly formatted code improves readability and makes collaboration easier.

# Benefits

Applying this rule improves readability and helps avoid merge conflicts.

# Tags

# Code Changes

Pre

public class CodeFormatterRule {
    public int a( int i ) { i *= 2; return i; }
    public int b( int i ) { if (0 == i) {return 1;} else {return 0;  } }

    /**
     * @param i Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
        @return evaluated in
     */
    public  int c( int i ) { return i + 3;}

}

Post

public class CodeFormatterRule {
    public int a(int i) {
        i *= 2;
        return i;
    }
    public int b(int i) {
        if (0 == i) {
            return 1;
        } else {
            return 0;
        }
    }
    /**
     * @param i
     *            Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed
     *            do eiusmod tempor incididunt ut labore et dolore magna aliqua.
     *            Ut enim ad minim veniam, quis nostrud exercitation ullamco
     *            laboris nisi ut aliquip ex ea commodo consequat. Duis aute
     *            irure dolor in reprehenderit in voluptate velit esse cillum
     *            dolore eu fugiat nulla pariatur. Excepteur sint occaecat
     *            cupidatat non proident, sunt in culpa qui officia deserunt
     *            mollit anim id est laborum.
     * @return evaluated in
     */
    public int c(int i) {
        return i + 3;
    }
}

🛠️ Auto-refactor Available

You can auto refactor this with jSparrow.
Drop this button to your Eclipse IDE workspace to install jSparrow for free:

Drag to your running Eclipse* workspace. *Requires Eclipse Marketplace Client

Need help? Check out our installation guide.

# Properties

Property Value
Rule ID CodeFormatter
First seen in jSparrow version 1.0.0
Minimum Java version 1.1
Remediation cost 1 min