Difference between revisions of "Contribute code"

From Archivematica
Jump to navigation Jump to search
(→‎Code Style Guide For Archivematica: pothole case instead of camel, updating import guidelines)
Line 20: Line 20:
 
*Tabs are forbidden.
 
*Tabs are forbidden.
 
*4 spaces per indent.
 
*4 spaces per indent.
*camelCase all variables, starting with lower case.
+
*pothole_case all variables, except for class names which are CamelCase (See PEP8 for details/clarifications)
 
*Max 79 characters per line.
 
*Max 79 characters per line.
*Each import is on it's own line (no comma separated imports)
+
*Import grouped according to where they come from and sorted alphabetically, by import source
*No spaces next to parenthesis '('
+
<pre>
*No space before comma, space after comma.
+
# Example:
*Assignments and comparators are given a single space separator 'x = 1'
+
# stdlib, alphabetical by import source
 +
import logging
 +
import os
 +
import stat
 +
 
 +
# Core Django, alphabetical by import source
 +
from django.core import validators
 +
from django.core.exceptions import ValidationError
 +
from django.db import models
 +
 
 +
# Third party dependencies, alphabetical by import source
 +
from django_extensions.db.fields import SomeField, UUIDField
 +
 
 +
# This project, alphabetical by import source
 +
import common.utils as utils
 +
</pre>
 +
*All imports from archivematicaCommon should be below adding that to the sys.path (though we shouldn't have to do that)
  
 
=== File Structure ===
 
=== File Structure ===

Revision as of 15:32, 23 September 2013

Main Page > Development > Contribute code


Patches

If you find a bug in this project or would like to make an enhancement, please be encouraged to contribute a patch by following these instructions.

Commit access

Anyone can contribute code patches to this project. Project collaborators and regular patch contributors will be given access to commit directly to the git code repository.

Contributor's Agreement

In order to accept any patches or code commits, contributors must first sign the Archivematica Contributor's Agreement.

Standards

Code Style Guide For Archivematica

This coding convention is adopted from:
http://www.python.org/dev/peps/pep-0008/
authors: Guido van Rossum <guido at python.org>, Barry Warsaw <barry at python.org>

  • Tabs are forbidden.
  • 4 spaces per indent.
  • pothole_case all variables, except for class names which are CamelCase (See PEP8 for details/clarifications)
  • Max 79 characters per line.
  • Import grouped according to where they come from and sorted alphabetically, by import source
# Example:
# stdlib, alphabetical by import source
import logging
import os
import stat

# Core Django, alphabetical by import source
from django.core import validators
from django.core.exceptions import ValidationError
from django.db import models

# Third party dependencies, alphabetical by import source
from django_extensions.db.fields import SomeField, UUIDField

# This project, alphabetical by import source
import common.utils as utils
  • All imports from archivematicaCommon should be below adding that to the sys.path (though we shouldn't have to do that)

File Structure

The file structure in Archivematica will comply with the Filesystem Hierarchy Standard (FHS).
More information on this standard is available at:
http://www.pathname.com/fhs/