User Tools

Site Tools


developer:contribution_guidelines

This is an old revision of the document!


OPNFV Coding Guidelines

Note: This document is a work in progress. Fundamentally stolen with pride at this time…

Git commit message style

For Git commit messages we recommend following the OpenStack commit message recommendations. See: https://wiki.openstack.org/wiki/GitCommitMessages

In a nutshell
  • Provide a brief description of the change in the first line.
  • Insert a single blank line after the first line.
  • Provide a detailed description of the change in the following lines. Use breaking paragraphs where needed.
  • The first line should be limited to 50 characters; should be written in present tense; and should not end with a period.
  • Subsequent lines should be wrapped at 70 characters.

Commit message content

The commit message must contain all the information required to fully understand & review the patch for correctness. Less is not more. More is more.

General Code headers

Headers must be applied to all contributed code. These should provide a copyright notice identifying the individual, and company where affiliated, of origin for the contribution and the licence under which the contribution was made. In OPNFV we use the Apache 2.0 license, some templates for code headers follow.

C/C++/Java

/*******************************************************************************
* Copyright (c) 2015 <Company or Individual> and others.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Apache License, Version 2.0
* which accompanies this distribution, and is available at
* http://www.apache.org/licenses/LICENSE-2.0
*******************************************************************************/

Bash/Python

##############################################################################
# Copyright (c) 2015 <Company or Individual> and others.
#
# All rights reserved. This program and the accompanying materials
# are made available under the terms of the Apache License, Version 2.0
# which accompanies this distribution, and is available at
# http://www.apache.org/licenses/LICENSE-2.0
##############################################################################

XML

<!--
Copyright (c) 2015 <Company or Individual> and others.

All rights reserved. This program and the accompanying materials
are made available under the terms of the Apache License, Version 2.0
which accompanies this distribution, and is available at
http://www.apache.org/licenses/LICENSE-2.0-->

General Code Style

Depends on the upstream project to which we intend to contribute to. If it's OPNFV specific 120 character line length would suffice. Yet, for OpenStack, a lot of projects enforce an 80 character length limit.

Java

In General we follow the Google Java Code Style Guide with a few exceptions. See: https://google-styleguide.googlecode.com/svn/trunk/javaguide.html

* 120 character line length * 72 or 80 chars for javadoc

Python

PEP8 is the Python standard that should be followed when coding any Python code with the following exceptions.

* 80 character line length

The usage of tools such as flake8 is encouraged.

developer/contribution_guidelines.1425217148.txt.gz · Last modified: 2015/03/01 13:39 by Juan Osorio Robles