-
-
Notifications
You must be signed in to change notification settings - Fork 708
Formatting for Eclipse
To apply automatic formatting and style enforcement according to our guidelines with Eclipse, you will require three files from the codingstyle directoy: eclipse_code_cleanup.xml, soot_eclipse_formatter.xml and soot_eclipse_importorder.importorder.
Once you open the project in Eclipse, go to Windows -> Preferences -> Java -> Code Style -> Clean Up, click on "Import" and select the eclipse_code_cleanup.xml file from the directory codingstyle.
Go to Windows -> Preferences -> Java -> Code Style -> Formatter, click on "Import" and select the soot_eclipse_formatter.xml file from the directory codingstyle.
Go to Windows -> Preferences -> Java -> Code Style -> Organize Imports, click on "Import" and select the soot_eclipse_import.importorder file from the directory codingstyle. Change the values in the fields for "Number of imports needed for .* " and "Number of static imports needed for .* " to 999. And click "Apply and close".
In Package Explorer, right click on the directory src/main/java, navigate to Source -> Clean Up and select "Use configured profile" (eclipse-cs soot). Click next to preview the changes and finish to apply them.
Similarly, in Package Explorer right click on the directory src/main/java, navigate to Source -> Format.
Just as above, right click on the directory src/main/java, navigate to Source -> Organize Import.
Note: This will apply the automatic formatting to all source files. For new files, it is sufficient to run these steps on the new files only. Eclipse can automatically do this by configuring format-on-save operation. Format-on-save will not run
clean up
. We suggest runningclean up
before every commit.
After following the above 6 steps, you can now validate the formatting against the checkstyle configurations by executing mvn validate
. Violations to the style conventions will be reported.
Eclipse also has a plugin that can automatically execute Checkstyle and report violations in the background. Having Soot configured as Maven project, installing the M2E Checkstyle Plugin should be sufficient.
Also check out Soot's webpage.
NOTE: If you find any bugs in those tutorials (or other parts of Soot) please help us out by reporting them in our issue tracker.
- Home
- Getting Help
- Tutorials
- Reference Material
- General Notions
- Getting Started
- A Few Uses of Soot
- Using Soot as a Command-Line Tool
- Using the Soot Eclipse Plugin
- Using Soot as a Compiler Framework
- Building Soot
- Coding Conventions
- Contributing to Soot
- Updating the Soot Web Page
- Reporting Bugs
- Preparing a New Soot Release