GH-1757: Add Code Style Wiki page
Fixes: https://github.com/spring-projects/spring-integration/issues/1757
This commit is contained in:
committed by
Gary Russell
parent
020aa019a1
commit
4abc7861f0
@@ -140,64 +140,13 @@ This command, will provide the following output, which in this case shows a nice
|
||||
If you see intersecting lines, that usually means that you forgot to rebase you branch.
|
||||
As mentioned earlier, **please rebase against master** before issuing a pull request.
|
||||
|
||||
== Mind the whitespace
|
||||
== Follow the Code Style
|
||||
|
||||
Please carefully follow the whitespace and formatting conventions already present in the framework.
|
||||
Please, follow with the https://github.com/spring-projects/spring-integration/wiki/Spring-Integration-Framework-Code-Style[Spring Integration Code Style].
|
||||
|
||||
1. Tabs, not spaces
|
||||
2. Unix (LF), not DOS (CRLF) line endings
|
||||
3. Eliminate all trailing whitespace
|
||||
4. Wrap Javadoc at 90 characters
|
||||
5. Aim to wrap code at 120 characters, but favor readability over wrapping
|
||||
6. Preserve existing formatting; i.e. do not reformat code for its own sake
|
||||
7. Search the codebase using `git grep` and other tools to discover common
|
||||
naming conventions, etc.
|
||||
8. Latin-1 (ISO-8859-1) encoding for Java sources; use `native2ascii` to convert
|
||||
if necessary
|
||||
== Use `@since` tags
|
||||
|
||||
## Add Apache license header to all new classes
|
||||
|
||||
[source, java]
|
||||
----
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package ...;
|
||||
----
|
||||
|
||||
== Update license header to modified files as necessary
|
||||
|
||||
Always check the date range in the Apache license header. For example, if you've modified a file in 2016 whose header
|
||||
still reads
|
||||
|
||||
[source java]
|
||||
----
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
----
|
||||
|
||||
then be sure to update it to 2016 appropriately
|
||||
|
||||
[source java]
|
||||
----
|
||||
* Copyright 2002-2016 the original author or authors.
|
||||
----
|
||||
|
||||
== Use @since tags
|
||||
|
||||
Use @since tags for newly-added public API types and methods e.g.
|
||||
Use `@since` tags for newly-added public API types and methods e.g.
|
||||
|
||||
[source java]
|
||||
----
|
||||
@@ -210,9 +159,24 @@ Use @since tags for newly-added public API types and methods e.g.
|
||||
*/
|
||||
----
|
||||
|
||||
== Use `@author` tags
|
||||
|
||||
Use `@author` tag with your real name, when you change any class e.g.
|
||||
|
||||
[source java]
|
||||
----
|
||||
/**
|
||||
* ...
|
||||
*
|
||||
* @author First Last
|
||||
*/
|
||||
----
|
||||
|
||||
|
||||
== Submit JUnit test cases for all behavior changes
|
||||
|
||||
Search the codebase to find related unit tests and add additional @Test methods within. It is also acceptable to submit test cases on a per JIRA issue basis.
|
||||
Search the codebase to find related unit tests and add additional `@Test` methods within.
|
||||
It is also acceptable to submit test cases on a per JIRA issue basis.
|
||||
|
||||
== Squash commits
|
||||
|
||||
|
||||
Reference in New Issue
Block a user