-
-
Notifications
You must be signed in to change notification settings - Fork 712
Formatting for IntelliJ
To apply automatic formatting and style enforcement according to our guidelines with IntelliJ, you will require the Eclipse Code Formatter Plugin for IntelliJ, and two files from the codingstyle directoy: soot_eclipse_formatter.xml and soot_eclipse_importorder.importorder.
Once you have installed the Eclipse Code Formatter Plugin and opened the project in IntelliJ, go to File -> Settings -> Other Settings -> Eclipse Code Formatter, select "Use the Eclipse code formatter" radio button.
Import the "Eclipse Java Formatter config file", by clicking on browse and selecting the path for soot_eclipse_formatter.xml file.
Check "Optimize Imports", and load the import order configuration from soot_eclipse_import.importorder file in the directory codingstyle.
Go to File -> Settings -> Editor -> Code Style -> Java -> Imports.
Check "Use single class imports".
Ensure there is no package in the table "Packages to use Imports with .* ". If there are, remove them.
Change the values in the fields for "Class count to use import with .* " and "Names count to use import with .* " to 999. And click "Apply".
In Package Explorer, right click on the directory src/main/java, and navigate to Analyze -> Run inspection by name....
Type "Control Flow statements without braces" and hit enter.
Ensure that the scope is set to "Directory '...\src\main\java [soot]'" in the dialog box that appears, and click "Ok".
In Inspection results, if any problem is reported, click "Add braces to statement".
In Package Explorer, right click on the directory src/main/java, and click "Reformat code".
Check the options "Include subdirectories" and "Optimize imports".
Ensure that the option "Rearrange entries" is unchecked.
Click "Run".
Now IntelliJ will start formatting the selected directory, it will take a few minutes to complete.
After following the above steps, you can now validate the formatting against the checkstyle configurations by executing mvn validate
. Violations to the style conventions will be reported.
IntelliJ also has a plugin that can automatically execute Checkstyle and report violations in the background. Having Soot configured as Maven project, installing the CheckStyle-IDEA 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