Coding styles
OmegaT project uses following coding style rules and coding policy.
- Each java file has a GPL3 copyright header. OmegaT has an unit test to check header.
- Source code has maximum 120 characters in each line.
- Maximum line length of comments in sources is 80 characters
- Indentation is 4 spaces. Don't use TAB character.
- Source code should be ASCII code, 7bit clean. When you want to add your name in header, please escape.
- We don't use asterisk import. You should expand all individual imports.
- You are recommended to put javadoc comments for all your public methods.
- We don't set method arguments "final", but you are recommend to treat it as final.
- Bundle properties should be ASCII, 7bit clean. All translations should be escaped.
- It will change to be UTF-8 after OmegaT 6.1 development.
- Stable APIs should be under "org.omegat.core" package.
- GUI parts can be;
- written by hand, or
- Use NetBeans GUI builder
- We don't accept other GUI builder materials;
- such as JetBrains IntelliJ GUI builder, JForm Designer, Eclipse Window builder.
- If you want, you are recommended to implement it as plugin.
- We move XML parser to be StAX based instead of JAXB because of performance.
- We use Jackson XML serialization library.
Lint check
OmegaT project configures a build script with several linting tools. You can check your code with;
./gradlew check
Checkstyle
You can check your code with Checkstyle linting tool.
A project configuration is stored in config/checkstyle/checkstyle.xml
We treat checkstyle lint error as warning, but you are recommended to
improve your code before sending your patch to core team.
Spotless code formatter
Spotless is general purpose code formatting tool that make code spotless. It will help you to format your changed code just a command
./gradlew spotlessChangedApply
OmegaT uses Spotless plugin for gradle and configured with eclipse formatting configuration This XML file is project-standard indent configuration for Eclipse IDE, but also uses as spotless formatting rule.
There is other sample config file for IDE such as JetBrains IntelliJ Project configuration.