-
-
Notifications
You must be signed in to change notification settings - Fork 712
Formatting for IntellJ
The coding conventions defined in soot_checkstyle_checks.xml are automatically checked with Maven Checkstyle plugin and the build fails if the conventions are not followed.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
<version>${maven-checkstyle-plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.puppycrawl.tools</groupId>
<artifactId>checkstyle</artifactId>
<version>${checkstyle.version}</version>
</dependency>
</dependencies>
<executions>
<execution>
<id>validate</id>
<phase>validate</phase>
<configuration>
<propertyExpansion>config_loc=${checkstyle.dir.path}</propertyExpansion>
<configLocation>${checkstyle.file.path}</configLocation>
<encoding>UTF-8</encoding>
<consoleOutput>true</consoleOutput>
<failsOnError>true</failsOnError>
<violationSeverity>warning</violationSeverity>
</configuration>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
</plugin>
You will require three files from the directory directory codingstyle namely,
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 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.
Similary, 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.
After following the above 6 steps, you can now validate the formatting against the checkstyle configurations by executing Maven Validate.
Formatting is now automatically checked with the checkstyle plugin and violations(if any) are reported.
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