Login | Register
My pages Projects Community openCollabNet

Wiki: CodingStandard

Edit this page | Links to this page | Page information | Attachments | Refresh page


The coding standard defines a set of guidelines concerning recommended programming style and practices. Common guidelines improve the quality and the readability of the source code. Particularly, in context of software maintenance this is an important issue because 50%-75% of source code lifetime costs go to maintenance.

In context of RepoGuard, you should follow the official Python coding standard which is defined by PEP8.


  • The maximum lines length is 120.


  • Use the two-pages flyer which summarizes the most important conventions.

  • Use pylint to check the source code before you commit it to the repository (see the Build Targets).

  • Ensure that you do not commit source code which introduces new pylint errors.
  • Locally disable false-positives pylint warnings. Example:
    • Add the pylint disable directive in front of the corresponding code block.
    • Explain the reasons for disabling the specific warning.
    • Avoid module-wide pylint disable directives.
    • Use _ to suppress unused arguments. If you cannot change the naming of arguments, you can mention them at the beginning.
    • # pylint: disable=W0212
      # W0212: For testing it is fine to access protected members.
      # Copyright...
      class _ImporterMock(object): # pylint: disable=R0903
          """ Just used to mock the import behavior.
          success: Use this flag to change the result of an import.
          R0903: The class is just used for testing and does not require
          the minimum number of two methods.
          success = True
          def perform_import(self, _, names=None):
              """ Return value can be changed using the success attribute. """
              names = names
              return self.success
  • Keep consistency!

CodingStandard (last edited 2012-03-12 09:50:09 -0800 by ?schlauch)