Projekt

Obecné

Profil

Akce

Policies » Historie » Revize 12

« Předchozí | Revize 12/36 (rozdíl) | Další »
Jan Pašek, 2021-03-03 16:26


Project convention

Git

Commit message shall have the following format:

#<id> - <short description> <details>

  • id issue ID from the Redmine
  • short description brief description of the change
  • details detailed list of changes (added classes, changed interfaces, ...)

RedMine

Code

General

  • Code and all comments shall be written in English
  • Code review is done for all code changes
  • Unit tests are done for all business logic parts
  • Python docstrings (bellow function header) shall be created for all functions describing the purpose, inputs and outputs
  • Avoid using names that are too general or too wordy. Strike a good balance between the two
  • When using CamelCase names, capitalize all letters of an abbreviation (e.g. HTTPServer)

Packages

  • Package names should be all lower case
  • When multiple words are needed, an underscore should separate them
  • It is usually preferable to stick to 1-word names

Modules

  • Module names should be all lower case
  • When multiple words are needed, an underscore should separate them
  • It is usually preferable to stick to 1 word names

Classes

  • Class names should follow the UpperCaseCamelCase convention
  • Exception classes should end in “Error”

Global Variables

  • Global variables should be all lowercase
  • Words in a global variable name should be separated by an underscore

Instance Variables

  • Instance variable names should be all lower case
  • Words in an instance variable name should be separated by an underscore
  • Non-public instance variables should begin with a double underscore
  • If a protected attribute is necessary to be used, the variable name shall start with a single underscore
  • If an instance name needs to be mangled (interpreter rewrites the name in order to avoid name conflicts in subclasses), two underscores may begin its name

Methods

  • Method names should be all lower case
  • Words in a method name should be separated by an underscore
  • Non-public method should begin with a single underscore
  • If a method name needs to be mangled, two underscores may begin its name

Method Arguments

  • Instance methods should have their first argument named ‘self’.
  • Class methods should have their first argument named ‘cls’

Functions

  • Function names should be all lower case
  • Words in a function name should be separated by an underscore

Constants

  • Constant names must be fully capitalized
  • Words in a constant name should be separated by an underscore

Aktualizováno uživatelem Jan Pašek před asi 4 roky(ů) · 12 revizí