69 строки
3.1 KiB
Plaintext
69 строки
3.1 KiB
Plaintext
= Code formatting guidelines
|
|
|
|
The directory src/eclipse has two files for use with code formatting, `eclipse-code-formatter.xml`
|
|
for the majority of the code formatting rules and `eclipse.importorder` to order the import
|
|
statements.
|
|
|
|
== Eclipse
|
|
Import these files by navigating `Windows -> Preferences` and then the menu items
|
|
`Preferences > Java > Code Style > Formatter` and `Preferences > Java > Code Style >
|
|
Organize Imports` respectively.
|
|
|
|
== IntelliJ IDEA
|
|
Install the plugin `Eclipse Code Formatter`. You can find it by searching in "Browse Repositories",
|
|
under `Settings > Plugins` within IDEA (Once installed, you will need to reboot IDEA for it to take
|
|
effect).
|
|
|
|
Then navigate to `Settings > Other Settings` (this might be under `Preferences` on Mac) and select
|
|
the Eclipse Code Formatter.
|
|
Select the `eclipse-code-formatter.xml` file for the field `Eclipse Java Formatter config file` and
|
|
the file `eclipse.importorder` for the field `Import order`.
|
|
Enable the `Eclipse code formatter` by clicking `Use the Eclipse code formatter` radio button at the
|
|
top of the page, then click the *OK* button.
|
|
|
|
* NOTE: If you configure the `Eclipse Code Formatter` from `File > Other Settings > Default
|
|
Settings`, it will set this policy across all of your IDEA projects.
|
|
|
|
* IDEA's "Optimize imports on the fly" option turned on interferes with the Eclipse code formatter
|
|
import optimization. Consider disabling the option if optimization does not yield the expected
|
|
results.
|
|
|
|
== Contributing a patch
|
|
|
|
1. Submit an issue describing your proposed change
|
|
|
|
2. A repository owner will respond to your issue as soon as possible
|
|
|
|
3. If your proposed change is accepted, and you haven't already done so, sign a
|
|
https://cla.pivotal.io/[Contributor License Agreement]
|
|
|
|
4. Fork the repository, develop and test your code changes
|
|
|
|
5. Ensure that your code adheres to the
|
|
https://github.com/spring-projects/spring-framework/wiki/Code-Style[Spring Style
|
|
Guide]
|
|
|
|
6. Ensure your code has an appropriate set of unit tests which all pass
|
|
|
|
7. If no-one else is using your branch, please rebase it against the current master (or
|
|
other target branch in the main project).
|
|
|
|
8. Submit a pull request. It will be approved and merged by a committer
|
|
|
|
== Code Conventions and Housekeeping
|
|
|
|
None of these is essential for a pull request, but they will all help. They can also be
|
|
added after the original pull request but before a merge.
|
|
|
|
* Make sure all new `.java` files to have a simple Javadoc class comment with at least an
|
|
`@author` tag identifying you, and preferably at least a paragraph on what the class is
|
|
for.
|
|
* Add the ASF license header comment to all new `.java` files (copy from existing files
|
|
in the project).
|
|
* Add yourself as an `@author` to the .java files that you modify substantially (more
|
|
than cosmetic changes).
|
|
* Add some Javadocs and, if you change the namespace, some XSD doc elements.
|
|
* When writing a commit message please follow http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html[these conventions],
|
|
if you are fixing an existing issue please add `Fixes gh-XXXX` at the end of the commit
|
|
message (where XXXX is the issue number).
|