Skip to content

Commit 7d7047f

Browse files
committed
Publish code style conventions (JAVA-446).
1 parent 24dc91c commit 7d7047f

4 files changed

Lines changed: 375 additions & 0 deletions

File tree

CONTRIBUTING.rst

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
Contributing guidelines
2+
=======================
3+
4+
Working on an issue
5+
-------------------
6+
7+
Before starting to work on something, please comment in JIRA or ask on the mailing list
8+
to make sure nobody else is working on it.
9+
10+
If a fix applies both to 2.0 and 2.1, work on the 2.0 branch, your commit will eventually
11+
get merged in 2.1.
12+
13+
Before you send your pull request, make sure that:
14+
15+
- you have a unit test that failed before the fix and succeeds after.
16+
- the fix is mentioned in ``driver-core/CHANGELOG.rst``.
17+
- the commit message include the reference of the JIRA ticket for automatic linking
18+
(example: ``Fix NPE when a connection fails during pool construction (JAVA-503).``).
19+
20+
As long as your pull request is not merged, it's OK to rebase your branch and push with
21+
``--force``.
22+
23+
If you want to contribute but don't have a specific issue in mind, the `lhf <https://datastax-oss.atlassian.net/secure/IssueNavigator.jspa?reset=true&mode=hide&jqlQuery=project%20%3D%20JAVA%20AND%20status%20in%20(Open%2C%20Reopened)%20AND%20labels%20%3D%20lhf>`_
24+
label in JIRA is a good place to start: it marks "low hanging fruits" that don't require
25+
in-depth knowledge of the codebase.
26+
27+
Editor configuration
28+
--------------------
29+
30+
General
31+
~~~~~~~
32+
33+
We consider automatic formatting as a help, not a crutch. Sometimes it makes sense to
34+
break the rules to make the code more readable, for instance aligning columns (see the
35+
constant declarations in ``DataType.Name`` for an example of this).
36+
37+
**Please do not reformat whole files, only the lines that you have added or modified**.
38+
39+
40+
Eclipse
41+
~~~~~~~
42+
43+
Formatter:
44+
45+
- Preferences > Java > Code Style > Formatter.
46+
- Click "Import".
47+
- Select ``src/main/config/ide/eclipse-formatter.xml``.
48+
49+
Import order:
50+
51+
- Preferences > Java > Code Style > Organize imports.
52+
- Click "Import".
53+
- Select ``src/main/config/ide/eclipse.importorder``.
54+
55+
Prevent trailing whitespaces:
56+
57+
- Preferences > Java > Editor > Save Actions.
58+
- Check "Perform the selected actions on save".
59+
- Ensure "Format source code" and "Organize imports" are unchecked.
60+
- Check "Additional actions".
61+
- Click "Configure".
62+
- In the "Code Organizing" tab, check "Remove trailing whitespace" and "All lines".
63+
- Click "OK" (the text area should only have one action "Remove trailing white spaces").
64+
65+
66+
IntelliJ IDEA
67+
~~~~~~~~~~~~~
68+
69+
- File > Import Settings...
70+
- Select ``src/main/config/ide/intellij-code-style.jar``.
71+
72+
This should add a new Code Style scheme called "java-driver".

0 commit comments

Comments
 (0)